style: clean up code with prettier and eslint
This commit is contained in:
1 parent
60278b9e71
commit
fb8e77bb68
378 files changed
+22407
-20689
No files matched your search
@@ -53,7 +53,11 @@ function toHex(value: string | null, def: string): string {
|
||||
return value && /^#[0-9a-fA-F]{6}$/.test(value) ? value : def;
|
||||
}
|
||||
|
||||
function colorGrid(fields: { key: string; label: string; def: string }[], current: Record<string, string>, suffix = "") {
|
||||
function colorGrid(
|
||||
fields: { key: string; label: string; def: string }[],
|
||||
current: Record<string, string>,
|
||||
suffix = "",
|
||||
) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
@@ -94,10 +98,16 @@ export default async function AdminTheme({
|
||||
const defaultPreset = PRESETS["Atom (golden)"];
|
||||
const currentDark = Object.fromEntries(
|
||||
await Promise.all(
|
||||
ALL_COLORS.map(async (f) => [
|
||||
f.key,
|
||||
(await siteSettings.get(`${f.key}_dark`, defaultPreset.dark[f.key as keyof typeof defaultPreset.dark])) ?? defaultPreset.dark[f.key as keyof typeof defaultPreset.dark],
|
||||
] as const),
|
||||
ALL_COLORS.map(
|
||||
async (f) =>
|
||||
[
|
||||
f.key,
|
||||
(await siteSettings.get(
|
||||
`${f.key}_dark`,
|
||||
defaultPreset.dark[f.key as keyof typeof defaultPreset.dark],
|
||||
)) ?? defaultPreset.dark[f.key as keyof typeof defaultPreset.dark],
|
||||
] as const,
|
||||
),
|
||||
),
|
||||
) as Record<string, string>;
|
||||
const radius = (await siteSettings.get("border_radius", "12")) ?? "12";
|
||||
@@ -123,11 +133,7 @@ export default async function AdminTheme({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{sp.saved ? (
|
||||
<div className="mb-4 p-3 rounded-lg theme-status-success text-xs">
|
||||
{t("saved")}
|
||||
</div>
|
||||
) : null}
|
||||
{sp.saved ? <div className="mb-4 p-3 rounded-lg theme-status-success text-xs">{t("saved")}</div> : null}
|
||||
{sp.preset ? (
|
||||
<div className="mb-4 p-3 rounded-lg theme-status-success text-xs">
|
||||
{t("presetApplied", { preset: sp.preset })}
|
||||
@@ -149,7 +155,7 @@ export default async function AdminTheme({
|
||||
width: 14,
|
||||
height: 14,
|
||||
borderRadius: 3,
|
||||
// eslint-disable-next-line security/detect-object-injection -- k from hardcoded array
|
||||
|
||||
background: palette.light[k as keyof typeof palette.light],
|
||||
boxShadow: "inset 0 0 0 1px rgba(0,0,0,0.15)",
|
||||
marginLeft: -3,
|
||||
|
||||
Reference in new issue
Block a user