feat(admin-web): add web/admin to repo

Initial commit of the Super-Admin web panel (Next.js + TypeScript).
CI admin-web-check job was failing because the directory was never
tracked in git.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-05-28 18:45:57 +03:30
parent f717c02467
commit 0a33497d40
98 changed files with 17848 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
import { toast } from "sonner";
import { ApiClientError } from "@/lib/api/client";
export type NotifyOptions = {
description?: string;
duration?: number;
};
function baseOptions(opts?: NotifyOptions) {
return {
description: opts?.description,
duration: opts?.duration ?? 4000,
};
}
/** Toast notifications — use for transient success/error/info across the app */
export const notify = {
success(message: string, opts?: NotifyOptions) {
toast.success(message, baseOptions(opts));
},
error(message: string, opts?: NotifyOptions) {
toast.error(message, { ...baseOptions(opts), duration: opts?.duration ?? 5500 });
},
warning(message: string, opts?: NotifyOptions) {
toast.warning(message, baseOptions(opts));
},
info(message: string, opts?: NotifyOptions) {
toast.info(message, baseOptions(opts));
},
loading(message: string) {
return toast.loading(message);
},
dismiss(id?: string | number) {
toast.dismiss(id);
},
promise<T>(
promise: Promise<T>,
messages: { loading: string; success: string; error?: string }
) {
return toast.promise(promise, {
loading: messages.loading,
success: messages.success,
error: messages.error ?? messages.loading,
});
},
};
export function getErrorMessage(err: unknown, fallback: string): string {
if (err instanceof ApiClientError) return err.message;
if (err instanceof Error && err.message) return err.message;
return fallback;
}
export function notifyError(err: unknown, fallback: string) {
notify.error(getErrorMessage(err, fallback));
}