Fixed message of button inside button at Admin page
This commit is contained in:
parent
c34810b161
commit
f0f5887452
4 changed files with 35 additions and 22 deletions
|
|
@ -26,4 +26,20 @@ const Checkbox = React.forwardRef<
|
||||||
));
|
));
|
||||||
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
||||||
|
|
||||||
export { Checkbox };
|
const CheckBoxDiv = (({ className = "", checked }: {className?: string, checked?: boolean}) => (
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
className,
|
||||||
|
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
||||||
|
checked ? "bg-primary text-primary-foreground" : ""
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{checked && (
|
||||||
|
<div className="flex items-center justify-center text-current">
|
||||||
|
<IconComponent name="Check" className="h-4 w-4" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
));
|
||||||
|
|
||||||
|
export { CheckBoxDiv, Checkbox };
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import ShadTooltip from "../../components/ShadTooltipComponent";
|
import ShadTooltip from "../../components/ShadTooltipComponent";
|
||||||
import { Button } from "../../components/ui/button";
|
import { Button } from "../../components/ui/button";
|
||||||
import { ConfirmationModalType, ContentProps, TriggerProps } from "../../types/components";
|
import {
|
||||||
|
ConfirmationModalType,
|
||||||
|
ContentProps,
|
||||||
|
TriggerProps,
|
||||||
|
} from "../../types/components";
|
||||||
import { nodeIconsLucide } from "../../utils/styleUtils";
|
import { nodeIconsLucide } from "../../utils/styleUtils";
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
|
|
||||||
|
|
@ -12,15 +16,14 @@ const Trigger: React.FC<TriggerProps> = ({
|
||||||
children,
|
children,
|
||||||
tooltipContent,
|
tooltipContent,
|
||||||
side,
|
side,
|
||||||
asChild,
|
}: TriggerProps) => {
|
||||||
}) => {
|
return tooltipContent ? (
|
||||||
return asChild ? children : (tooltipContent ? (
|
|
||||||
<ShadTooltip side={side} content={tooltipContent}>
|
<ShadTooltip side={side} content={tooltipContent}>
|
||||||
<div className="h-full w-full">{children}</div>
|
<div className="h-full w-full">{children}</div>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
) : (
|
) : (
|
||||||
<div className="h-full w-full">{children}</div>
|
<div className="h-full w-full">{children}</div>
|
||||||
));
|
);
|
||||||
};
|
};
|
||||||
function ConfirmationModal({
|
function ConfirmationModal({
|
||||||
title,
|
title,
|
||||||
|
|
@ -59,13 +62,7 @@ function ConfirmationModal({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseModal size={size} open={modalOpen} setOpen={setModalOpen}>
|
<BaseModal size={size} open={modalOpen} setOpen={setModalOpen}>
|
||||||
<>
|
<BaseModal.Trigger>{triggerChild}</BaseModal.Trigger>
|
||||||
{triggerChild && (
|
|
||||||
<BaseModal.Trigger>
|
|
||||||
{triggerChild}
|
|
||||||
</BaseModal.Trigger>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
<BaseModal.Header description={titleHeader ?? null}>
|
<BaseModal.Header description={titleHeader ?? null}>
|
||||||
<span className="pr-2">{title}</span>
|
<span className="pr-2">{title}</span>
|
||||||
<Icon
|
<Icon
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import IconComponent from "../../components/genericIconComponent";
|
||||||
import Header from "../../components/headerComponent";
|
import Header from "../../components/headerComponent";
|
||||||
import LoadingComponent from "../../components/loadingComponent";
|
import LoadingComponent from "../../components/loadingComponent";
|
||||||
import { Button } from "../../components/ui/button";
|
import { Button } from "../../components/ui/button";
|
||||||
import { Checkbox } from "../../components/ui/checkbox";
|
import { CheckBoxDiv } from "../../components/ui/checkbox";
|
||||||
import { Input } from "../../components/ui/input";
|
import { Input } from "../../components/ui/input";
|
||||||
import {
|
import {
|
||||||
Table,
|
Table,
|
||||||
|
|
@ -308,6 +308,7 @@ export default function AdminPage() {
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="relative left-1 truncate py-2 text-align-last-left">
|
<TableCell className="relative left-1 truncate py-2 text-align-last-left">
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
|
size="x-small"
|
||||||
title="Edit"
|
title="Edit"
|
||||||
titleHeader={`${user.username}`}
|
titleHeader={`${user.username}`}
|
||||||
modalContentTitle="Attention!"
|
modalContentTitle="Attention!"
|
||||||
|
|
@ -330,10 +331,9 @@ export default function AdminPage() {
|
||||||
you are making to this user?
|
you are making to this user?
|
||||||
</span>
|
</span>
|
||||||
</ConfirmationModal.Content>
|
</ConfirmationModal.Content>
|
||||||
<ConfirmationModal.Trigger asChild>
|
<ConfirmationModal.Trigger>
|
||||||
<div className="flex w-fit">
|
<div className="flex w-fit">
|
||||||
<Checkbox
|
<CheckBoxDiv
|
||||||
id="is_active"
|
|
||||||
checked={user.is_active}
|
checked={user.is_active}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -342,6 +342,7 @@ export default function AdminPage() {
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="relative left-1 truncate py-2 text-align-last-left">
|
<TableCell className="relative left-1 truncate py-2 text-align-last-left">
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
|
size="x-small"
|
||||||
title="Edit"
|
title="Edit"
|
||||||
titleHeader={`${user.username}`}
|
titleHeader={`${user.username}`}
|
||||||
modalContentTitle="Attention!"
|
modalContentTitle="Attention!"
|
||||||
|
|
@ -364,10 +365,9 @@ export default function AdminPage() {
|
||||||
you are making to this user?
|
you are making to this user?
|
||||||
</span>
|
</span>
|
||||||
</ConfirmationModal.Content>
|
</ConfirmationModal.Content>
|
||||||
<ConfirmationModal.Trigger asChild>
|
<ConfirmationModal.Trigger>
|
||||||
<div className="flex w-fit">
|
<div className="flex w-fit">
|
||||||
<Checkbox
|
<CheckBoxDiv
|
||||||
id="is_superuser"
|
|
||||||
checked={user.is_superuser}
|
checked={user.is_superuser}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -411,6 +411,7 @@ export default function AdminPage() {
|
||||||
</UserManagementModal>
|
</UserManagementModal>
|
||||||
|
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
|
size="x-small"
|
||||||
title="Delete"
|
title="Delete"
|
||||||
titleHeader="Delete User"
|
titleHeader="Delete User"
|
||||||
modalContentTitle="Attention!"
|
modalContentTitle="Attention!"
|
||||||
|
|
@ -429,7 +430,7 @@ export default function AdminPage() {
|
||||||
This action cannot be undone.
|
This action cannot be undone.
|
||||||
</span>
|
</span>
|
||||||
</ConfirmationModal.Content>
|
</ConfirmationModal.Content>
|
||||||
<ConfirmationModal.Trigger tooltipContent="Delete">
|
<ConfirmationModal.Trigger>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Trash2"
|
name="Trash2"
|
||||||
className="ml-2 h-4 w-4 cursor-pointer"
|
className="ml-2 h-4 w-4 cursor-pointer"
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,6 @@ export type TriggerProps = {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
tooltipContent?: ReactNode;
|
tooltipContent?: ReactNode;
|
||||||
side?: "top" | "right" | "bottom" | "left";
|
side?: "top" | "right" | "bottom" | "left";
|
||||||
asChild?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface languageMap {
|
export interface languageMap {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue