1
0
Fork 0

run limter

This commit is contained in:
ChaotiCryptidz 2022-01-22 13:11:54 +00:00
parent 634292cb8b
commit e116cbf81b
31 changed files with 109 additions and 161 deletions

View file

@ -1,17 +1,10 @@
import { JSX, RefObject } from "preact";
import { InputProps } from "./InputProps";
import { JSX, RefObject } from "preact";
type CheckboxProps = InputProps & {
checkboxRef?: RefObject<HTMLInputElement>;
}
};
export function Checkbox(props: CheckboxProps): JSX.Element {
return (
<input
class="uk-checkbox"
type="checkbox"
ref={props.checkboxRef}
{...props}
/>
)
}
return <input class="uk-checkbox" type="checkbox" ref={props.checkboxRef} {...props} />;
}

View file

@ -1,9 +1,8 @@
export type InputProps = {
name?: string;
value?: string;
placeholder?: string;
onChange?: () => void;
required?: boolean;
checked?: boolean;
extraProps?: {};
}
name?: string;
value?: string;
placeholder?: string;
onChange?: () => void;
required?: boolean;
checked?: boolean;
};

View file

@ -1,17 +1,12 @@
import { JSX, RefObject } from "preact";
import { InputProps } from "./InputProps";
import { JSX, RefObject } from "preact";
type NumberInputProps = InputProps & {
inputRef?: RefObject<HTMLInputElement>;
}
};
export function NumberInput(props: NumberInputProps): JSX.Element {
return (
<input
class="uk-input uk-form-width-medium"
type="number"
ref={props.inputRef}
{...props}
/>
)
}
<input class="uk-input uk-form-width-medium" type="number" ref={props.inputRef} {...props} />
);
}

View file

@ -1,17 +1,12 @@
import { JSX, RefObject } from "preact";
import { InputProps } from "./InputProps";
import { JSX, RefObject } from "preact";
type PasswordInputProps = InputProps & {
inputRef?: RefObject<HTMLInputElement>;
}
};
export function PasswordInput(props: PasswordInputProps): JSX.Element {
return (
<input
class="uk-input uk-form-width-medium"
type="password"
ref={props.inputRef}
{...props}
/>
)
}
<input class="uk-input uk-form-width-medium" type="password" ref={props.inputRef} {...props} />
);
}

View file

@ -1,33 +1,29 @@
import { JSX, RefObject } from "preact";
import { InputProps } from "./InputProps";
import { JSX, RefObject } from "preact";
type SelectProps = InputProps & {
selectRef?: RefObject<HTMLSelectElement>;
children?: JSX.Element | JSX.Element[];
}
};
export function Select(props: SelectProps): JSX.Element {
return (
<select
class="uk-select uk-form-width-medium"
ref={props.selectRef}
{...props}
>
<select class="uk-select uk-form-width-medium" ref={props.selectRef} {...props}>
{props.children}
</select>
)
);
}
type SelectOptionProps = {
name: string;
value: string;
selected?: boolean;
}
};
export function SelectOption(props: SelectOptionProps): JSX.Element {
return (
<option label={props.name} value={props.value} selected={props.selected}>
{props.name}
</option>
)
}
);
}

View file

@ -1,16 +1,12 @@
import { JSX, RefObject } from "preact";
import { InputProps } from "./InputProps";
import { JSX, RefObject } from "preact";
type TextInputProps = InputProps & {
textAreaRef?: RefObject<HTMLInputElement>;
}
};
export function TextArea(props: TextInputProps): JSX.Element {
return (
<textarea
class="uk-textarea uk-form-width-medium"
textAreaRef={props.textAreaRef}
{...props}
/>
)
}
<textarea class="uk-textarea uk-form-width-medium" textAreaRef={props.textAreaRef} {...props} />
);
}

View file

