AnoPaper/src/pages/settings.jsx

95 lines
2.1 KiB
React
Raw Normal View History

2023-04-03 19:38:03 +03:00
import {
SettingsCheckBox,
SettingsTextInput,
SettingsSelectInput,
2023-04-04 16:50:11 +03:00
SettingsPlaceholder,
2023-04-03 19:38:03 +03:00
} from "../components/settingsInputs";
2023-04-04 15:15:15 +03:00
import { reRenderPage } from "../components/utils";
import Locales from "../localisation/main";
2023-04-03 17:03:01 +03:00
function Settings() {
return (
<div className="">
<h1 className="text-center lg:text-left leading-tight text-2xl font-bold">
2023-04-04 15:15:15 +03:00
{locals.Settings}
2023-04-03 17:03:01 +03:00
</h1>
2023-04-04 15:15:15 +03:00
<SettingsPlaceholder text={locals.User} />
2023-04-03 19:38:03 +03:00
<SettingsTextInput
2023-04-04 15:15:15 +03:00
placeholder={locals.Name}
label={locals.UserName}
2023-04-03 19:38:03 +03:00
settingName="userName"
/>
<SettingsTextInput
2023-04-04 15:15:15 +03:00
placeholder={locals.Url}
label={locals.PhotoUrl}
2023-04-03 19:38:03 +03:00
settingName="userPhoto"
/>
<SettingsTextInput
2023-04-04 15:15:15 +03:00
placeholder={locals.Status}
label={locals.UserStatus}
2023-04-03 19:38:03 +03:00
settingName="userStatus"
/>
2023-04-04 15:15:15 +03:00
<SettingsPlaceholder text={locals.Notes} />
2023-04-03 19:38:03 +03:00
2023-04-03 17:03:01 +03:00
<SettingsCheckBox
2023-04-04 15:15:15 +03:00
label={locals.EditPreview}
title={locals.EditPreviewWarn}
2023-04-03 17:03:01 +03:00
settingName="editPreview"
/>
<SettingsCheckBox
2023-04-04 15:15:15 +03:00
label={locals.PublicNote}
title={locals.PublicNoteTitle}
2023-04-03 17:03:01 +03:00
settingName="publicNote"
/>
2023-04-03 19:38:03 +03:00
2023-04-04 16:50:11 +03:00
<SettingsCheckBox
label={locals.AdditionalFeatures}
settingName="additionalFeatures"
/>
2023-04-04 15:15:15 +03:00
<SettingsPlaceholder text={locals.Interface} />
2023-04-03 19:38:03 +03:00
<SettingsSelectInput
2023-04-04 15:15:15 +03:00
label={locals.Language}
2023-04-03 19:38:03 +03:00
settingName="language"
options={[
{
value: "ru",
label: "Русский",
},
{
value: "en",
2023-04-04 15:15:15 +03:00
label: "English (US)",
2023-04-03 19:38:03 +03:00
},
]}
2023-04-04 15:15:15 +03:00
onChange={(e) => {
window.locals =
Locales[window.settings.language] ||
Locales[navigator.language] ||
Locales[navigator.userLanguage] ||
Locales.en;
reRenderPage();
}}
2023-04-03 19:38:03 +03:00
/>
2023-04-04 15:15:15 +03:00
<SettingsPlaceholder text={locals.ThirdPartyApi} />
2023-04-03 19:38:03 +03:00
<SettingsTextInput
2023-04-04 15:15:15 +03:00
placeholder={locals.Key}
label={locals.OpenAiKey}
2023-04-03 19:38:03 +03:00
settingName="openAiKey"
secret
/>
2023-04-03 17:03:01 +03:00
</div>
);
}
export default Settings;