Event Type: Title not displayed in the mobile view (#7451)
* Event Type: Title not displayed in the mobile view * Fix toggle not updating in UI --------- Co-authored-by: gitstart-calcom <[email protected]> Co-authored-by: Hariom Balhara <[email protected]>
This commit is contained in:
23 files changed
+135
-39
No files matched your search
@@ -352,13 +352,21 @@ type FormActionProps<T> = {
|
||||
action: FormActionType;
|
||||
children?: React.ReactNode;
|
||||
render?: (props: { routingForm: RoutingForm | null; className?: string; label?: string }) => JSX.Element;
|
||||
extraClassNames?: string;
|
||||
} & ButtonProps;
|
||||
|
||||
export const FormAction = forwardRef(function FormAction<T extends typeof Button>(
|
||||
props: FormActionProps<T>,
|
||||
forwardedRef: React.ForwardedRef<HTMLAnchorElement | HTMLButtonElement>
|
||||
) {
|
||||
const { action: actionName, routingForm, children, as: asFromElement, ...additionalProps } = props;
|
||||
const {
|
||||
action: actionName,
|
||||
routingForm,
|
||||
children,
|
||||
as: asFromElement,
|
||||
extraClassNames,
|
||||
...additionalProps
|
||||
} = props;
|
||||
const { appUrl, _delete, toggle } = useContext(actionsCtx);
|
||||
const dropdownCtxValue = useContext(dropdownCtx);
|
||||
const dropdown = dropdownCtxValue?.dropdown;
|
||||
@@ -419,11 +427,17 @@ export const FormAction = forwardRef(function FormAction<T extends typeof Button
|
||||
return <></>;
|
||||
}
|
||||
return (
|
||||
<div {...restProps} className="hover:bg-emphasis self-center rounded-md p-2">
|
||||
<div
|
||||
{...restProps}
|
||||
className={classNames(
|
||||
"sm:hover:bg-subtle self-center rounded-md p-2 hover:bg-gray-200",
|
||||
extraClassNames
|
||||
)}>
|
||||
<Switch
|
||||
checked={!routingForm.disabled}
|
||||
label={label}
|
||||
onCheckedChange={(checked) => toggle.onAction({ routingForm, checked })}
|
||||
labelOnLeading
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -66,8 +66,10 @@ const Actions = ({
|
||||
|
||||
return (
|
||||
<div className="flex items-center">
|
||||
<FormAction className="self-center" data-testid="toggle-form" action="toggle" routingForm={form} />
|
||||
<VerticalDivider />
|
||||
<div className="hidden items-center sm:inline-flex">
|
||||
<FormAction className="self-center" data-testid="toggle-form" action="toggle" routingForm={form} />
|
||||
<VerticalDivider />
|
||||
</div>
|
||||
<ButtonGroup combined containerProps={{ className: "hidden md:inline-flex items-center" }}>
|
||||
<Tooltip content={t("preview")}>
|
||||
<FormAction
|
||||
@@ -186,7 +188,7 @@ const Actions = ({
|
||||
{t("Copy Typeform Redirect Url")}
|
||||
</FormAction>
|
||||
) : null}
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuSeparator className="hidden sm:block" />
|
||||
<FormAction
|
||||
action="_delete"
|
||||
routingForm={form}
|
||||
@@ -196,6 +198,16 @@ const Actions = ({
|
||||
StartIcon={Trash}>
|
||||
{t("delete")}
|
||||
</FormAction>
|
||||
<div className="block sm:hidden">
|
||||
<DropdownMenuSeparator />
|
||||
<FormAction
|
||||
data-testid="toggle-form"
|
||||
action="toggle"
|
||||
routingForm={form}
|
||||
label="Disable Form"
|
||||
extraClassNames="hover:bg-subtle cursor-pointer rounded-[5px] pr-4"
|
||||
/>
|
||||
</div>
|
||||
</FormActionsDropdown>
|
||||
</div>
|
||||
<VerticalDivider />
|
||||
@@ -272,8 +284,8 @@ function SingleForm({ form, appUrl, Page }: SingleFormComponentProps) {
|
||||
subtitle={form.description || ""}
|
||||
backPath={`/${appUrl}/forms`}
|
||||
CTA={<Actions form={form} mutation={mutation} />}>
|
||||
<div className="-mx-4 px-4 sm:px-6 md:-mx-8 md:px-8">
|
||||
<div className="flex flex-col items-center md:flex-row md:items-start">
|
||||
<div className="-mx-4 mt-4 px-4 sm:px-6 md:-mx-8 md:mt-0 md:px-8">
|
||||
<div className="flex flex-col items-center items-baseline md:flex-row md:items-start">
|
||||
<div className="lg:min-w-72 lg:max-w-72 mb-6 md:mr-6">
|
||||
<TextField
|
||||
type="text"
|
||||
|
||||
@@ -253,7 +253,11 @@ export default function RoutingForms({
|
||||
}
|
||||
|
||||
RoutingForms.getLayout = (page: React.ReactElement) => {
|
||||
return <Shell withoutMain={true}>{page}</Shell>;
|
||||
return (
|
||||
<Shell withoutMain={true} hideHeadingOnMobile>
|
||||
{page}
|
||||
</Shell>
|
||||
);
|
||||
};
|
||||
|
||||
export const getServerSideProps = async function getServerSideProps(
|
||||
|
||||
@@ -34,7 +34,7 @@ export default function BookingLayout({
|
||||
...rest
|
||||
}: { children: React.ReactNode } & ComponentProps<typeof Shell>) {
|
||||
return (
|
||||
<Shell {...rest}>
|
||||
<Shell {...rest} hideHeadingOnMobile>
|
||||
<div className="flex max-w-6xl flex-col">
|
||||
<div className="flex flex-col lg:flex-row">
|
||||
<HorizontalTabs tabs={tabs} />
|
||||
|
||||
@@ -105,7 +105,7 @@ export default function TeamListItem(props: Props) {
|
||||
alt="Team Logo"
|
||||
className="inline-flex justify-center"
|
||||
/>
|
||||
<div className="ms-3 inline-block">
|
||||
<div className="ms-3 inline-block truncate">
|
||||
<span className="text-default text-sm font-bold">{team.name}</span>
|
||||
<span className="text-muted block text-xs">
|
||||
{team.slug ? `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/${team.slug}` : "Unpublished team"}
|
||||
|
||||
@@ -95,6 +95,7 @@ function WorkflowsPage() {
|
||||
heading={t("workflows")}
|
||||
title={t("workflows")}
|
||||
subtitle={t("workflows_to_automate_notifications")}
|
||||
hideHeadingOnMobile
|
||||
CTA={
|
||||
query?.data?.profiles.length === 1 &&
|
||||
session.data?.hasValidLicense &&
|
||||
|
||||
@@ -263,6 +263,7 @@ function WorkflowPage() {
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
hideHeadingOnMobile
|
||||
heading={
|
||||
session.data?.hasValidLicense &&
|
||||
isAllDataLoaded && (
|
||||
|
||||
@@ -393,6 +393,7 @@ export default function SettingsLayout({
|
||||
<Shell
|
||||
withoutSeo={true}
|
||||
flexChildrenContainer
|
||||
hideHeadingOnMobile
|
||||
{...rest}
|
||||
SidebarContainer={
|
||||
<>
|
||||
|
||||
@@ -196,6 +196,7 @@ type LayoutProps = {
|
||||
// Gives the ability to include actions to the right of the heading
|
||||
actions?: JSX.Element;
|
||||
smallHeading?: boolean;
|
||||
hideHeadingOnMobile?: boolean;
|
||||
};
|
||||
|
||||
const useBrandColors = () => {
|
||||
@@ -796,8 +797,9 @@ export function ShellMain(props: LayoutProps) {
|
||||
<>
|
||||
<div
|
||||
className={classNames(
|
||||
"flex items-center md:mt-0 md:mb-6",
|
||||
props.smallHeading ? "lg:mb-7" : "lg:mb-8"
|
||||
"flex items-center md:mb-6 md:mt-0",
|
||||
props.smallHeading ? "lg:mb-7" : "lg:mb-8",
|
||||
props.hideHeadingOnMobile ? "mb-0" : "mb-6"
|
||||
)}>
|
||||
{!!props.backPath && (
|
||||
<Button
|
||||
@@ -813,14 +815,16 @@ export function ShellMain(props: LayoutProps) {
|
||||
/>
|
||||
)}
|
||||
{props.heading && (
|
||||
<header className={classNames(props.large && "py-8", "flex w-full max-w-full items-center")}>
|
||||
<header
|
||||
className={classNames(props.large && "py-8", "flex w-full max-w-full items-center truncate")}>
|
||||
{props.HeadingLeftIcon && <div className="ltr:mr-4">{props.HeadingLeftIcon}</div>}
|
||||
<div className={classNames("w-full ltr:mr-4 rtl:ml-4 md:block", props.headerClassName)}>
|
||||
<div className={classNames("w-full truncate ltr:mr-4 rtl:ml-4 md:block", props.headerClassName)}>
|
||||
{props.heading && (
|
||||
<h3
|
||||
className={classNames(
|
||||
"font-cal max-w-28 sm:max-w-72 md:max-w-80 text-emphasis hidden truncate text-xl font-semibold tracking-wide md:block xl:max-w-full",
|
||||
props.smallHeading ? "text-base" : "text-xl"
|
||||
"font-cal max-w-28 sm:max-w-72 md:max-w-80 text-emphasis inline truncate text-lg font-semibold tracking-wide sm:text-xl md:block xl:max-w-full",
|
||||
props.smallHeading ? "text-base" : "text-xl",
|
||||
props.hideHeadingOnMobile && "hidden"
|
||||
)}>
|
||||
{!isLocaleReady ? <SkeletonText invisible /> : props.heading}
|
||||
</h3>
|
||||
|
||||
@@ -19,13 +19,14 @@ const Switch = (
|
||||
fitToHeight?: boolean;
|
||||
disabled?: boolean;
|
||||
tooltip?: string;
|
||||
labelOnLeading?: boolean;
|
||||
classNames?: {
|
||||
container?: string;
|
||||
thumb?: string;
|
||||
};
|
||||
}
|
||||
) => {
|
||||
const { label, fitToHeight, classNames, ...primitiveProps } = props;
|
||||
const { label, fitToHeight, classNames, labelOnLeading, ...primitiveProps } = props;
|
||||
const id = useId();
|
||||
const isChecked = props.checked || props.defaultChecked;
|
||||
return (
|
||||
@@ -34,6 +35,7 @@ const Switch = (
|
||||
className={cx(
|
||||
"flex h-auto w-auto flex-row items-center",
|
||||
fitToHeight && "h-fit",
|
||||
labelOnLeading && "flex-row-reverse",
|
||||
classNames?.container
|
||||
)}>
|
||||
<PrimitiveSwitch.Root
|
||||
@@ -58,7 +60,8 @@ const Switch = (
|
||||
htmlFor={id}
|
||||
className={cx(
|
||||
"text-emphasis ms-2 align-text-top text-sm font-medium",
|
||||
primitiveProps.disabled ? "cursor-not-allowed opacity-25" : "cursor-pointer "
|
||||
primitiveProps.disabled ? "cursor-not-allowed opacity-25" : "cursor-pointer",
|
||||
labelOnLeading && "flex-1"
|
||||
)}>
|
||||
{label}
|
||||
</Label.Root>
|
||||
|
||||
Reference in new issue
Block a user