refactor: reorder arguments in web ui

This commit is contained in:
2026-03-22 03:23:09 +02:00
parent d7984c12f0
commit 5e090cebdb
61 changed files with 547 additions and 578 deletions
+1 -1
View File
@@ -26,9 +26,9 @@ interface AuthState {
export interface AuthContextValue extends AuthState {
isAuthorized: boolean;
setAuthState: (state: AuthState) => void;
login: (username: string, password: string) => Promise<void>;
logout: () => Promise<void>;
setAuthState: (state: AuthState) => void;
}
export const AuthContext = createContext<AuthContextValue | null>(null);
+3 -5
View File
@@ -24,9 +24,7 @@ import React, { type ReactNode, useMemo } from "react";
export function ClientProvider({ children }: { children: ReactNode }): React.JSX.Element {
const client = useMemo(() => new AhrimanClient(), []);
return (
<ClientContext.Provider value={client}>
{children}
</ClientContext.Provider>
);
return <ClientContext.Provider value={client}>
{children}
</ClientContext.Provider>;
}
+1 -1
View File
@@ -20,8 +20,8 @@
import { createContext } from "react";
export interface NotificationContextValue {
showSuccess: (title: string, message: string) => void;
showError: (title: string, message: string) => void;
showSuccess: (title: string, message: string) => void;
}
export const NotificationContext = createContext<NotificationContextValue | null>(null);
@@ -55,17 +55,17 @@ export function NotificationProvider({ children }: { children: ReactNode }): Rea
{children}
<Box
sx={{
position: "fixed",
top: 16,
left: "50%",
transform: "translateX(-50%)",
zIndex: theme => theme.zIndex.snackbar,
display: "flex",
flexDirection: "column",
gap: 1,
left: "50%",
maxWidth: 500,
width: "100%",
pointerEvents: "none",
position: "fixed",
top: 16,
transform: "translateX(-50%)",
width: "100%",
zIndex: theme => theme.zIndex.snackbar,
}}
>
{notifications.map(notification =>
+2 -2
View File
@@ -21,10 +21,10 @@ import type { RepositoryId } from "models/RepositoryId";
import { createContext } from "react";
export interface RepositoryContextValue {
repositories: RepositoryId[];
currentRepository: RepositoryId | null;
setRepositories: (repositories: RepositoryId[]) => void;
repositories: RepositoryId[];
setCurrentRepository: (repository: RepositoryId) => void;
setRepositories: (repositories: RepositoryId[]) => void;
}
export const RepositoryContext = createContext<RepositoryContextValue | null>(null);
+2 -4
View File
@@ -39,10 +39,8 @@ export function ThemeProvider({ children }: { children: React.ReactNode }): Reac
const theme = useMemo(() => createAppTheme(mode), [mode]);
useEffect(() => {
const textColor = mode === "dark" ? "rgba(255,255,255,0.7)" : "rgba(0,0,0,0.7)";
const gridColor = mode === "dark" ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)";
chartDefaults.color = textColor;
chartDefaults.borderColor = gridColor;
chartDefaults.color = mode === "dark" ? "rgba(255,255,255,0.7)" : "rgba(0,0,0,0.7)";
chartDefaults.borderColor = mode === "dark" ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)";
}, [mode]);
const value = useMemo(() => ({ mode, toggleTheme }), [mode, toggleTheme]);