diff --git a/apps/desktop/src/routes/settings/general.tsx b/apps/desktop/src/routes/settings/general.tsx
index 4ba3e3f3c..0a8e43ef1 100644
--- a/apps/desktop/src/routes/settings/general.tsx
+++ b/apps/desktop/src/routes/settings/general.tsx
@@ -1,4 +1,4 @@
-import { DarkIcon, LightIcon, SystemModeIcon } from "@lume/icons";
+import { CheckIcon, DarkIcon, LightIcon, SystemModeIcon } from "@lume/icons";
import { useStorage } from "@lume/storage";
import * as Switch from "@radix-ui/react-switch";
import { invoke } from "@tauri-apps/api/core";
@@ -14,6 +14,7 @@ import { twMerge } from "tailwind-merge";
export function GeneralSettingScreen() {
const storage = useStorage();
+ const [apiKey, setAPIKey] = useState("");
const [settings, setSettings] = useState({
lowPower: false,
autoupdate: false,
@@ -22,6 +23,7 @@ export function GeneralSettingScreen() {
media: true,
hashtag: true,
notification: true,
+ translation: false,
appearance: "system",
});
@@ -77,6 +79,17 @@ export function GeneralSettingScreen() {
setSettings((prev) => ({ ...prev, notification: !settings.notification }));
};
+ const toggleTranslation = async () => {
+ await storage.createSetting("translation", String(+!settings.translation));
+ storage.settings.translation = !settings.translation;
+ // update state
+ setSettings((prev) => ({ ...prev, translation: !settings.translation }));
+ };
+
+ const saveApi = async () => {
+ await storage.createSetting("translateApiKey", apiKey);
+ };
+
useEffect(() => {
async function loadSettings() {
const theme = await getCurrent().theme();
@@ -121,6 +134,12 @@ export function GeneralSettingScreen() {
...prev,
hashtag: !!parseInt(item.value),
}));
+
+ if (item.key === "translation")
+ setSettings((prev) => ({
+ ...prev,
+ translation: !!parseInt(item.value),
+ }));
}
}
@@ -223,6 +242,46 @@ export function GeneralSettingScreen() {