From 42d007704577cda81ad749d1d36efdabc57ea5ee Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Wed, 23 Apr 2025 11:59:25 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Minor=20refactoring=20(#16?= =?UTF-8?q?83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/sidebar/app-sidebar.tsx | 29 ++------ .../app/[locale]/(space)/settings/layout.tsx | 14 ++-- .../settings/profile/profile-picture.tsx | 2 + apps/web/src/app/[locale]/new/page.tsx | 10 ++- .../src/components/poll/language-selector.tsx | 4 +- .../time-zone-picker/time-zone-select.tsx | 66 +++++++++---------- packages/languages/src/index.ts | 2 + 7 files changed, 54 insertions(+), 73 deletions(-) diff --git a/apps/web/src/app/[locale]/(space)/components/sidebar/app-sidebar.tsx b/apps/web/src/app/[locale]/(space)/components/sidebar/app-sidebar.tsx index c7b09b712..3dddf7a04 100644 --- a/apps/web/src/app/[locale]/(space)/components/sidebar/app-sidebar.tsx +++ b/apps/web/src/app/[locale]/(space)/components/sidebar/app-sidebar.tsx @@ -24,7 +24,6 @@ import { LogoLink } from "@/app/components/logo-link"; import { Trans } from "@/components/trans"; import { getUser } from "@/data/get-user"; import { FeedbackToggle } from "@/features/feedback/components/feedback-toggle"; -import { getTranslation } from "@/i18n/server"; import { UpgradeButton } from "../upgrade-button"; import { NavItem } from "./nav-item"; @@ -34,7 +33,6 @@ export async function AppSidebar({ ...props }: React.ComponentProps) { const user = await getUser(); - const { t } = await getTranslation(); return ( @@ -54,7 +52,9 @@ export async function AppSidebar({ - Create + + + @@ -62,35 +62,18 @@ export async function AppSidebar({ - {/* - - P - - Personal - */} - {t("home")} + - {t("polls")} + - {t("events")} + - {/* - - {t("teams", { defaultValue: "Teams" })} - - - - {t("settings", { defaultValue: "Settings" })} - */} - {/* */} - {/* */} - {/* */} diff --git a/apps/web/src/app/[locale]/(space)/settings/layout.tsx b/apps/web/src/app/[locale]/(space)/settings/layout.tsx index a8c2a1658..db6c56f2c 100644 --- a/apps/web/src/app/[locale]/(space)/settings/layout.tsx +++ b/apps/web/src/app/[locale]/(space)/settings/layout.tsx @@ -7,18 +7,16 @@ import { PageHeader, PageTitle, } from "@/app/components/page-layout"; -import { getTranslation } from "@/i18n/server"; +import { Trans } from "@/components/trans"; import { SignOutButton } from "./components/sign-out-button"; import { SettingsLayout } from "./settings-menu"; export default async function ProfileLayout({ children, - params, -}: React.PropsWithChildren<{ - params: { locale: string }; -}>) { - const { t } = await getTranslation(params.locale); +}: { + children?: React.ReactNode; +}) { return ( @@ -26,9 +24,7 @@ export default async function ProfileLayout({
- {t("settings", { - defaultValue: "Settings", - })} +
diff --git a/apps/web/src/app/[locale]/(space)/settings/profile/profile-picture.tsx b/apps/web/src/app/[locale]/(space)/settings/profile/profile-picture.tsx index cb26c8fde..052e62f4c 100644 --- a/apps/web/src/app/[locale]/(space)/settings/profile/profile-picture.tsx +++ b/apps/web/src/app/[locale]/(space)/settings/profile/profile-picture.tsx @@ -1,3 +1,5 @@ +"use client"; + import { usePostHog } from "@rallly/posthog/client"; import { Button } from "@rallly/ui/button"; import { useToast } from "@rallly/ui/hooks/use-toast"; diff --git a/apps/web/src/app/[locale]/new/page.tsx b/apps/web/src/app/[locale]/new/page.tsx index aa5d71ee4..969218544 100644 --- a/apps/web/src/app/[locale]/new/page.tsx +++ b/apps/web/src/app/[locale]/new/page.tsx @@ -1,18 +1,16 @@ import { Button } from "@rallly/ui/button"; import Link from "next/link"; -import { Trans } from "react-i18next/TransWithoutContext"; -import type { Params } from "@/app/[locale]/types"; import { PollPageIcon } from "@/app/components/page-icons"; import { CreatePoll } from "@/components/create-poll"; +import { Trans } from "@/components/trans"; import { UserDropdown } from "@/components/user-dropdown"; import { getTranslation } from "@/i18n/server"; import { getLoggedIn } from "@/next-auth"; import { BackButton } from "./back-button"; -export default async function Page({ params }: { params: Params }) { - const { t } = await getTranslation(params.locale); +export default async function Page() { const isLoggedIn = await getLoggedIn(); return ( @@ -27,7 +25,7 @@ export default async function Page({ params }: { params: Params }) {

- +

@@ -41,7 +39,7 @@ export default async function Page({ params }: { params: Params }) { - + diff --git a/apps/web/src/components/time-zone-picker/time-zone-select.tsx b/apps/web/src/components/time-zone-picker/time-zone-select.tsx index ebc41f417..d651ed27e 100644 --- a/apps/web/src/components/time-zone-picker/time-zone-select.tsx +++ b/apps/web/src/components/time-zone-picker/time-zone-select.tsx @@ -1,6 +1,7 @@ "use client"; import type { SelectProps } from "@radix-ui/react-select"; +import { cn } from "@rallly/ui"; import { Badge } from "@rallly/ui/badge"; import { Button } from "@rallly/ui/button"; import { @@ -15,7 +16,7 @@ import { import { useDialog } from "@rallly/ui/dialog"; import { Icon } from "@rallly/ui/icon"; import dayjs from "dayjs"; -import { CheckIcon, ChevronsUpDownIcon, GlobeIcon } from "lucide-react"; +import { CheckIcon, GlobeIcon } from "lucide-react"; import React from "react"; import { Trans } from "@/components/trans"; @@ -71,38 +72,37 @@ export const TimeZoneCommand = ({ onSelect, value }: TimeZoneCommandProps) => { ); }; -export const TimeZoneSelect = React.forwardRef( - ({ value, onValueChange, disabled }, ref) => { - const dialog = useDialog(); - return ( - <> - - { - onValueChange?.(newValue); - dialog.dismiss(); - }} - /> - - - - ); - }, -); + /> + + + + ); +}); TimeZoneSelect.displayName = "TimeZoneSelect"; diff --git a/packages/languages/src/index.ts b/packages/languages/src/index.ts index 008fa3405..0260c39f3 100644 --- a/packages/languages/src/index.ts +++ b/packages/languages/src/index.ts @@ -5,3 +5,5 @@ export const supportedLngs = Object.keys(languages); export const defaultLocale = "en"; export default languages; + +export { languages };