Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
thecybernanny-webapp
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
asranov0003
thecybernanny-webapp
Commits
b840a4ff
Commit
b840a4ff
authored
Jul 16, 2025
by
asranov0003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: render all apps
parent
9b440e85
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
6 deletions
+117
-6
BlockApps.css
src/pages/BlockApps/BlockApps.css
+24
-0
BlockApps.tsx
src/pages/BlockApps/BlockApps.tsx
+33
-6
appsSlice.ts
src/stores/slices/appsSlice.ts
+58
-0
store.ts
src/stores/store.ts
+2
-0
No files found.
src/pages/BlockApps/BlockApps.css
View file @
b840a4ff
...
...
@@ -16,6 +16,29 @@
text-align
:
center
;
}
.blockapps__content__apps
{
max-height
:
60vh
;
display
:
flex
;
flex-direction
:
column
;
gap
:
1rem
;
overflow-y
:
auto
;
}
.blockapps__content__app
{
display
:
flex
;
align-items
:
center
;
gap
:
1rem
;
padding
:
1rem
;
background
:
var
(
--content-bg-color
);
cursor
:
pointer
;
border-radius
:
10px
;
}
.blockapps__content__app
img
{
width
:
30px
;
height
:
30px
;
}
.blockapps__tabs
{
width
:
95vw
;
display
:
flex
;
...
...
@@ -24,6 +47,7 @@
position
:
fixed
;
bottom
:
0
;
padding
:
0.5rem
0
;
background
:
var
(
--background-color
);
}
.blockapps__tab
{
...
...
src/pages/BlockApps/BlockApps.tsx
View file @
b840a4ff
import
React
,
{
useState
}
from
"react"
;
import
React
,
{
use
Effect
,
use
State
}
from
"react"
;
import
"./BlockApps.css"
;
import
SectionHeader
from
"../../layouts/SectionHeader"
;
import
{
LuWalletCards
}
from
"react-icons/lu"
;
import
{
GoLock
,
GoUnlock
}
from
"react-icons/go"
;
import
CButton
from
"../../components/CButton"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useAppDispatch
,
useAppSelector
,
type
RootState
,
}
from
"../../stores/store"
;
import
{
fetchAppList
}
from
"../../stores/slices/appsSlice"
;
const
BlockApps
:
React
.
FC
=
()
=>
{
const
[
selectedTab
,
setSelectedTab
]
=
useState
<
"all"
|
"blocked"
|
"allowed"
>
(
"all"
);
const
{
t
}
=
useTranslation
();
const
{
selectedDevice
}
=
useAppSelector
((
state
:
RootState
)
=>
state
.
device
);
const
{
allApps
}
=
useAppSelector
((
state
:
RootState
)
=>
state
.
apps
);
const
dispatch
=
useAppDispatch
();
useEffect
(()
=>
{
dispatch
(
fetchAppList
(
selectedDevice
?.
id
||
""
));
},
[
selectedDevice
,
dispatch
]);
const
renderTabContent
=
()
=>
{
switch
(
selectedTab
)
{
...
...
@@ -18,7 +31,7 @@ const BlockApps: React.FC = () => {
return
(
<
div
className=
"blockapps__content"
>
<
h3
className=
"blockapps__content__title"
>
{
t
(
"blockapps.allapps"
)
}
(
0
)
{
t
(
"blockapps.allapps"
)
}
(
{
allApps
.
length
}
)
</
h3
>
<
p
className=
"blockapps__content__desc"
>
{
t
(
"blockapps.allappsDesc"
)
}
...
...
@@ -29,11 +42,25 @@ const BlockApps: React.FC = () => {
<
CButton
title=
{
t
(
"blockapps.allow"
)
}
disabled
/>
</
div
>
<
div
className=
"blockapps__content__empty"
>
<
p
>
{
t
(
"blockapps.noFoundApps"
)
}
</
p
>
{
allApps
.
length
===
0
&&
(
<
div
className=
"blockapps__content__empty"
>
<
p
>
{
t
(
"blockapps.noFoundApps"
)
}
</
p
>
</
div
>
)
}
<
div
className=
"blockapps__content__apps"
>
{
allApps
.
map
((
app
,
index
)
=>
{
return
(
<
div
key=
{
index
}
className=
"blockapps__content__app"
>
<
img
src=
{
`data:image/jpeg;base64,${app.appIcon}`
}
alt=
{
app
.
appName
}
/>
<
h4
>
{
app
.
appName
}
</
h4
>
</
div
>
);
})
}
</
div
>
<
div
className=
"blockapps__content__apps"
></
div
>
</
div
>
);
case
"blocked"
:
...
...
src/stores/slices/appsSlice.ts
0 → 100644
View file @
b840a4ff
import
{
createAsyncThunk
,
createSlice
}
from
"@reduxjs/toolkit"
;
import
{
sendRpcRequest
}
from
"../../services/apiClient"
;
export
interface
IApp
{
pkgName
:
string
;
appName
:
string
;
appVer
:
string
;
appVerInt
:
number
;
appIcon
:
string
;
}
interface
AppsState
{
allApps
:
IApp
[];
isLoadingAllApps
:
boolean
;
}
const
initialState
:
AppsState
=
{
allApps
:
[],
isLoadingAllApps
:
false
,
};
export
const
fetchAppList
=
createAsyncThunk
(
"apps/fetchAllApps"
,
async
(
deviceId
:
string
,
{
rejectWithValue
})
=>
{
try
{
const
response
=
await
sendRpcRequest
<
{
list
:
IApp
[]
}
>
(
"apps.applist"
,
{
deviceId
,
wIcons
:
true
,
});
return
response
.
list
;
}
catch
(
error
)
{
if
(
typeof
error
===
"object"
&&
error
!==
null
&&
"message"
in
error
)
{
return
rejectWithValue
(
error
.
message
);
}
return
rejectWithValue
(
"Unknown error occurred"
);
}
}
);
const
appsSlice
=
createSlice
({
name
:
"apps"
,
initialState
,
reducers
:
{},
extraReducers
:
(
builder
)
=>
{
builder
.
addCase
(
fetchAppList
.
pending
,
(
state
)
=>
{
state
.
isLoadingAllApps
=
true
;
})
.
addCase
(
fetchAppList
.
fulfilled
,
(
state
,
action
)
=>
{
state
.
isLoadingAllApps
=
false
;
state
.
allApps
=
action
.
payload
;
});
},
});
export
default
appsSlice
.
reducer
;
src/stores/store.ts
View file @
b840a4ff
...
...
@@ -4,6 +4,7 @@ import accountSlice from "./slices/accountSlice";
import
notificationSlice
from
"./slices/notificationSlice"
;
import
deviceSlice
from
"./slices/deviceSlice"
;
import
commandSlice
from
"./slices/commandSlice"
;
import
appsSlice
from
"./slices/appsSlice"
;
import
{
useDispatch
,
useSelector
,
...
...
@@ -17,6 +18,7 @@ export const store = configureStore({
notification
:
notificationSlice
,
device
:
deviceSlice
,
command
:
commandSlice
,
apps
:
appsSlice
,
},
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment