mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
added better error messages if config secret permission is missing
This commit is contained in:
@@ -6,16 +6,27 @@ export type AlertProps = ComponentPropsWithoutRef<"div"> & {
|
||||
visible?: boolean;
|
||||
title?: string;
|
||||
message?: ReactNode | string;
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
const Base: React.FC<AlertProps> = ({ visible = true, title, message, className, ...props }) =>
|
||||
const Base: React.FC<AlertProps> = ({
|
||||
visible = true,
|
||||
title,
|
||||
message,
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}) =>
|
||||
visible ? (
|
||||
<div
|
||||
{...props}
|
||||
className={twMerge("flex flex-row dark:bg-amber-300/20 bg-amber-200 p-4", className)}
|
||||
className={twMerge(
|
||||
"flex flex-row items-center dark:bg-amber-300/20 bg-amber-200 p-4",
|
||||
className
|
||||
)}
|
||||
>
|
||||
{title && <b className="mr-2">{title}:</b>}
|
||||
{message}
|
||||
{message || children}
|
||||
</div>
|
||||
) : null;
|
||||
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
import { IconLockAccessOff } from "@tabler/icons-react";
|
||||
import { Empty, type EmptyProps } from "./Empty";
|
||||
|
||||
const NotFound = (props: Partial<EmptyProps>) => <Empty title="Not Found" {...props} />;
|
||||
const NotAllowed = (props: Partial<EmptyProps>) => <Empty title="Not Allowed" {...props} />;
|
||||
const MissingPermission = ({
|
||||
what,
|
||||
...props
|
||||
}: Partial<EmptyProps> & {
|
||||
what?: string;
|
||||
}) => (
|
||||
<Empty
|
||||
Icon={IconLockAccessOff}
|
||||
title="Missing Permission"
|
||||
description={`You're not allowed to access ${what ?? "this"}.`}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
||||
export const Message = {
|
||||
NotFound,
|
||||
NotAllowed
|
||||
NotAllowed,
|
||||
MissingPermission
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user