fix: when auth is disabled, the users entity doesn't exist

This commit is contained in:
dswbx
2024-11-21 08:23:16 +01:00
parent 4e7c1e6e9f
commit 0df5c761ec
14 changed files with 212 additions and 74 deletions

View File

@@ -0,0 +1,35 @@
import type { ComponentPropsWithoutRef } from "react";
import { twMerge } from "tailwind-merge";
export type AlertProps = ComponentPropsWithoutRef<"div"> & {
className?: string;
visible?: boolean;
title?: string;
message?: string;
};
const Base: React.FC<AlertProps> = ({ visible = true, title, message, className, ...props }) =>
visible ? (
<div
{...props}
className={twMerge("flex flex-row dark:bg-amber-300/20 bg-amber-200 p-4", className)}
>
<div>
{title && <b className="mr-2">{title}:</b>}
{message}
</div>
</div>
) : null;
const Warning: React.FC<AlertProps> = (props) => (
<Base {...props} className="dark:bg-amber-300/20 bg-amber-200" />
);
const Exception: React.FC<AlertProps> = (props) => (
<Base {...props} className="dark:bg-red-950 bg-red-100" />
);
export const Alert = {
Warning,
Exception
};