diff --git a/enjoy/src/main/window.ts b/enjoy/src/main/window.ts
index 26021eff..477fde45 100644
--- a/enjoy/src/main/window.ts
+++ b/enjoy/src/main/window.ts
@@ -360,7 +360,7 @@ main.init = async () => {
"view-show",
(
_event,
- bounds: {
+ bounds?: {
x: number;
y: number;
width: number;
@@ -372,6 +372,9 @@ main.init = async () => {
logger.debug("view-show", bounds);
view.setVisible(true);
+ if (bounds) {
+ view.setBounds(bounds);
+ }
}
);
diff --git a/enjoy/src/preload.ts b/enjoy/src/preload.ts
index ddc9b601..1443869f 100644
--- a/enjoy/src/preload.ts
+++ b/enjoy/src/preload.ts
@@ -180,7 +180,12 @@ contextBridge.exposeInMainWorld("__ENJOY_APP__", {
remove: () => {
return ipcRenderer.invoke("view-remove");
},
- show: (bounds: { x: number; y: number; width: number; height: number }) => {
+ show: (bounds?: {
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+ }) => {
return ipcRenderer.invoke("view-show", bounds);
},
scrape: (url: string) => {
diff --git a/enjoy/src/renderer/components/layouts/sidebar.tsx b/enjoy/src/renderer/components/layouts/sidebar.tsx
index 292df186..200f62ce 100644
--- a/enjoy/src/renderer/components/layouts/sidebar.tsx
+++ b/enjoy/src/renderer/components/layouts/sidebar.tsx
@@ -77,6 +77,14 @@ export const Sidebar = (props: {
});
}, []);
+ useEffect(() => {
+ if (displayPreferences) {
+ EnjoyApp.view.hide();
+ } else {
+ EnjoyApp.view.show();
+ }
+ }, [displayPreferences]);
+
return (
{
const [updaterState, setUpdaterState] = useState<
"checking-for-update" | "update-available" | "update-downloaded" | "error"
>();
-
+ const [quiting, setQuiting] = useState(false);
const { EnjoyApp, version, setDisplayPreferences, initialized } = useContext(
AppSettingsProviderContext
);
const { active, setActive } = useContext(CopilotProviderContext);
+ const navigate = useNavigate();
const checkUpdate = () => {
if (platform === "linux") {
@@ -111,6 +109,14 @@ export const TitleBar = () => {
};
}, []);
+ useEffect(() => {
+ if (quiting) {
+ EnjoyApp.view.hide();
+ } else {
+ EnjoyApp.view.show();
+ }
+ }, [quiting]);
+
return (
@@ -183,40 +189,12 @@ export const TitleBar = () => {
-
-
-
-
- {t("feedback")}
-
-
-
-
- EnjoyApp.shell.openExternal(
- "https://mixin.one/codes/f6ff96b8-54fb-4ad8-a6d4-5a5bdb1df13e"
- )
- }
- className="flex justify-between space-x-4"
- >
- Mixin
-
-
-
- EnjoyApp.shell.openExternal(
- "https://github.com/zuodaotech/everyone-can-use-english/discussions"
- )
- }
- className="flex justify-between space-x-4"
- >
- Github
-
-
-
-
-
-
+
navigate("/community")}
+ className="flex justify-between space-x-4"
+ >
+ {t("feedback")}
+
v{version}
@@ -283,7 +261,7 @@ export const TitleBar = () => {
)}
-
+