From 6eadadec736e5d8f4f686959496447fd33607a2b Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Tue, 3 Dec 2024 15:32:56 -0500 Subject: [PATCH] fix: remove duplicate header in attributes page (#17985) --- .../attributes/[id]/edit/page.tsx | 17 +-- .../organizations/attributes/create/page.tsx | 17 +-- .../attributes/attributes-create-view.tsx | 4 +- .../attributes/attributes-edit-view.tsx | 4 +- .../attributes/attributes-list-view.tsx | 117 +++++++----------- 5 files changed, 54 insertions(+), 105 deletions(-) diff --git a/apps/web/app/settings/(settings-layout)/organizations/attributes/[id]/edit/page.tsx b/apps/web/app/settings/(settings-layout)/organizations/attributes/[id]/edit/page.tsx index 4e039d80c8..955d365d78 100644 --- a/apps/web/app/settings/(settings-layout)/organizations/attributes/[id]/edit/page.tsx +++ b/apps/web/app/settings/(settings-layout)/organizations/attributes/[id]/edit/page.tsx @@ -1,8 +1,6 @@ -import { _generateMetadata, getFixedT } from "app/_utils"; +import { _generateMetadata } from "app/_utils"; import OrgAttributesEditPage from "@calcom/ee/organizations/pages/settings/attributes/attributes-edit-view"; -import { getServerSessionForAppDir } from "@calcom/features/auth/lib/get-server-session-for-app-dir"; -import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader"; export const generateMetadata = async () => await _generateMetadata( @@ -10,15 +8,4 @@ export const generateMetadata = async () => (t) => t("edit_attribute_description") ); -const Page = async () => { - const session = await getServerSessionForAppDir(); - const t = await getFixedT(session?.user.locale || "en"); - - return ( - - - - ); -}; - -export default Page; +export default OrgAttributesEditPage; diff --git a/apps/web/app/settings/(settings-layout)/organizations/attributes/create/page.tsx b/apps/web/app/settings/(settings-layout)/organizations/attributes/create/page.tsx index f6dbec3f36..5a982ff92c 100644 --- a/apps/web/app/settings/(settings-layout)/organizations/attributes/create/page.tsx +++ b/apps/web/app/settings/(settings-layout)/organizations/attributes/create/page.tsx @@ -1,8 +1,6 @@ -import { _generateMetadata, getFixedT } from "app/_utils"; +import { _generateMetadata } from "app/_utils"; import OrgAttributesCreatePage from "@calcom/ee/organizations/pages/settings/attributes/attributes-create-view"; -import { getServerSessionForAppDir } from "@calcom/features/auth/lib/get-server-session-for-app-dir"; -import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader"; export const generateMetadata = async () => await _generateMetadata( @@ -10,15 +8,4 @@ export const generateMetadata = async () => (t) => t("create_attribute_description") ); -const Page = async () => { - const session = await getServerSessionForAppDir(); - const t = await getFixedT(session?.user.locale || "en"); - - return ( - - - - ); -}; - -export default Page; +export default OrgAttributesCreatePage; diff --git a/packages/features/ee/organizations/pages/settings/attributes/attributes-create-view.tsx b/packages/features/ee/organizations/pages/settings/attributes/attributes-create-view.tsx index 16f8518c95..3e361eeff4 100644 --- a/packages/features/ee/organizations/pages/settings/attributes/attributes-create-view.tsx +++ b/packages/features/ee/organizations/pages/settings/attributes/attributes-create-view.tsx @@ -1,7 +1,6 @@ "use client"; import { useRouter } from "next/navigation"; -import React from "react"; import { useFormContext } from "react-hook-form"; import { z } from "zod"; @@ -32,7 +31,6 @@ function CreateAttributesPage() { showToast(err.message, "error"); }, }); - const { t } = useLocale(); return ( <> @@ -73,7 +71,7 @@ function CreateAttributeHeader(props: { isPending: boolean }) { {t("back_to_attributes")}
-

{meta.title || "Attribute"}

+

{meta.title || t("attribute")}

{watchedTitle && ( <> / {watchedTitle} diff --git a/packages/features/ee/organizations/pages/settings/attributes/attributes-edit-view.tsx b/packages/features/ee/organizations/pages/settings/attributes/attributes-edit-view.tsx index 60a5daa9f4..64136c9c46 100644 --- a/packages/features/ee/organizations/pages/settings/attributes/attributes-edit-view.tsx +++ b/packages/features/ee/organizations/pages/settings/attributes/attributes-edit-view.tsx @@ -92,7 +92,7 @@ function EditAttributeHeader(props: { isPending: boolean }) { {t("back_to_attributes")}
-

{meta.title || "Attribute"}

+

{meta.title || t("attribute")}

{watchedTitle && ( <> / {watchedTitle} @@ -101,7 +101,7 @@ function EditAttributeHeader(props: { isPending: boolean }) {
diff --git a/packages/features/ee/organizations/pages/settings/attributes/attributes-list-view.tsx b/packages/features/ee/organizations/pages/settings/attributes/attributes-list-view.tsx index 408c9f9701..9a72871cb5 100644 --- a/packages/features/ee/organizations/pages/settings/attributes/attributes-list-view.tsx +++ b/packages/features/ee/organizations/pages/settings/attributes/attributes-list-view.tsx @@ -130,80 +130,57 @@ function OrganizationAttributesPage() { } return ( - <> - - -
- {data && data?.length > 0 ? ( - <> -

{t("custom")}

-
  • - {data?.map((attribute) => ( - - ))} -
  • - - - ) : ( -
    -
    - -
    -

    - {t("add_attributes")} -

    - -

    - {t("add_attributes_description")} -

    - + +
    + {data && data?.length > 0 ? ( + <> +

    {t("custom")}

    +
  • + {data?.map((attribute) => ( + + ))} +
  • + + + ) : ( +
    +
    +
    - )} -
    - {attributeToDelete && ( - - )} - - - ); -} +

    + {t("add_attributes")} +

    -function ListAttributeHeader() { - const { meta } = useMeta(); - const { t } = useLocale(); - - return ( - <> -
    -
    -
    -

    - {meta.title || t("attributes")} -

    -

    {meta.description || t("attribute_meta_description")}

    +

    + {t("add_attributes_description")} +

    +
    -
    + )}
    - + {attributeToDelete && ( + + )} + ); }