Localize bare switcher and add button
This commit is contained in:
parent
5c632642d4
commit
6c6c6626cf
6 changed files with 38 additions and 16 deletions
1
.env
Normal file
1
.env
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
test=TESTTTT
|
||||||
|
|
@ -52,11 +52,13 @@
|
||||||
},
|
},
|
||||||
"bare": {
|
"bare": {
|
||||||
"title": "Bare Server",
|
"title": "Bare Server",
|
||||||
"subtitle": "Enter the URL of your bare server"
|
"subtitle": "Enter the URL of your bare server",
|
||||||
|
"select": "Select"
|
||||||
},
|
},
|
||||||
"theme": {
|
"theme": {
|
||||||
"title": "Theme",
|
"title": "Theme",
|
||||||
"subtitle": "Choose a theme so your eyes don't hate us"
|
"subtitle": "Choose a theme so your eyes don't hate us",
|
||||||
|
"select": "Select"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,11 @@
|
||||||
"title": "Buscador",
|
"title": "Buscador",
|
||||||
"subtitle": "Elige tu motor de búsqueda."
|
"subtitle": "Elige tu motor de búsqueda."
|
||||||
},
|
},
|
||||||
|
"bare": {
|
||||||
|
"title": "Bare Server",
|
||||||
|
"subtitle": "Pon tu url de tu bare server",
|
||||||
|
"select": "Seleccionar"
|
||||||
|
},
|
||||||
"theme": {
|
"theme": {
|
||||||
"title": "Mirar",
|
"title": "Mirar",
|
||||||
"subtitle": "Elige una mirada para que tus ojos no nos odienn"
|
"subtitle": "Elige una mirada para que tus ojos no nos odienn"
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,11 @@
|
||||||
"title": "検索エンジン",
|
"title": "検索エンジン",
|
||||||
"subtitle": "ネビュラの検索エンジンを選択してください"
|
"subtitle": "ネビュラの検索エンジンを選択してください"
|
||||||
},
|
},
|
||||||
|
"bare": {
|
||||||
|
"title": "Bare サーバー",
|
||||||
|
"subtitle": "Bare サーバー URL を入力してください",
|
||||||
|
"select": "選択する"
|
||||||
|
},
|
||||||
"theme": {
|
"theme": {
|
||||||
"title": "テーマ",
|
"title": "テーマ",
|
||||||
"subtitle": "目が嫌いにならないようにテーマを選んでください"
|
"subtitle": "目が嫌いにならないようにテーマを選んでください"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { useState, useEffect } from "preact/hooks";
|
import { useState, useEffect } from "preact/hooks";
|
||||||
import { set } from "../../util/IDB";
|
import { set } from "../../util/IDB";
|
||||||
import { uninstallServiceWorkers } from "../../util/SWHelper";
|
import { uninstallServiceWorkers } from "../../util/SWHelper";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
interface BareInputProps {
|
interface BareInputProps {
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
|
|
@ -8,6 +9,7 @@ interface BareInputProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
function BareInput(props: BareInputProps) {
|
function BareInput(props: BareInputProps) {
|
||||||
|
const { t } = useTranslation();
|
||||||
const value = localStorage.getItem(props.storageKey) || "/bare/";
|
const value = localStorage.getItem(props.storageKey) || "/bare/";
|
||||||
const [inputValue, setInputValue] = useState(value);
|
const [inputValue, setInputValue] = useState(value);
|
||||||
function validateUrl(url: string) {
|
function validateUrl(url: string) {
|
||||||
|
|
@ -28,22 +30,29 @@ function BareInput(props: BareInputProps) {
|
||||||
}
|
}
|
||||||
return finalUrl;
|
return finalUrl;
|
||||||
}
|
}
|
||||||
function handleChange(event: any) {
|
function handleChange() {
|
||||||
const url = validateUrl(event.target.value);
|
const url = validateUrl((document.getElementById("input") as HTMLInputElement).value);
|
||||||
setInputValue(event.target.value);
|
setInputValue((document.getElementById("input") as HTMLInputElement).value);
|
||||||
set(props.storageKey, url);
|
set(props.storageKey, url);
|
||||||
localStorage.setItem(props.storageKey, url);
|
localStorage.setItem(props.storageKey, url);
|
||||||
uninstallServiceWorkers();
|
uninstallServiceWorkers();
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
<div className="flex flex-col items-center">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={props.placeholder}
|
placeholder={props.placeholder}
|
||||||
value={inputValue}
|
value={inputValue}
|
||||||
onBlur={handleChange}
|
id="input"
|
||||||
className="font-roboto flex h-14 w-56 flex-row rounded-2xl border border-input-border-color bg-input p-4 text-center text-xl"
|
className="font-roboto flex h-14 w-56 flex-row rounded-2xl border border-input-border-color bg-input p-4 text-center text-xl"
|
||||||
/>
|
/>
|
||||||
|
<div className="font-roboto items-center justify-center flex h-4 w-24 flex-row rounded-2xl border border-input-border-color bg-input p-4 text-center text-xl"
|
||||||
|
onClick={handleChange}
|
||||||
|
>
|
||||||
|
{t("settings.bare.select")}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ const Proxy = ({ id, active }) => {
|
||||||
variants={settingsPageVariant}
|
variants={settingsPageVariant}
|
||||||
className="content-card flex w-full flex-row flex-wrap justify-center gap-4"
|
className="content-card flex w-full flex-row flex-wrap justify-center gap-4"
|
||||||
>
|
>
|
||||||
<div className="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-7 text-center">
|
<div className="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-4 text-center">
|
||||||
<div className="p-2 text-3xl font-bold text-input-text">
|
<div className="p-2 text-3xl font-bold text-input-text">
|
||||||
{t("settings.proxy.title")}
|
{t("settings.proxy.title")}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -48,7 +48,7 @@ const Proxy = ({ id, active }) => {
|
||||||
</div>
|
</div>
|
||||||
<Dropdown storageKey="proxy" options={engines} refresh={false} />
|
<Dropdown storageKey="proxy" options={engines} refresh={false} />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-7 text-center">
|
<div className="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-4 text-center">
|
||||||
<div className="p-2 text-3xl font-bold text-input-text">
|
<div className="p-2 text-3xl font-bold text-input-text">
|
||||||
{t("settings.proxymodes.title")}
|
{t("settings.proxymodes.title")}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -61,7 +61,7 @@ const Proxy = ({ id, active }) => {
|
||||||
refresh={false}
|
refresh={false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-7 text-center">
|
<div className="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-4 text-center">
|
||||||
<div className="p-2 text-3xl font-bold text-input-text">
|
<div className="p-2 text-3xl font-bold text-input-text">
|
||||||
{t("settings.search.title")}
|
{t("settings.search.title")}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -74,7 +74,7 @@ const Proxy = ({ id, active }) => {
|
||||||
refresh={false}
|
refresh={false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-7 text-center">
|
<div className="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-4 text-center">
|
||||||
<div className="p-2 text-3xl font-bold text-input-text">
|
<div className="p-2 text-3xl font-bold text-input-text">
|
||||||
{t("settings.bare.title")}
|
{t("settings.bare.title")}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue