Minor bug fixes to clean console

This commit is contained in:
Lucas Oliveira 2023-09-11 16:05:25 -03:00
commit 268906fe49
7 changed files with 39 additions and 29 deletions

View file

@ -33,11 +33,9 @@ const ApiModal = forwardRef(
{ {
flow, flow,
children, children,
disable,
}: { }: {
flow: FlowType; flow: FlowType;
children: ReactNode; children: ReactNode;
disable: boolean;
}, },
ref ref
) => { ) => {
@ -202,7 +200,7 @@ const ApiModal = forwardRef(
return ( return (
<BaseModal open={open} setOpen={setOpen}> <BaseModal open={open} setOpen={setOpen}>
<BaseModal.Trigger disable={disable}>{children}</BaseModal.Trigger> <BaseModal.Trigger asChild>{children}</BaseModal.Trigger>
<BaseModal.Header description={EXPORT_CODE_DIALOG}> <BaseModal.Header description={EXPORT_CODE_DIALOG}>
<span className="pr-2">Code</span> <span className="pr-2">Code</span>
<IconComponent <IconComponent

View file

@ -6,6 +6,7 @@ import BaseModal from "../baseModal";
export default function ConfirmationModal({ export default function ConfirmationModal({
title, title,
asChild,
titleHeader, titleHeader,
modalContent, modalContent,
modalContentTitle, modalContentTitle,
@ -22,7 +23,7 @@ export default function ConfirmationModal({
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
return ( return (
<BaseModal size="x-small" open={open} setOpen={setOpen}> <BaseModal size="x-small" open={open} setOpen={setOpen}>
<BaseModal.Trigger>{children}</BaseModal.Trigger> <BaseModal.Trigger asChild={asChild}>{children}</BaseModal.Trigger>
<BaseModal.Header description={titleHeader}> <BaseModal.Header description={titleHeader}>
<span className="pr-2">{title}</span> <span className="pr-2">{title}</span>
<Icon <Icon

View file

@ -26,7 +26,7 @@ const Content: React.FC<ContentProps> = ({ children }) => {
const Trigger: React.FC<TriggerProps> = ({ children, asChild, disable }) => { const Trigger: React.FC<TriggerProps> = ({ children, asChild, disable }) => {
return ( return (
<DialogTrigger <DialogTrigger
className={"w-full " + (disable ? "button-disable" : "")} className={asChild ? "" : "w-full"}
hidden={children ? false : true} hidden={children ? false : true}
asChild={asChild} asChild={asChild}
> >

View file

@ -301,8 +301,9 @@ export default function AdminPage() {
</span> </span>
</ShadTooltip> </ShadTooltip>
</TableCell> </TableCell>
<TableCell className="relative left-5 truncate py-2 text-align-last-left"> <TableCell className="relative left-1 truncate py-2 text-align-last-left">
<ConfirmationModal <ConfirmationModal
asChild
title="Edit" title="Edit"
titleHeader={`${user.username}`} titleHeader={`${user.username}`}
modalContentTitle="Attention!" modalContentTitle="Attention!"
@ -320,14 +321,17 @@ export default function AdminPage() {
); );
}} }}
> >
<div className="flex w-fit">
<Checkbox <Checkbox
id="is_active" id="is_active"
checked={user.is_active} checked={user.is_active}
/> />
</div>
</ConfirmationModal> </ConfirmationModal>
</TableCell> </TableCell>
<TableCell className="relative left-5 truncate py-2 text-align-last-left"> <TableCell className="relative left-1 truncate py-2 text-align-last-left">
<ConfirmationModal <ConfirmationModal
asChild
title="Edit" title="Edit"
titleHeader={`${user.username}`} titleHeader={`${user.username}`}
modalContentTitle="Attention!" modalContentTitle="Attention!"
@ -345,10 +349,12 @@ export default function AdminPage() {
); );
}} }}
> >
<div className="flex w-fit">
<Checkbox <Checkbox
id="is_superuser" id="is_superuser"
checked={user.is_superuser} checked={user.is_superuser}
/> />
</div>
</ConfirmationModal> </ConfirmationModal>
</TableCell> </TableCell>
<TableCell className="truncate py-2 "> <TableCell className="truncate py-2 ">

View file

@ -99,8 +99,13 @@ export default function ExtraSidebar(): JSX.Element {
<ShadTooltip content={"Code"} side="top"> <ShadTooltip content={"Code"} side="top">
<div className="side-bar-button"> <div className="side-bar-button">
{flow && flow.data && ( {flow && flow.data && (
<ApiModal flow={flow} disable={!isBuilt}> <ApiModal flow={flow}>
<div className={classNames("extra-side-bar-buttons")}> <button className={!isBuilt ? "button-disable" : ""}>
<div
className={classNames(
"extra-side-bar-buttons"
)}
>
<IconComponent <IconComponent
name="Code2" name="Code2"
className={ className={
@ -109,6 +114,7 @@ export default function ExtraSidebar(): JSX.Element {
} }
/> />
</div> </div>
</button>
</ApiModal> </ApiModal>
)} )}
</div> </div>

View file

@ -48,6 +48,8 @@ export default function ProfileSettingsPage(): JSX.Element {
setUserData(newUserData); setUserData(newUserData);
} }
handleInput({ target: { name: "password", value: "" } });
handleInput({ target: { name: "cnfPassword", value: "" } });
setSuccessData({ title: "Changes saved successfully!" }); setSuccessData({ title: "Changes saved successfully!" });
} catch (error) { } catch (error) {
setErrorData({ title: "Error saving changes", list: [(error as any).response.data.detail] }); setErrorData({ title: "Error saving changes", list: [(error as any).response.data.detail] });
@ -90,8 +92,6 @@ export default function ProfileSettingsPage(): JSX.Element {
<Form.Label className="data-[invalid]:label-invalid"> <Form.Label className="data-[invalid]:label-invalid">
Password{" "} Password{" "}
</Form.Label> </Form.Label>
<Form.Control asChild>
<InputComponent <InputComponent
onChange={(value) => { onChange={(value) => {
handleInput({ target: { name: "password", value } }); handleInput({ target: { name: "password", value } });
@ -102,8 +102,6 @@ export default function ProfileSettingsPage(): JSX.Element {
placeholder="Password" placeholder="Password"
className="w-full" className="w-full"
/> />
</Form.Control>
<Form.Message match="valueMissing" className="field-invalid"> <Form.Message match="valueMissing" className="field-invalid">
Please enter your password Please enter your password
</Form.Message> </Form.Message>

View file

@ -233,6 +233,7 @@ export type PaginatorComponentType = {
export type ConfirmationModalType = { export type ConfirmationModalType = {
title: string; title: string;
titleHeader: string; titleHeader: string;
asChild?: boolean;
modalContent: string; modalContent: string;
modalContentTitle: string; modalContentTitle: string;
cancelText: string; cancelText: string;