Skip to content

Commit ef42a06

Browse files
committed
moved actions to topPanel and added scrollbar right
1 parent 46e77da commit ef42a06

14 files changed

Lines changed: 113 additions & 95 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "electron-gp",
33
"private": true,
4-
"version": "0.2.9",
4+
"version": "0.2.10",
55
"type": "module",
66
"main": "dist-main/app.js",
77
"author": "traeop",

src/main/app/window.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import { AuthService } from "../auth/service.js";
99
import { ControlUpdateWindowsPlatformService } from "../updater/services/windows/control-update.js";
1010
import { TrayService } from "../tray/service.js";
1111
import { destroyWindows } from "../@core/control-window/destroy.js";
12-
import { ipcWebContentsSend } from "../$shared/utils.js";
12+
import { ipcWebContentsSend, isDev } from "../$shared/utils.js";
1313
import { menu } from "../config.js";
1414

1515
@WindowManager<TWindows["main"]>({
1616
hash: "window:main",
1717
isCache: true,
1818
options: {
19-
resizable: false,
19+
resizable: isDev(),
2020
show: false,
21-
width: 600,
22-
height: 600,
21+
width: 280,
22+
height: 500,
2323
},
2424
})
2525
export class AppWindow implements TWindowManager {

src/renderer/layouts/Main.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const theme = createTheme({
1313
MuiCssBaseline: {
1414
styleOverrides: {
1515
body: {
16+
overflowY: "auto",
17+
overflowX: "hidden",
1618
"& #root": {
1719
width: "100%",
1820
},

src/renderer/ui-business/AddResource/components/AddButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const AddButton = memo(({ ...other }: TPropsButtonProvider) => {
99

1010
return (
1111
<IconButton onClick={handleAdd} {...other}>
12-
<AddCircleIcon fontSize="large" />
12+
<AddCircleIcon fontSize="medium" />
1313
</IconButton>
1414
);
1515
});

src/renderer/ui-business/Resources/components/Item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const Item = memo(
2020
const { isMasterKey, isDisabledActions } = useControlContext();
2121

2222
return (
23-
<Card sx={{ minWidth: 170 }}>
23+
<Card sx={{ width: "100%" }}>
2424
<CardContent>
2525
<Typography gutterBottom variant="h5">
2626
{name}

src/renderer/ui-business/Resources/components/Items.tsx

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,14 @@
11
import { memo } from "react";
2-
import Stack from "@mui/material/Stack";
3-
import Skeleton from "@mui/material/Skeleton";
4-
import Typography from "@mui/material/Typography";
5-
import CircularProgress from "@mui/material/CircularProgress";
6-
import { useControlContext } from "../hooks/useControlContext";
2+
import { useControlContext } from "../hooks";
73
import { useIpc } from "../hooks/useIpc";
84
import { Item } from "./Item";
95

10-
const countResources = localStorage.getItem("count-of-resources");
11-
126
export const Items = memo(() => {
137
useIpc();
148
const { list } = useControlContext();
159

1610
if (list === undefined) {
17-
return (
18-
<Stack spacing={2} direction="row" sx={{ flexWrap: "wrap" }} useFlexGap>
19-
{countResources !== null && Number(countResources) ? (
20-
Array.from({ length: Number(countResources) }, (_, i) => i).map(
21-
(_, i) => (
22-
<Skeleton key={i} variant="rounded" width={170} height={110} />
23-
)
24-
)
25-
) : (
26-
<CircularProgress size={70} />
27-
)}
28-
</Stack>
29-
);
30-
}
31-
32-
if (list !== undefined && list.length === 0) {
33-
return (
34-
<Stack spacing={2} direction="row" sx={{ flexWrap: "wrap" }} useFlexGap>
35-
<Typography gutterBottom variant="h5">
36-
Empty
37-
</Typography>
38-
</Stack>
39-
);
11+
return null;
4012
}
4113

4214
return list.map((item) => {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from "./useIpc";
2+
export * from "./useControlContext";

src/renderer/ui-business/Resources/hooks/useIpc.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const useIpc = () => {
1111
useEffect(() => {
1212
window.electron.receive.subscribeResources(({ items }) => {
1313
setItems(items);
14-
localStorage.setItem("count-of-resources", items.length + "");
1514
});
1615
}, []);
1716
};
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import Typography from "@mui/material/Typography";
2+
import Avatar from "@mui/material/Avatar";
23
import { useInvoke } from "../hooks";
34
import { memo } from "react";
45
import type { TPropsContainer } from "./types";
6+
import logo from "../../../../assets/72x72.png";
57

68
export const Container = memo(({ ...other }: TPropsContainer) => {
79
const { version } = useInvoke();
@@ -10,5 +12,14 @@ export const Container = memo(({ ...other }: TPropsContainer) => {
1012
return null;
1113
}
1214

13-
return <Typography {...other}>Current v{version}</Typography>;
15+
return (
16+
<>
17+
<Avatar
18+
sx={{ width: 28, height: 28 }}
19+
alt="logo of electron-gp"
20+
src={logo}
21+
/>
22+
<Typography {...other}>v{version}</Typography>
23+
</>
24+
);
1425
});

src/renderer/windows/home/components/ActionsKey.tsx

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,15 @@ const ActionsKey = memo(({ isMasterKey }: TPropsHomeChildren) => {
1313

1414
if (!isMasterKey) {
1515
return (
16-
<IconButton
17-
disabled={!isAuthenticated}
18-
sx={{
19-
position: "fixed",
20-
bottom: 10,
21-
right: 10,
22-
}}
23-
onClick={handleKey}
24-
>
25-
<HttpsIcon fontSize="large" />
16+
<IconButton size="small" disabled={!isAuthenticated} onClick={handleKey}>
17+
<HttpsIcon fontSize="medium" />
2618
</IconButton>
2719
);
2820
}
2921

3022
return (
31-
<IconButton
32-
disabled={!isAuthenticated}
33-
sx={{
34-
position: "fixed",
35-
bottom: 10,
36-
right: 70,
37-
}}
38-
onClick={handleKey}
39-
>
40-
<NoEncryptionGmailerrorredIcon fontSize="large" />
23+
<IconButton size="small" disabled={!isAuthenticated} onClick={handleKey}>
24+
<NoEncryptionGmailerrorredIcon fontSize="medium" />
4125
</IconButton>
4226
);
4327
});

0 commit comments

Comments
 (0)