* Icon and IconName * Button and ButtonGroup * UserAvatar * AvatarGroup * Avatar * WizardLayout * Dialogs * EmptyScreen * showToast and TextField * Editor * Skeleton * Skeleton * TopBanner and showToast * Button again * more * perf: Remove app-store reference from @calcom/ui * more * Fixing types * Icon * Fixed casing * dropdown * more * Select * more * Badge * List * more * Divider * more * fix * fix type check * refactor * fix * fix * fix * fix * fix * fix * fix * fix type check * fix * fix * fix * fix * more * more * more * more * add index file to components/command * fix * fix * fix * fix imports * fix * fix * fix * fix * fix * fix * fix * fix build errors * fix build errors * fix --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com>
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { Button } from "@calcom/ui/components/button";
|
|
import { SheetClose } from "@calcom/ui/components/sheet";
|
|
|
|
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"
|
|
onClick={() => {
|
|
setEditMode(false);
|
|
}}>
|
|
{t("cancel")}
|
|
</Button>
|
|
|
|
<Button type="submit" loading={isPending} className="justify-center">
|
|
{t("update")}
|
|
</Button>
|
|
</>
|
|
);
|
|
}
|
|
|
|
function MoreInfoFooter() {
|
|
const { t } = useLocale();
|
|
const setEditMode = useEditMode((state) => state.setEditMode);
|
|
|
|
return (
|
|
<>
|
|
<SheetClose asChild>
|
|
<Button color="secondary" type="button" className="justify-center">
|
|
{t("close")}
|
|
</Button>
|
|
</SheetClose>
|
|
<Button
|
|
type="button"
|
|
className="justify-center"
|
|
onClick={() => {
|
|
setEditMode(true);
|
|
}}
|
|
key="EDIT_BUTTON"
|
|
StartIcon="pencil">
|
|
{t("edit")}
|
|
</Button>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export function SheetFooterControls() {
|
|
const editMode = useEditMode((state) => state.editMode);
|
|
return <>{editMode ? <EditModeFooter /> : <MoreInfoFooter />}</>;
|
|
}
|