feat: some optimize

This commit is contained in:
Innei 2024-09-07 08:57:54 +08:00
parent 66174a028d
commit 5f6157972c
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
6 changed files with 38 additions and 3 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#fff" fill-opacity=".01" d="M24 0v24H0V0z"/><path stroke="#10161F" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 7v3.757a3 3 0 0 0 .879 2.122L15 15m6-3a9 9 0 1 1-18 0 9 9 0 0 1 18 0"/></svg>

After

Width:  |  Height:  |  Size: 302 B

View File

@ -21,6 +21,7 @@ export const TimeStamp = (props: { time: string }) => {
nextFrame(() => AudioPlayer.seek(timeStringToSeconds(props.time) || 0))
}}
>
<i className="i-mgc-time-cute-re translate-y-0.5 mr-1" />
{props.time}
</span>
)

View File

@ -153,7 +153,7 @@ export const SettingActionItem = ({
className={cn("relative mb-3 mt-4 flex items-center justify-between gap-4")}
>
<div className="text-sm font-medium">{label}</div>
<Button buttonClassName="text-xs absolute right-0" onClick={action}>
<Button buttonClassName="text-xs absolute right-0" variant="outline" onClick={action}>
{buttonText}
</Button>
</div>

View File

@ -8,6 +8,8 @@ import {
setUISetting,
useUISettingSelector,
} from "@renderer/atoms/settings/ui"
import { Button } from "@renderer/components/ui/button"
import { useModalStack } from "@renderer/components/ui/modal"
import {
Select,
SelectContent,
@ -40,6 +42,7 @@ export const SettingGeneral = () => {
setGeneralSetting("appLaunchOnStartup", checked)
}, [])
const { present } = useModalStack()
return (
<>
<SettingsTitle />
@ -128,8 +131,31 @@ export const SettingGeneral = () => {
{
label: "Rebuild Database",
action: async () => {
await clearLocalPersistStoreData()
window.location.reload()
present({
title: "Rebuild Database",
clickOutsideToDismiss: true,
content: () => (
<div className="text-sm">
<p>
Rebuilding the database will clear all your local data.
</p>
<p>Are you sure you want to continue?</p>
<div className="mt-4 flex justify-end">
<Button
className="text-red-500 px-3"
variant="ghost"
onClick={async () => {
await clearLocalPersistStoreData()
window.location.reload()
}}
>
Yes
</Button>
</div>
</div>
),
})
},
description:
"If you are experiencing rendering issues, rebuilding the database may solve them.",

View File

@ -27,3 +27,8 @@ export const saveImageDimensionsToDb = async (
url: string,
dimensions: StoreImageType,
) => await set(url, dimensions, db)
export const clearImageDimensionsDb = async () => {
const store = await db("readwrite", (store) => store.clear())
return store
}

View File

@ -3,6 +3,7 @@ import { browserDB } from "@renderer/database"
import { entryActions } from "../entry"
import { feedActions } from "../feed"
import { clearImageDimensionsDb } from "../image/db"
import { subscriptionActions } from "../subscription"
import { feedUnreadActions } from "../unread"
@ -16,5 +17,6 @@ export const clearLocalPersistStoreData = async () => {
clearUISettings()
await clearImageDimensionsDb()
await browserDB.delete().catch(() => null)
}