add setting UI

This commit is contained in:
Wang Guan 2024-10-19 19:31:18 +09:00
parent 93ad218d68
commit df7edbd7d0
5 changed files with 25 additions and 2 deletions

View File

@ -236,7 +236,7 @@ export function Home() {
let running = true;
setTimeout(async () => {
if (running && syncStore.cloudSync()) {
if (running && syncStore.cloudSync() && syncStore.autoSync.onStart) {
try {
await syncStore.sync();
showToast(Locale.Settings.Sync.Success);

View File

@ -475,6 +475,21 @@ function SyncConfigModal(props: { onClose?: () => void }) {
</ListItem>
</List>
)}
<List>
<ListItem title={Locale.Settings.Sync.Config.AutoSync.OnStartup}>
<input
type="checkbox"
checked={syncStore.autoSync.onStart}
onChange={(e) => {
syncStore.update(
(config) =>
(config.autoSync.onStart = e.currentTarget.checked),
);
}}
/>
</ListItem>
</List>
</Modal>
</div>
);

View File

@ -254,6 +254,10 @@ const cn = {
UserName: "备份名称",
Password: "UpStash Redis REST Token",
},
AutoSync: {
OnStartup: "启动时自动同步",
},
},
LocalState: "本地数据",

View File

@ -257,6 +257,10 @@ const en: LocaleType = {
UserName: "Backup Name",
Password: "UpStash Redis REST Token",
},
AutoSync: {
OnStartup: "Sync on startup",
},
},
LocalState: "Local Data",

View File

@ -40,7 +40,7 @@ const DEFAULT_SYNC_STATE = {
},
autoSync: {
onStart: true,
onStart: false,
},
lastSyncTime: 0,