chore(options/other): use toggles

This commit is contained in:
Elian Doran
2026-04-13 15:27:01 +03:00
parent a33de6454f
commit 0ead37fd5c
2 changed files with 33 additions and 29 deletions

View File

@@ -1315,7 +1315,8 @@
},
"network_connections": {
"network_connections_title": "Network",
"check_for_updates": "Check for updates automatically"
"check_for_updates": "Check for updates automatically",
"check_for_updates_description": "Checks for new versions on GitHub and shows a notification in the global menu when available."
},
"note_erasure_timeout": {
"note_erasure_timeout_title": "Deleted Notes",
@@ -1998,7 +1999,7 @@
"days": "Days"
},
"share": {
"title": "Share Settings",
"title": "Share",
"redirect_bare_domain": "Redirect bare domain to Share page",
"redirect_bare_domain_description": "Redirect anonymous users to the Share page instead of showing Login",
"show_login_link": "Show Login link in Share theme",

View File

@@ -260,34 +260,35 @@ function ShareSettings() {
return (
<OptionsSection title={t("share.title")}>
<FormGroup name="redirectBareDomain" description={t("share.redirect_bare_domain_description")}>
<FormCheckbox
label={t(t("share.redirect_bare_domain"))}
currentValue={redirectBareDomain}
onChange={async value => {
if (value) {
const shareRootNotes = await search.searchForNotes("#shareRoot");
const sharedShareRootNote = shareRootNotes.find((note) => note.isShared());
<OptionsRowWithToggle
name="redirect-bare-domain"
label={t("share.redirect_bare_domain")}
description={t("share.redirect_bare_domain_description")}
currentValue={redirectBareDomain}
onChange={async value => {
if (value) {
const shareRootNotes = await search.searchForNotes("#shareRoot");
const sharedShareRootNote = shareRootNotes.find((note) => note.isShared());
if (sharedShareRootNote) {
toast.showMessage(t("share.share_root_found", { noteTitle: sharedShareRootNote.title }));
} else if (shareRootNotes.length > 0) {
toast.showError(t("share.share_root_not_shared", { noteTitle: shareRootNotes[0].title }));
} else {
toast.showError(t("share.share_root_not_found"));
}
if (sharedShareRootNote) {
toast.showMessage(t("share.share_root_found", { noteTitle: sharedShareRootNote.title }));
} else if (shareRootNotes.length > 0) {
toast.showError(t("share.share_root_not_shared", { noteTitle: shareRootNotes[0].title }));
} else {
toast.showError(t("share.share_root_not_found"));
}
setRedirectBareDomain(value);
}}
/>
</FormGroup>
}
setRedirectBareDomain(value);
}}
/>
<FormGroup name="showLoginInShareTheme" description={t("share.show_login_link_description")}>
<FormCheckbox
label={t("share.show_login_link")}
currentValue={showLogInShareTheme} onChange={setShowLogInShareTheme}
/>
</FormGroup>
<OptionsRowWithToggle
name="show-login-in-share-theme"
label={t("share.show_login_link")}
description={t("share.show_login_link_description")}
currentValue={showLogInShareTheme}
onChange={setShowLogInShareTheme}
/>
</OptionsSection>
);
}
@@ -297,10 +298,12 @@ function NetworkSettings() {
return (
<OptionsSection title={t("network_connections.network_connections_title")}>
<FormCheckbox
<OptionsRowWithToggle
name="check-for-updates"
label={t("network_connections.check_for_updates")}
currentValue={checkForUpdates} onChange={setCheckForUpdates}
description={t("network_connections.check_for_updates_description")}
currentValue={checkForUpdates}
onChange={setCheckForUpdates}
/>
</OptionsSection>
);