@ -1,17 +1,12 @@
import { JSX, RefObject } from "preact";
import { InputProps } from "./InputProps";
import { JSX, RefObject } from "preact";
type TextInputProps = InputProps & {
inputRef?: RefObject<HTMLInputElement>;
}
};
export function TextInput(props: TextInputProps): JSX.Element {
return (
<input
class="uk-input uk-form-width-medium"
type="text"
ref={props.inputRef}
{...props}
/>
)
}
<input class="uk-input uk-form-width-medium" type="text" ref={props.inputRef} {...props} />
);
}

View file

@ -1,4 +1,5 @@
import { Button } from "../../../../elements/Button";
import { Checkbox } from "../../../../elements/forms/Checkbox";
import { Component, createRef } from "preact";
import { DefaultPageProps } from "../../../../../types/DefaultPageProps";
import { ErrorMessage, sendErrorNotification } from "../../../../elements/ErrorMessage";
@ -6,16 +7,15 @@ import { Form } from "../../../../elements/forms/Form";
import { InputWithTitle } from "../../../../elements/InputWithTitle";
import { Margin } from "../../../../elements/Margin";
import { MarginInline } from "../../../../elements/MarginInline";
import { NumberInput } from "../../../../elements/forms/NumberInput";
import { PageTitle } from "../../../../elements/PageTitle";
import { PasswordInput } from "../../../../elements/forms/PasswordInput";
import { TextInput } from "../../../../elements/forms/TextInput";
import { UserType } from "../../../../../api/types/user";
import { route } from "preact-router";
import { toStr } from "../../../../../utils";
import { userPassUserViewURL } from "../../../pageLinks";
import i18next from "i18next";
import { PasswordInput } from "../../../../elements/forms/PasswordInput";
import { TextInput } from "../../../../elements/forms/TextInput";
import { NumberInput } from "../../../../elements/forms/NumberInput";
import { Checkbox } from "../../../../elements/forms/Checkbox";
const removeEmptyStrings = (arr: string[]) => arr.filter((e) => e.length > 0);

View file

