-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: mark unread when scroll switch
Signed-off-by: Innei <i@innei.in>
- Loading branch information
Showing
4 changed files
with
73 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { setGeneralSetting, useGeneralSettingValue } from "@renderer/atoms/settings/general" | ||
import { tipcClient } from "@renderer/lib/client" | ||
import { useCallback, useEffect, useState } from "react" | ||
|
||
import { SettingDescription, SettingSwitch } from "../control" | ||
import { SettingSectionTitle } from "../section" | ||
import { SettingsTitle } from "../title" | ||
|
||
export const SettingGeneral = () => { | ||
const [loginSetting, setLoginSetting] = useState(false) | ||
useEffect(() => { | ||
tipcClient?.getLoginItemSettings().then((settings) => { | ||
setLoginSetting(settings.openAtLogin) | ||
}) | ||
}, []) | ||
|
||
const saveLoginSetting = useCallback((checked: boolean) => { | ||
tipcClient?.setLoginItemSettings(checked) | ||
setLoginSetting(checked) | ||
}, []) | ||
|
||
const settings = useGeneralSettingValue() | ||
|
||
return ( | ||
<> | ||
<SettingsTitle /> | ||
<div className="mt-6"> | ||
{window.electron && ( | ||
<SettingSwitch | ||
label="Launch Follow at Login" | ||
checked={loginSetting} | ||
onCheckedChange={saveLoginSetting} | ||
/> | ||
)} | ||
|
||
<SettingSectionTitle title="Mark read" /> | ||
<SettingSwitch | ||
checked={settings.scrollMarkUnread} | ||
onCheckedChange={(checked) => | ||
setGeneralSetting("scrollMarkUnread", checked)} | ||
label="Mark as read when scrolling" | ||
/> | ||
<SettingDescription> | ||
Automatic marking of articles as read when the item is scrolled up out | ||
of the viewport. | ||
</SettingDescription> | ||
|
||
<SettingSectionTitle title="Data control" /> | ||
<SettingSwitch | ||
checked={settings.dataPersist} | ||
onCheckedChange={(checked) => | ||
setGeneralSetting("dataPersist", checked)} | ||
label="Persist data to offline usage" | ||
/> | ||
<SettingDescription> | ||
Data will be stored locally on your device for offline usage and speed | ||
up the data loading of the first screen. If you disable this, all | ||
local data will be removed. | ||
</SettingDescription> | ||
</div> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters