From bf0b46849ee862c3080666818b2ece3d22a7927b Mon Sep 17 00:00:00 2001 From: Pontus Abrahamsson Date: Wed, 20 Dec 2023 11:47:58 +0100 Subject: [PATCH] Inbound --- .../app/[locale]/@dashboard/(root)/page.tsx | 3 -- .../src/components/charts/realtime.tsx | 41 ------------------- apps/dashboard/src/components/main-menu.tsx | 7 +++- .../src/components/notification-center.tsx | 3 +- apps/dashboard/src/styles/globals.css | 6 --- 5 files changed, 7 insertions(+), 53 deletions(-) delete mode 100644 apps/dashboard/src/components/charts/realtime.tsx diff --git a/apps/dashboard/src/app/[locale]/@dashboard/(root)/page.tsx b/apps/dashboard/src/app/[locale]/@dashboard/(root)/page.tsx index 1df92ebb93..155c71d51c 100644 --- a/apps/dashboard/src/app/[locale]/@dashboard/(root)/page.tsx +++ b/apps/dashboard/src/app/[locale]/@dashboard/(root)/page.tsx @@ -1,6 +1,5 @@ import { Chart } from "@/components/charts/chart"; import { ChartSelectors } from "@/components/charts/chart-selectors"; -import { Realtime } from "@/components/charts/realtime"; import { Spending } from "@/components/charts/spending"; import { Transactions } from "@/components/charts/transactions"; import { OverviewModal } from "@/components/modals/overview-modal"; @@ -57,8 +56,6 @@ export default async function Overview({ searchParams }) { - - {!isOpen && empty && } diff --git a/apps/dashboard/src/components/charts/realtime.tsx b/apps/dashboard/src/components/charts/realtime.tsx deleted file mode 100644 index 0d55e2c919..0000000000 --- a/apps/dashboard/src/components/charts/realtime.tsx +++ /dev/null @@ -1,41 +0,0 @@ -"use client"; - -import { invalidateCacheAction } from "@/actions/invalidate-cache-action"; -import { createClient } from "@midday/supabase/client"; -import { useRouter } from "next/navigation"; -import { useEffect } from "react"; - -export function Realtime({ teamId }) { - const supabase = createClient(); - const router = useRouter(); - - useEffect(() => { - const channel = supabase - .channel("realtime_transactions") - .on( - "postgres_changes", - { - event: "*", - schema: "public", - table: "transactions", - filter: `team_id=eq.${teamId}`, - }, - () => { - invalidateCacheAction([ - `transactions-${teamId}`, - `spending-${teamId}`, - `metrics-${teamId}`, - ]); - - router.refresh(); - } - ) - .subscribe(); - - return () => { - supabase.removeChannel(channel); - }; - }, [supabase, teamId]); - - return null; -} diff --git a/apps/dashboard/src/components/main-menu.tsx b/apps/dashboard/src/components/main-menu.tsx index 08788947da..7e2b90a5b0 100644 --- a/apps/dashboard/src/components/main-menu.tsx +++ b/apps/dashboard/src/components/main-menu.tsx @@ -18,7 +18,12 @@ export function MainMenu() { { path: "/inbound", name: "Inbound", - icon: () => , + icon: () => ( +
+
+ +
+ ), }, { path: "/transactions", diff --git a/apps/dashboard/src/components/notification-center.tsx b/apps/dashboard/src/components/notification-center.tsx index 77148713ff..7be57fc55d 100644 --- a/apps/dashboard/src/components/notification-center.tsx +++ b/apps/dashboard/src/components/notification-center.tsx @@ -8,7 +8,7 @@ import { ScrollArea } from "@midday/ui/scroll-area"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@midday/ui/tabs"; import { formatDistanceToNow } from "date-fns"; import Link from "next/link"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useState } from "react"; function EmptyState({ description }) { return ( @@ -65,7 +65,6 @@ function TransactionNotification({ } export function NotificationCenter() { - const hasSeen = useRef(false); const [isOpen, setOpen] = useState(false); const { hasUnseenNotificaitons, diff --git a/apps/dashboard/src/styles/globals.css b/apps/dashboard/src/styles/globals.css index 4a9bd312b9..1dd962b223 100644 --- a/apps/dashboard/src/styles/globals.css +++ b/apps/dashboard/src/styles/globals.css @@ -15,12 +15,6 @@ body { --sidebar-width: 662px; } -@media (min-width: 1280px) { - :root { - --sidebar-width: 827px; - } -} - .skeleton-box { background-color: hsl(var(--border)); color: hsl(var(--border)) !important;