diff --git a/apps/storybook/.storybook/i18next.js b/apps/storybook/.storybook/i18next.js index ca49d8044e..d3f384b323 100644 --- a/apps/storybook/.storybook/i18next.js +++ b/apps/storybook/.storybook/i18next.js @@ -1,9 +1,29 @@ import i18n from "i18next"; import { initReactI18next } from "react-i18next"; +const ns = ["common"]; +const supportedLngs = ["en", "fr"]; +const resources = ns.reduce((acc, n) => { + supportedLngs.forEach((lng) => { + if (!acc[lng]) acc[lng] = {}; + acc[lng] = { + ...acc[lng], + [n]: require(`../../web/public/static/locales/${lng}/${n}.json`), + }; + }); + return acc; +}, {}); + i18n.use(initReactI18next).init({ - resources: [], debug: true, + fallbackLng: "en", + defaultNS: "common", + ns, + interpolation: { + escapeValue: false, + }, + react: { useSuspense: true }, + resources, }); export default i18n; diff --git a/apps/storybook/.storybook/preview.jsx b/apps/storybook/.storybook/preview.jsx index 54057e8c3d..d881ca6008 100644 --- a/apps/storybook/.storybook/preview.jsx +++ b/apps/storybook/.storybook/preview.jsx @@ -21,6 +21,14 @@ export const parameters = { push() {}, Provider: AppRouterContext.Provider, }, + globals: { + locale: "en", + locales: { + en: "English", + fr: "Français", + }, + }, + i18n, }; addDecorator((storyFn) => ( diff --git a/packages/ui/components/unpublished-entity/unpublishedEntity.stories.mdx b/packages/ui/components/unpublished-entity/unpublishedEntity.stories.mdx new file mode 100644 index 0000000000..0c78b8defb --- /dev/null +++ b/packages/ui/components/unpublished-entity/unpublishedEntity.stories.mdx @@ -0,0 +1,37 @@ +import { Canvas, Meta, Story } from "@storybook/addon-docs"; + +import { Title, CustomArgsTable, VariantsTable, VariantRow } from "@calcom/storybook/components"; + +import { UnpublishedEntity } from "./UnpublishedEntity"; + + + + + +## Definition + +The `UnpublishedEntity` component is used to display an "empty screen" with relevant information for unpublished teams or organizations. + +## Structure + +The `UnpublishedEntity` component consists of the following parts: + +- An `EmptyScreen` component from `@calcom/ui` that displays a visual representation of an "empty screen." +- An `Avatar` component from `@calcom/ui` that shows an avatar image associated with the organization or team. +- Translated text obtained using the `useLocale` hook for displaying messages based on the entity's status. + +<CustomArgsTable of={UnpublishedEntity} /> + +## UnpublishedEntity Story + +<Canvas> + <Story name="UnpublishedEntity" args={{ name: "TeamExample", teamSlug: "team-example" }}> + {(args) => ( + <VariantsTable titles={["Default"]} columnMinWidth={150}> + <VariantRow> + <UnpublishedEntity {...args} /> + </VariantRow> + </VariantsTable> + )} + </Story> +</Canvas>