AnoPaper/src/pages/settings.jsx

106 lines
2.6 KiB
React
Raw Normal View History

2023-04-03 19:38:03 +03:00
import {
SettingsCheckBox,
SettingsTextInput,
SettingsSelectInput,
2023-04-04 17:15:25 +03:00
SettingsSection,
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 (
2023-04-04 17:15:25 +03:00
<div>
2023-04-03 17:03:01 +03:00
<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 17:15:25 +03:00
<SettingsSection name={locals.User}>
<SettingsTextInput
placeholder={locals.Name}
label={locals.UserName}
settingName="userName"
/>
2023-04-03 19:38:03 +03:00
2023-04-04 17:15:25 +03:00
<SettingsTextInput
placeholder={locals.Url}
label={locals.PhotoUrl}
settingName="userPhoto"
/>
2023-04-03 19:38:03 +03:00
2023-04-04 17:15:25 +03:00
<SettingsTextInput
placeholder={locals.Status}
label={locals.UserStatus}
settingName="userStatus"
/>
</SettingsSection>
2023-04-03 19:38:03 +03:00
2023-04-04 17:15:25 +03:00
<SettingsSection name={locals.Notes}>
<SettingsCheckBox
label={locals.EditPreview}
title={locals.EditPreviewWarn}
settingName="editPreview"
/>
2023-04-03 19:38:03 +03:00
2023-04-04 17:15:25 +03:00
<SettingsCheckBox
label={locals.PublicNote}
title={locals.PublicNoteTitle}
settingName="publicNote"
/>
2023-04-03 19:38:03 +03:00
2023-04-04 17:15:25 +03:00
<SettingsCheckBox
label={locals.AdditionalFeatures}
settingName="additionalFeatures"
/>
2023-04-04 20:10:41 +03:00
<SettingsCheckBox label={locals.CollabEdit} settingName="CollabEdit" />
<SettingsTextInput
placeholder={locals.Password}
label={locals.CollabEditPassword}
settingName="CollabEditPassword"
onChange={(e) => {
window.alreadyConnected = false;
}}
/>
2023-04-04 17:15:25 +03:00
</SettingsSection>
2023-04-03 17:03:01 +03:00
2023-04-04 17:15:25 +03:00
<SettingsSection name={locals.Interface}>
<SettingsSelectInput
label={locals.Language}
settingName="language"
options={[
{
value: "ru",
label: "Русский",
},
{
value: "en",
label: "English (US)",
},
]}
onChange={(e) => {
window.locals =
Locales[window.settings.language] ||
Locales[navigator.language] ||
Locales[navigator.userLanguage] ||
Locales.en;
2023-04-03 19:38:03 +03:00
2023-04-04 17:15:25 +03:00
reRenderPage();
}}
/>
</SettingsSection>
2023-04-04 16:50:11 +03:00
2023-04-04 17:15:25 +03:00
<SettingsSection name={locals.ThirdPartyApi}>
<SettingsTextInput
placeholder={locals.Key}
label={locals.OpenAiKey}
settingName="openAiKey"
secret
/>
</SettingsSection>
2023-04-03 17:03:01 +03:00
</div>
);
}
export default Settings;