@ -3,16 +3,16 @@ import { Component, createRef } from "preact";
import { DefaultPageProps } from "../../../../../types/DefaultPageProps";
import { ErrorMessage } from "../../../../elements/ErrorMessage";
import { Form } from "../../../../elements/forms/Form";
import { InputWithTitle } from "../../../../elements/InputWithTitle";
import { Margin } from "../../../../elements/Margin";
import { MarginInline } from "../../../../elements/MarginInline";
import { PageTitle } from "../../../../elements/PageTitle";
import { PasswordInput } from "../../../../elements/forms/PasswordInput";
import { TextInput } from "../../../../elements/forms/TextInput";
import { UserType } from "../../../../../api/types/user";
import { route } from "preact-router";
import { userPassUserViewURL } from "../../../pageLinks";
import i18next from "i18next";
import { TextInput } from "../../../../elements/forms/TextInput";
import { InputWithTitle } from "../../../../elements/InputWithTitle";
import { PasswordInput } from "../../../../elements/forms/PasswordInput";
export class UserPassUserNew extends Component<DefaultPageProps> {
errorMessageRef = createRef<ErrorMessage>();

View file

@ -3,12 +3,12 @@ import { Component, JSX, createRef } from "preact";
import { DefaultPageProps } from "../../types/DefaultPageProps";
import { ErrorMessage } from "../elements/ErrorMessage";
import { Form } from "../elements/forms/Form";
import { InputWithTitle } from "../elements/InputWithTitle";
import { Margin } from "../elements/Margin";
import { MarginInline } from "../elements/MarginInline";
import { PasswordInput } from "../elements/forms/PasswordInput";
import { route } from "preact-router";
import i18next from "i18next";
import { PasswordInput } from "../elements/forms/PasswordInput";
import { InputWithTitle } from "../elements/InputWithTitle";
export class TokenLoginForm extends Component<DefaultPageProps> {
errorMessageRef = createRef<ErrorMessage>();

View file

@ -3,13 +3,13 @@ import { Component, JSX, createRef } from "preact";
import { DefaultPageProps } from "../../types/DefaultPageProps";
import { ErrorMessage } from "../elements/ErrorMessage";
import { Form } from "../elements/forms/Form";
import { InputWithTitle } from "../elements/InputWithTitle";
import { Margin } from "../elements/Margin";
import { MarginInline } from "../elements/MarginInline";
import { PasswordInput } from "../elements/forms/PasswordInput";
import { TextInput } from "../elements/forms/TextInput";
import { route } from "preact-router";
import i18next from "i18next";
import { TextInput } from "../elements/forms/TextInput";
import { PasswordInput } from "../elements/forms/PasswordInput";
import { InputWithTitle } from "../elements/InputWithTitle";
export class UsernameLoginForm extends Component<DefaultPageProps> {
errorMessageRef = createRef<ErrorMessage>();

View file

@ -3,13 +3,13 @@ import { Component, createRef } from "preact";
import { DefaultPageProps } from "../../../types/DefaultPageProps";
import { ErrorMessage } from "../../elements/ErrorMessage";
import { Form } from "../../elements/forms/Form";
import { InputWithTitle } from "../../elements/InputWithTitle";
import { Margin } from "../../elements/Margin";
import { PageTitle } from "../../elements/PageTitle";
import { TextInput } from "../../elements/forms/TextInput";
import { policyViewURL } from "../pageLinks";
import { route } from "preact-router";
import i18next from "i18next";
import { TextInput } from "../../elements/forms/TextInput";
import { InputWithTitle } from "../../elements/InputWithTitle";
export class PolicyNew extends Component<DefaultPageProps> {
errorMessageRef = createRef<ErrorMessage>();

View file

@ -5,8 +5,8 @@ import { DefaultPageProps } from "../../types/DefaultPageProps";
import { Form } from "../elements/forms/Form";
import { Margin } from "../elements/Margin";
import { PageTitle } from "../elements/PageTitle";
import i18next from "i18next";
import { Select, SelectOption } from "../elements/forms/Select";
import i18next from "i18next";
const passwordLengthMin = 1;
const passwordLengthMax = 64;

View file

@ -6,6 +6,7 @@ import { ErrorMessage, sendErrorNotification } from "../../../elements/ErrorMess
import { InputWithTitle } from "../../../elements/InputWithTitle";
import { Margin } from "../../../elements/Margin";
import { SecretTitleElement } from "../SecretTitleElement";
import { Select, SelectOption } from "../../../elements/forms/Select";
import {
SupportedLanguages,
dumpData,
@ -14,7 +15,6 @@ import {
} from "../../../../utils/dataInterchange";
import { sortedObjectMap } from "../../../../utils";
import i18next from "i18next";
import { Select, SelectOption } from "../../../elements/forms/Select";
export type KVEditProps = DefaultPageProps & {
baseMount: string;

View file

@ -2,13 +2,13 @@ import { Button } from "../../../elements/Button";
import { Component, JSX, createRef } from "preact";
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
import { DoesNotExistError } from "../../../../types/internalErrors";
import { Margin } from "../../../elements/Margin";
import { SecretTitleElement } from "../SecretTitleElement";
import { TextInput } from "../../../elements/forms/TextInput";
import { delSecretsEngineURL, kvListURL, kvNewURL, kvViewURL } from "../../pageLinks";
import { route } from "preact-router";
import { sendErrorNotification } from "../../../elements/ErrorMessage";
import i18next from "i18next";
import { TextInput } from "../../../elements/forms/TextInput";
import { Margin } from "../../../elements/Margin";
export type KVKeysListProps = DefaultPageProps & {
baseMount: string;

View file

@ -3,13 +3,13 @@ import { Component, createRef } from "preact";
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
import { ErrorMessage } from "../../../elements/ErrorMessage";
import { Form } from "../../../elements/forms/Form";
import { InputWithTitle } from "../../../elements/InputWithTitle";
import { Margin } from "../../../elements/Margin";
import { SecretTitleElement } from "../SecretTitleElement";
import { TextInput } from "../../../elements/forms/TextInput";
import { kvViewURL } from "../../pageLinks";
import { route } from "preact-router";
import i18next from "i18next";
import { TextInput } from "../../../elements/forms/TextInput";
import { InputWithTitle } from "../../../elements/InputWithTitle";
export class KeyValueNew extends Component<DefaultPageProps> {
errorMessageRef = createRef<ErrorMessage>();

View file

@ -7,12 +7,12 @@ import { DoesNotExistError } from "../../../../types/internalErrors";
import { Grid, GridSizes } from "../../../elements/Grid";
import { InputWithTitle } from "../../../elements/InputWithTitle";
import { SecretTitleElement } from "../SecretTitleElement";
import { Select, SelectOption } from "../../../elements/forms/Select";
import { SupportedLanguages, dumpData, toPrismCode } from "../../../../utils/dataInterchange";
import { kvDeleteURL, kvEditURL, kvVersionsURL } from "../../pageLinks";
import { sendErrorNotification } from "../../../elements/ErrorMessage";
import { sortedObjectMap } from "../../../../utils";
import i18next from "i18next";
import { Select, SelectOption } from "../../../elements/forms/Select";
type KVSecretViewDataProps = DefaultPageProps & { data: Map<string, unknown> };

View file

@ -6,11 +6,11 @@ import { Form } from "../../../elements/forms/Form";
import { Margin } from "../../../elements/Margin";
import { MarginInline } from "../../../elements/MarginInline";
import { PageTitle } from "../../../elements/PageTitle";
import { Select, SelectOption } from "../../../elements/forms/Select";
import { TextInput } from "../../../elements/forms/TextInput";
import { kvListURL } from "../../pageLinks";
import { route } from "preact-router";
import i18next from "i18next";
import { Select, SelectOption } from "../../../elements/forms/Select";
import { TextInput } from "../../../elements/forms/TextInput";
export class NewKVEngine extends Component<DefaultPageProps> {
errorMessageRef = createRef<ErrorMessage>();
@ -21,11 +21,7 @@ export class NewKVEngine extends Component<DefaultPageProps> {
<PageTitle title={i18next.t("new_kv_engine_title")} />
<Form onSubmit={(data) => this.submit(data)}>
<Margin>
<TextInput
name="name"
placeholder={i18next.t("common_name")}
required
/>
<TextInput name="name" placeholder={i18next.t("common_name")} required />
</Margin>
<Margin>
<Select name="version">

View file

@ -6,10 +6,10 @@ import { Form } from "../../../elements/forms/Form";
import { Margin } from "../../../elements/Margin";
import { MarginInline } from "../../../elements/MarginInline";
import { PageTitle } from "../../../elements/PageTitle";
import { TextInput } from "../../../elements/forms/TextInput";
import { route } from "preact-router";
import { totpListURL } from "../../pageLinks";
import i18next from "i18next";
import { TextInput } from "../../../elements/forms/TextInput";
export class NewTOTPEngine extends Component<DefaultPageProps> {
errorMessageRef = createRef<ErrorMessage>();
@ -20,11 +20,7 @@ export class NewTOTPEngine extends Component<DefaultPageProps> {
<PageTitle title={i18next.t("new_totp_engine_title")} />
<Form onSubmit={(data) => this.submit(data)}>
<Margin>
<TextInput
name="name"
placeholder={i18next.t("common_name")}
required
/>
<TextInput name="name" placeholder={i18next.t("common_name")} required />
</Margin>
<Margin>

View file

@ -6,9 +6,9 @@ import { Form } from "../../../elements/forms/Form";
import { Margin } from "../../../elements/Margin";
import { MarginInline } from "../../../elements/MarginInline";
import { PageTitle } from "../../../elements/PageTitle";
import { TextInput } from "../../../elements/forms/TextInput";
import { route } from "preact-router";
import i18next from "i18next";
import { TextInput } from "../../../elements/forms/TextInput";
export class NewTransitEngine extends Component<DefaultPageProps> {
errorMessageRef = createRef<ErrorMessage>();
@ -19,11 +19,7 @@ export class NewTransitEngine extends Component<DefaultPageProps> {
<PageTitle title={i18next.t("new_transit_engine_title")} />
<Form onSubmit={(data) => this.submit(data)}>
<Margin>
<TextInput
name="name"
placeholder={i18next.t("common_name")}
required
/>
<TextInput name="name" placeholder={i18next.t("common_name")} required />
</Margin>
<Margin>

View file

@ -7,9 +7,9 @@ import { Margin } from "../../../elements/Margin";
import { MarginInline } from "../../../elements/MarginInline";
import { QRScanner } from "../../../elements/QRScanner";
import { SecretTitleElement } from "../SecretTitleElement";
import { TextInput } from "../../../elements/forms/TextInput";
import { route } from "preact-router";
import i18next from "i18next";
import { TextInput } from "../../../elements/forms/TextInput";
function replaceAll(str: string, replace: string, replaceWith: string): string {
return str.replace(new RegExp(replace, "g"), replaceWith);
@ -69,30 +69,23 @@ export class TOTPNewForm extends Component<
{!this.state.qrMode && (
<>
<Margin>
<TextInput
name="key"
placeholder={i18next.t("totp_new_key_input")}
/>
<TextInput name="key" placeholder={i18next.t("totp_new_key_input")} />
</Margin>
<Margin>
<TextInput
name="uri"
placeholder={i18next.t("totp_new_uri_input")}
/>
<TextInput name="uri" placeholder={i18next.t("totp_new_uri_input")} />
</Margin>
</>
)}
{this.state.qrMode && (
<QRScanner
onScan={(uri) => {
let formData = new FormData();
onScan={async (uri) => {
const formData = new FormData();
formData.set("key", "");
formData.set("name", this.nameInputRef.current.value)
formData.set("name", this.nameInputRef.current.value);
formData.set("uri", uri);
this.onSubmit(formData);
this.setState({ qrMode: !this.state.qrMode });
await this.onSubmit(formData);
}}
/>
)}

View file

@ -1,4 +1,5 @@
import { Button } from "../../../elements/Button";
import { Checkbox } from "../../../elements/forms/Checkbox";
import { Component, JSX, createRef } from "preact";
import { CopyableInputBox } from "../../../elements/CopyableInputBox";
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
@ -8,14 +9,13 @@ import { InputWithTitle } from "../../../elements/InputWithTitle";
import { Margin } from "../../../elements/Margin";
import { MarginInline } from "../../../elements/MarginInline";
import { NewTOTPResp } from "../../../../api/types/totp";
import { NumberInput } from "../../../elements/forms/NumberInput";
import { SecretTitleElement } from "../SecretTitleElement";
import { Select, SelectOption } from "../../../elements/forms/Select";
import { TextInput } from "../../../elements/forms/TextInput";
import { route } from "preact-router";
import { totpListURL } from "../../pageLinks";
import i18next from "i18next";
import { NumberInput } from "../../../elements/forms/NumberInput";
import { TextInput } from "../../../elements/forms/TextInput";
import { Checkbox } from "../../../elements/forms/Checkbox";
import { Select, SelectOption, } from "../../../elements/forms/Select";
export class TOTPNewGeneratedForm extends Component<
{ baseMount: string } & DefaultPageProps,
@ -30,11 +30,7 @@ export class TOTPNewGeneratedForm extends Component<
<Form onSubmit={(data) => this.onSubmit(data)}>
<Margin>
<InputWithTitle title={i18next.t("common_name")}>
<TextInput
name="name"
placeholder={i18next.t("common_name")}
required
/>
<TextInput name="name" placeholder={i18next.t("common_name")} required />
</InputWithTitle>
</Margin>

View file

@ -1,4 +1,5 @@
import { Button } from "../../../elements/Button";
import { Checkbox } from "../../../elements/forms/Checkbox";
import { Component, createRef } from "preact";
import { CopyableBox } from "../../../elements/CopyableBox";
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
@ -8,10 +9,9 @@ import { Form } from "../../../elements/forms/Form";
import { InputWithTitle } from "../../../elements/InputWithTitle";
import { Margin } from "../../../elements/Margin";
import { SecretTitleElement } from "../SecretTitleElement";
import { TextArea } from "../../../elements/forms/TextArea";
import { fileToBase64 } from "../../../../utils/fileToBase64";
import i18next from "i18next";
import { Checkbox } from "../../../elements/forms/Checkbox";
import { TextArea } from "../../../elements/forms/TextArea";
export class TransitDecrypt extends Component<DefaultPageProps, { plaintext: string }> {
errorMessageRef = createRef<ErrorMessage>();

View file

@ -1,4 +1,5 @@
import { Button } from "../../../elements/Button";
import { Checkbox } from "../../../elements/forms/Checkbox";
import { Component, createRef } from "preact";
import { CopyableBox } from "../../../elements/CopyableBox";
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
@ -8,10 +9,9 @@ import { Form } from "../../../elements/forms/Form";
import { InputWithTitle } from "../../../elements/InputWithTitle";
import { Margin } from "../../../elements/Margin";
import { SecretTitleElement } from "../SecretTitleElement";
import { TextArea } from "../../../elements/forms/TextArea";
import { fileToBase64 } from "../../../../utils/fileToBase64";
import i18next from "i18next";
import { Checkbox } from "../../../elements/forms/Checkbox";
import { TextArea } from "../../../elements/forms/TextArea";
export class TransitEncrypt extends Component<DefaultPageProps, { ciphertext: string }> {
errorMessageRef = createRef<ErrorMessage>();

View file

@ -3,15 +3,15 @@ import { Component, createRef } from "preact";
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
import { ErrorMessage } from "../../../elements/ErrorMessage";
import { Form } from "../../../elements/forms/Form";
import { InputWithTitle } from "../../../elements/InputWithTitle";
import { Margin } from "../../../elements/Margin";
import { MarginInline } from "../../../elements/MarginInline";
import { SecretTitleElement } from "../SecretTitleElement";
import { Select, SelectOption } from "../../../elements/forms/Select";
import { TextInput } from "../../../elements/forms/TextInput";
import { route } from "preact-router";
import { transitViewSecretURL } from "../../pageLinks";
import i18next from "i18next";
import { TextInput } from "../../../elements/forms/TextInput";
import { InputWithTitle } from "../../../elements/InputWithTitle";
import { Select, SelectOption } from "../../../elements/forms/Select";
export class TransitNew extends Component<DefaultPageProps> {
errorMessageRef = createRef<ErrorMessage>();

View file

@ -6,11 +6,11 @@ import { ErrorMessage, sendErrorNotification } from "../../../elements/ErrorMess
import { Form } from "../../../elements/forms/Form";
import { Margin } from "../../../elements/Margin";
import { SecretTitleElement } from "../SecretTitleElement";
import { Select, SelectOption } from "../../../elements/forms/Select";
import { TextArea } from "../../../elements/forms/TextArea";
import { TransitKeyType } from "../../../../api/types/transit";
import { objectToMap } from "../../../../utils";
import i18next from "i18next";
import { Select, SelectOption } from "../../../elements/forms/Select";
import { TextArea } from "../../../elements/forms/TextArea";
type versionOption = { version: string; label: string };

View file

@ -9,10 +9,10 @@ import { Form } from "../elements/forms/Form";
import { Margin } from "../elements/Margin";
import { MarginInline } from "../elements/MarginInline";
import { PageTitle } from "../elements/PageTitle";
import { Select, SelectOption } from "../elements/forms/Select";
import { getTranslationCompletePercentage } from "../../utils/translationUtils";
import { route } from "preact-router";
import i18next from "i18next";
import { Select, SelectOption } from "../elements/forms/Select.js";
export class SetLanguage extends Component<DefaultPageProps> {
render() {
@ -23,9 +23,9 @@ export class SetLanguage extends Component<DefaultPageProps> {
<Margin>
<Select name="language">
{Object.getOwnPropertyNames(translations).map((languageID) => {
let languageName = i18next.getFixedT(languageID, null)("language_name");
let languageCompletionPercent = getTranslationCompletePercentage(languageID);
let name = `${languageName} (${languageCompletionPercent})`
const languageName = i18next.getFixedT(languageID, null)("language_name");
const languageCompletionPercent = getTranslationCompletePercentage(languageID);
const name = `${languageName} (${languageCompletionPercent})`;
return (
<SelectOption
name={name}

View file

@ -2,12 +2,12 @@ import { Button } from "../elements/Button";
import { Component } from "preact";
import { DefaultPageProps } from "../../types/DefaultPageProps";
import { Form } from "../elements/forms/Form";
import { InputWithTitle } from "../elements/InputWithTitle";
import { Margin } from "../elements/Margin";
import { PageTitle } from "../elements/PageTitle";
import { TextInput } from "../elements/forms/TextInput";
import { route } from "preact-router";
import i18next from "i18next";
import { TextInput } from "../elements/forms/TextInput";
import { InputWithTitle } from "../elements/InputWithTitle";
export class SetVaultURL extends Component<DefaultPageProps> {
render() {

View file

@ -4,11 +4,11 @@ import { InputWithTitle } from "../../elements/InputWithTitle";
import i18next from "i18next";
// @ts-ignore
import { Select, SelectOption } from "../../elements/forms/Select";
import { TextInput } from "../../elements/forms/TextInput";
import { getTranslationCompletePercentage } from "../../../utils/translationUtils";
import { settingsSavedNotification } from "./Settings";
import translations from "../../../translations/index.mjs";
import { Select, SelectOption } from "../../elements/forms/Select";
import { TextInput } from "../../elements/forms/TextInput";
const Themes = [
{ name: "dark", readable: "Dark" },
@ -72,9 +72,9 @@ export class GeneralSettings extends Component<DefaultPageProps> {
}}
>
{Object.getOwnPropertyNames(translations).map((languageID) => {
let languageName = i18next.getFixedT(languageID, null)("language_name");
let languageCompletionPercent = getTranslationCompletePercentage(languageID);
let name = `${languageName} (${languageCompletionPercent})`
const languageName = i18next.getFixedT(languageID, null)("language_name");
const languageCompletionPercent = getTranslationCompletePercentage(languageID);
const name = `${languageName} (${languageCompletionPercent})`;
return (
<SelectOption
name={name}

View file

@ -1,13 +1,13 @@
import { Checkbox } from "../../elements/forms/Checkbox";
import { Component, createRef } from "preact";
import { DefaultPageProps } from "../../../types/DefaultPageProps";
import { InputWithTitle } from "../../elements/InputWithTitle";
import { NumberInput } from "../../elements/forms/NumberInput";
import { Select, SelectOption } from "../../elements/forms/Select";
import { SupportedLanguages } from "../../../utils/dataInterchange";
import { TextInput } from "../../elements/forms/TextInput";
import { settingsSavedNotification } from "./Settings";
import i18next from "i18next";
import { Select, SelectOption } from "../../elements/forms/Select";
import { NumberInput } from "../../elements/forms/NumberInput";
import { Checkbox } from "../../elements/forms/Checkbox";
import { TextInput } from "../../elements/forms/TextInput";
export class KeyValueViewSettings extends Component<DefaultPageProps> {
viewSyntaxSelectRef = createRef<HTMLSelectElement>();

View file

@ -1,10 +1,10 @@
import { Button } from "../elements/Button";
import { Form } from "../elements/forms/Form";
import { InputWithTitle } from "../elements/InputWithTitle";
import { JSX } from "preact/jsx-runtime";
import { MarginInline } from "../elements/MarginInline";
import i18next from "i18next";
import { PasswordInput } from "../elements/forms/PasswordInput";
import { InputWithTitle } from "../elements/InputWithTitle";
import i18next from "i18next";
type FormUnsealProps = {
onKeySubmit: (key: string) => void;
@ -12,9 +12,11 @@ type FormUnsealProps = {
export function UnsealForm(props: FormUnsealProps): JSX.Element {
return (
<Form onSubmit={(data: FormData) => {
props.onKeySubmit(data.get("unsealKey") as string);
}}>
<Form
onSubmit={(data: FormData) => {
props.onKeySubmit(data.get("unsealKey") as string);
}}
>
<MarginInline>
<InputWithTitle title={i18next.t("unseal_key_input_placeholder")}>
<PasswordInput