refactor(frontend): fix undefined --danger-color, dedup formatDate & require2FAOptions, drop double plan.css import
- base.css: var(--danger-color) (undefined, no fallback -> inherited color) -> var(--danger) - attendanceHelpers: re-export formatDate from formatters instead of a byte-identical copy - dashboard.ts: remove dead duplicate require2FAOptions (canonical copy is in settings.ts) - settings.ts: remove unused @deprecated systemSettingsOptions alias - PlanWork: drop redundant per-page plan.css import (loaded globally in AdminApp) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -265,7 +265,7 @@ img {
|
|||||||
border-radius: var(--border-radius-sm);
|
border-radius: var(--border-radius-sm);
|
||||||
background: var(--bg-tertiary);
|
background: var(--bg-tertiary);
|
||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
color: var(--danger-color);
|
color: var(--danger);
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
|||||||
@@ -9,12 +9,8 @@ export const dashboardOptions = () =>
|
|||||||
staleTime: 60_000,
|
staleTime: 60_000,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const require2FAOptions = () =>
|
// require2FAOptions lives in ./settings.ts (the single definition consumers
|
||||||
queryOptions({
|
// import). The duplicate copy that used to be here was dead.
|
||||||
queryKey: ["settings", "2fa"],
|
|
||||||
queryFn: () =>
|
|
||||||
jsonQuery<{ require_2fa: boolean }>("/api/admin/totp/required"),
|
|
||||||
});
|
|
||||||
|
|
||||||
export interface Session {
|
export interface Session {
|
||||||
id: number | string;
|
id: number | string;
|
||||||
|
|||||||
@@ -76,9 +76,6 @@ export const systemInfoOptions = () =>
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** @deprecated Use systemInfoOptions instead — this query fetches system-info, not system settings. */
|
|
||||||
export const systemSettingsOptions = systemInfoOptions;
|
|
||||||
|
|
||||||
export const require2FAOptions = () =>
|
export const require2FAOptions = () =>
|
||||||
queryOptions({
|
queryOptions({
|
||||||
queryKey: ["settings", "2fa"],
|
queryKey: ["settings", "2fa"],
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import PlanCategoriesModal from "../components/PlanCategoriesModal";
|
|||||||
import Forbidden from "../components/Forbidden";
|
import Forbidden from "../components/Forbidden";
|
||||||
import { projectListOptions, type Project } from "../lib/queries/projects";
|
import { projectListOptions, type Project } from "../lib/queries/projects";
|
||||||
import { planCategoriesOptions, type PlanCategory } from "../lib/queries/plan";
|
import { planCategoriesOptions, type PlanCategory } from "../lib/queries/plan";
|
||||||
import "../plan.css";
|
// plan.css is imported once globally in AdminApp.tsx — no per-page re-import.
|
||||||
|
|
||||||
const MONTH_NAMES = [
|
const MONTH_NAMES = [
|
||||||
"Leden",
|
"Leden",
|
||||||
|
|||||||
@@ -21,11 +21,9 @@ interface AttendanceRecord {
|
|||||||
}>;
|
}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const formatDate = (dateStr: string | null | undefined): string => {
|
// formatDate is defined once in ./formatters and re-exported here so existing
|
||||||
if (!dateStr) return "—";
|
// importers of attendanceHelpers keep working without a duplicate definition.
|
||||||
const d = new Date(dateStr);
|
export { formatDate } from "./formatters";
|
||||||
return d.toLocaleDateString("cs-CZ");
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Extract time as HH:MM from a datetime string without timezone conversion */
|
/** Extract time as HH:MM from a datetime string without timezone conversion */
|
||||||
const extractTime = (datetime: string): string => {
|
const extractTime = (datetime: string): string => {
|
||||||
|
|||||||
Reference in New Issue
Block a user