+1








30ba168fc3
Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Omar López <zomars@me.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Benny Joo <sldisek783@gmail.com> Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: Gergő Móricz <mo.geryy@gmail.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com>
61 lines
1.5 KiB
TypeScript
61 lines
1.5 KiB
TypeScript
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { SheetClose, Button } from "@calcom/ui";
|
|
import { Pencil } from "@calcom/ui/components/icon";
|
|
|
|
import { useEditMode } from "./store";
|
|
|
|
function EditModeFooter() {
|
|
const { t } = useLocale();
|
|
const setEditMode = useEditMode((state) => state.setEditMode);
|
|
const isPending = useEditMode((state) => state.mutationLoading);
|
|
|
|
return (
|
|
<>
|
|
<Button
|
|
color="secondary"
|
|
type="button"
|
|
className="justify-center md:w-1/5"
|
|
onClick={() => {
|
|
setEditMode(false);
|
|
}}>
|
|
{t("cancel")}
|
|
</Button>
|
|
|
|
<Button type="submit" className="w-full justify-center" form="edit-user-form" loading={isPending}>
|
|
{t("update")}
|
|
</Button>
|
|
</>
|
|
);
|
|
}
|
|
|
|
function MoreInfoFooter() {
|
|
const { t } = useLocale();
|
|
const setEditMode = useEditMode((state) => state.setEditMode);
|
|
|
|
return (
|
|
<>
|
|
<SheetClose asChild>
|
|
<Button color="secondary" type="button" className="w-full justify-center lg:w-1/5">
|
|
{t("close")}
|
|
</Button>
|
|
</SheetClose>
|
|
<Button
|
|
type="button"
|
|
onClick={() => {
|
|
setEditMode(true);
|
|
}}
|
|
className="w-full justify-center gap-2"
|
|
variant="icon"
|
|
key="EDIT_BUTTON"
|
|
StartIcon={Pencil}>
|
|
{t("edit")}
|
|
</Button>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export function SheetFooterControls() {
|
|
const editMode = useEditMode((state) => state.editMode);
|
|
return <>{editMode ? <EditModeFooter /> : <MoreInfoFooter />}</>;
|
|
}
|