From 9baee90eec0ca8ed6f1d9890e5b105bed491e517 Mon Sep 17 00:00:00 2001 From: giancarlo Date: Wed, 1 May 2024 12:13:19 +0700 Subject: [PATCH] Update configuration settings and improve notifications This commit updates the configuration settings and improves the notification functionality by filtering out duplicate notifications. It also includes changes to feature flag data types and removed dependencies in `package.json`, alongside updates to `pnpm-lock.yaml`. --- apps/e2e/package.json | 6 - .../team-account-layout-sidebar.tsx | 9 +- .../team-account-navigation-menu.tsx | 4 +- apps/web/app/home/[account]/layout.tsx | 1 + apps/web/config/feature-flags.config.ts | 20 +- package.json | 6 + .../src/components/account-selector.tsx | 37 +- .../src/components/notifications-popover.tsx | 18 +- .../src/hooks/use-fetch-notifications.ts | 47 +- .../src/hooks/use-notifications-stream.ts | 51 + pnpm-lock.yaml | 13415 +++++++++------- 11 files changed, 7609 insertions(+), 6005 deletions(-) create mode 100644 packages/features/notifications/src/hooks/use-notifications-stream.ts diff --git a/apps/e2e/package.json b/apps/e2e/package.json index 4a05ba427..8716f9086 100644 --- a/apps/e2e/package.json +++ b/apps/e2e/package.json @@ -15,11 +15,5 @@ "@playwright/test": "^1.43.1", "@types/node": "^20.12.7", "node-html-parser": "^6.1.13" - }, - "dependencies": { - "@tanstack/react-table": "^8.16.0", - "next": "14.2.3", - "tailwind-merge": "^2.3.0", - "zod": "^3.23.5" } } diff --git a/apps/web/app/home/[account]/_components/team-account-layout-sidebar.tsx b/apps/web/app/home/[account]/_components/team-account-layout-sidebar.tsx index f7998ec34..c694a9899 100644 --- a/apps/web/app/home/[account]/_components/team-account-layout-sidebar.tsx +++ b/apps/web/app/home/[account]/_components/team-account-layout-sidebar.tsx @@ -29,6 +29,7 @@ type AccountModel = { export function TeamAccountLayoutSidebar(props: { account: string; + accountId: string; accounts: AccountModel[]; collapsed: boolean; user: User; @@ -40,6 +41,7 @@ export function TeamAccountLayoutSidebar(props: { collapsed={collapsed} setCollapsed={setCollapsed} account={props.account} + accountId={props.accountId} accounts={props.accounts} user={props.user} /> @@ -50,6 +52,7 @@ export function TeamAccountLayoutSidebar(props: { function SidebarContainer(props: { account: string; + accountId: string; accounts: AccountModel[]; collapsed: boolean; setCollapsed: (collapsed: boolean) => void; @@ -61,7 +64,9 @@ function SidebarContainer(props: { return ( <> -
+
diff --git a/apps/web/app/home/[account]/_components/team-account-navigation-menu.tsx b/apps/web/app/home/[account]/_components/team-account-navigation-menu.tsx index 3c53df1a0..feb320c4c 100644 --- a/apps/web/app/home/[account]/_components/team-account-navigation-menu.tsx +++ b/apps/web/app/home/[account]/_components/team-account-navigation-menu.tsx @@ -50,10 +50,10 @@ export function TeamAccountNavigationMenu(props: {
({ label: account.name, - value: account.id, + value: account.slug, image: account.picture_url, }))} /> diff --git a/apps/web/app/home/[account]/layout.tsx b/apps/web/app/home/[account]/layout.tsx index 55431c721..ce6213235 100644 --- a/apps/web/app/home/[account]/layout.tsx +++ b/apps/web/app/home/[account]/layout.tsx @@ -46,6 +46,7 @@ function TeamWorkspaceLayout({ diff --git a/apps/web/config/feature-flags.config.ts b/apps/web/config/feature-flags.config.ts index 31c6807e0..39d3a4415 100644 --- a/apps/web/config/feature-flags.config.ts +++ b/apps/web/config/feature-flags.config.ts @@ -42,18 +42,14 @@ const FeatureFlagsSchema = z.object({ description: `If set to user, use the user's preferred language. If set to application, use the application's default language.`, }) .default('application'), - enableNotifications: z - .boolean({ - description: 'Enable notifications functionality', - required_error: 'Provide the variable NEXT_PUBLIC_ENABLE_NOTIFICATIONS', - }) - .default(true), - realtimeNotifications: z - .boolean({ - description: 'Enable realtime for the notifications functionality', - required_error: 'Provide the variable NEXT_PUBLIC_REALTIME_NOTIFICATIONS', - }) - .default(true), + enableNotifications: z.boolean({ + description: 'Enable notifications functionality', + required_error: 'Provide the variable NEXT_PUBLIC_ENABLE_NOTIFICATIONS', + }), + realtimeNotifications: z.boolean({ + description: 'Enable realtime for the notifications functionality', + required_error: 'Provide the variable NEXT_PUBLIC_REALTIME_NOTIFICATIONS', + }), }); const featuresFlagConfig = FeatureFlagsSchema.parse({ diff --git a/package.json b/package.json index b0d3ad8c8..13072f02c 100644 --- a/package.json +++ b/package.json @@ -43,5 +43,11 @@ "turbo": "^1.13.3", "typescript": "^5.4.5", "yarn": "^1.22.22" + }, + "pnpm": { + "overrides": { + "react": "18.3.1", + "react-dom": "18.3.1" + } } } diff --git a/packages/features/accounts/src/components/account-selector.tsx b/packages/features/accounts/src/components/account-selector.tsx index 90ee76616..d57ad0a59 100644 --- a/packages/features/accounts/src/components/account-selector.tsx +++ b/packages/features/accounts/src/components/account-selector.tsx @@ -99,9 +99,9 @@ export function AccountSelector({ role="combobox" aria-expanded={open} className={cn( - 'dark:shadow-primary/10 group w-full min-w-0 max-w-full px-2', + 'dark:shadow-primary/10 group w-auto min-w-0 max-w-fit px-2', { - 'justify-between': !collapsed, + 'justify-start': !collapsed, 'justify-center': collapsed, }, )} @@ -124,14 +124,10 @@ export function AccountSelector({ > {(account) => ( - + - + {account.label ? account.label[0] : ''} @@ -147,7 +143,7 @@ export function AccountSelector({ )} - + @@ -188,7 +184,7 @@ export function AccountSelector({ data-name={account.label} data-slug={account.value} className={cn( - 'group flex justify-between transition-colors', + 'group my-1 flex justify-between transition-colors', { ['bg-muted']: value === account.value, }, @@ -205,19 +201,16 @@ export function AccountSelector({ }} >
- + - + {account.label ? account.label[0] : ''} @@ -241,7 +234,7 @@ export function AccountSelector({