Skip to content

Commit

Permalink
fix: launch at login only in electron (#82)
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei authored Jun 22, 2024
1 parent dc27964 commit 02e6b51
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/renderer/src/pages/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useDark } from "@renderer/hooks"
import { tipcClient } from "@renderer/lib/client"
import { SettingsTitle } from "@renderer/modules/settings/title"
import { useCallback, useEffect, useState } from "react"
import { toast } from "sonner"

export function Component() {
const { isDark, toggleDark } = useDark()
Expand All @@ -19,28 +18,32 @@ export function Component() {
const saveLoginSetting = useCallback((checked: boolean) => {
tipcClient?.setLoginItemSettings(checked)
setLoginSetting(checked)
toast.success("Settings saved.")
}, [])

const saveDarkSetting = useCallback(() => {
toggleDark()
toast.success("Settings saved.")
}, [])

return (
<>
<SettingsTitle path="" sticky className="mb-4" />
<div className="mt-6 space-y-6">
{window.electron && (
<div className="flex items-center gap-4">
<Checkbox
id="launch"
checked={loginSetting}
onCheckedChange={saveLoginSetting}
/>
<Label htmlFor="launch">Launch Follow at Login</Label>
</div>
)}
<div className="flex items-center gap-4">
<Checkbox
id="launch"
checked={loginSetting}
onCheckedChange={saveLoginSetting}
id="dark"
checked={isDark}
onCheckedChange={saveDarkSetting}
/>
<Label htmlFor="launch">Launch Follow at Login</Label>
</div>
<div className="flex items-center gap-4">
<Checkbox id="dark" checked={isDark} onCheckedChange={saveDarkSetting} />
<Label htmlFor="dark">Dark Mode</Label>
</div>
</div>
Expand Down

0 comments on commit 02e6b51

Please sign in to comment.