diff --git a/apps/dashboard/next.config.mjs b/apps/dashboard/next.config.mjs index 805ce03863..6d7209381b 100644 --- a/apps/dashboard/next.config.mjs +++ b/apps/dashboard/next.config.mjs @@ -3,9 +3,6 @@ import "./src/env.mjs"; /** @type {import("next").NextConfig} */ const config = { reactStrictMode: true, - experimental: { - ppr: true, - }, images: { remotePatterns: [ { diff --git a/apps/dashboard/package.json b/apps/dashboard/package.json index c2136a5096..cd9b1e08a7 100644 --- a/apps/dashboard/package.json +++ b/apps/dashboard/package.json @@ -30,7 +30,7 @@ "fast-csv": "^4.3.6", "framer-motion": "^10.16.16", "ms": "^2.1.3", - "next": "14.0.5-canary.17", + "next": "14.0.4", "next-international": "^1.1.4", "next-safe-action": "^5.2.3", "next-themes": "^0.2.1", diff --git a/apps/dashboard/src/app/[locale]/page.tsx b/apps/dashboard/src/app/[locale]/page.tsx new file mode 100644 index 0000000000..155c71d51c --- /dev/null +++ b/apps/dashboard/src/app/[locale]/page.tsx @@ -0,0 +1,63 @@ +import { Chart } from "@/components/charts/chart"; +import { ChartSelectors } from "@/components/charts/chart-selectors"; +import { Spending } from "@/components/charts/spending"; +import { Transactions } from "@/components/charts/transactions"; +import { OverviewModal } from "@/components/modals/overview-modal"; +import { Cookies } from "@/utils/constants"; +import { + getBankConnectionsByTeamId, + getUser, +} from "@midday/supabase/cached-queries"; +import { cn } from "@midday/ui/utils"; +import { startOfMonth, startOfYear } from "date-fns"; +import { Metadata } from "next"; +import { cookies } from "next/headers"; +import { Suspense } from "react"; + +export const metadata: Metadata = { + title: "Overview | Midday", +}; + +const defaultValue = { + from: startOfYear(startOfMonth(new Date())).toISOString(), + to: new Date().toISOString(), + period: "monthly", +}; + +export default async function Overview({ searchParams }) { + const { data: userData } = await getUser(); + const { data } = await getBankConnectionsByTeamId(); + const chartPeriod = cookies().has(Cookies.ChartPeriod) + ? JSON.parse(cookies().get(Cookies.ChartPeriod)?.value) + : {}; + + const value = { + ...chartPeriod, + ...(searchParams.from && { from: searchParams.from }), + ...(searchParams.to && { to: searchParams.to }), + period: searchParams.period, + }; + + const isOpen = Boolean(searchParams.step); + const empty = !data?.length && !isOpen; + + return ( + <> +
+
+ + + + + +
+ +
+ + +
+
+ {!isOpen && empty && } + + ); +} diff --git a/apps/dashboard/src/app/[locale]/providers.tsx b/apps/dashboard/src/app/[locale]/providers.tsx index da6a3e0f2a..30bfbd6140 100644 --- a/apps/dashboard/src/app/[locale]/providers.tsx +++ b/apps/dashboard/src/app/[locale]/providers.tsx @@ -1,5 +1,6 @@ "use client"; +import { ThemeProvider } from "@/components/theme-provider"; import { I18nProviderClient } from "@/locales/client"; import { TriggerProvider } from "@trigger.dev/react"; import { ReactNode } from "react"; @@ -16,7 +17,14 @@ export function Providers({ locale, children }: ProviderProps) { publicApiKey={process.env.NEXT_PUBLIC_TRIGGER_API_KEY!} apiUrl={process.env.NEXT_PUBLIC_TRIGGER_API_URL} > - {children} + + {children} + ); diff --git a/apps/dashboard/src/app/layout.tsx b/apps/dashboard/src/app/layout.tsx index dd2d359dbf..b0b5245e3e 100644 --- a/apps/dashboard/src/app/layout.tsx +++ b/apps/dashboard/src/app/layout.tsx @@ -1,4 +1,3 @@ -import { ThemeProvider } from "@/components/theme-provider"; import "@/styles/globals.css"; import "@midday/ui/globals.css"; import { Toaster } from "@midday/ui/toaster"; @@ -39,16 +38,9 @@ export default function Layout({ return ( - - {children} - - - + {children} + + ); diff --git a/apps/website/next.config.mjs b/apps/website/next.config.mjs index f147a72288..0ccc615a51 100644 --- a/apps/website/next.config.mjs +++ b/apps/website/next.config.mjs @@ -2,9 +2,6 @@ const config = { reactStrictMode: true, transpilePackages: ["@midday/ui", "@midday/tailwind"], - experimental: { - ppr: true, - }, eslint: { ignoreDuringBuilds: true, }, diff --git a/apps/website/package.json b/apps/website/package.json index 4b92af0931..6bbca93d90 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -15,7 +15,7 @@ "@midday/location": "workspace:*", "@midday/ui": "workspace:*", "@vercel/analytics": "^1.1.1", - "next": "14.0.5-canary.17", + "next": "14.0.4", "next-international": "^1.1.4", "next-themes": "^0.2.1", "react": "18.2.0", diff --git a/apps/website/src/app/[locale]/provider.tsx b/apps/website/src/app/[locale]/provider.tsx index 58f1891709..26d95271bb 100644 --- a/apps/website/src/app/[locale]/provider.tsx +++ b/apps/website/src/app/[locale]/provider.tsx @@ -1,5 +1,6 @@ "use client"; +import { ThemeProvider } from "@/components/theme-provider"; import { I18nProviderClient } from "@/locales/client"; import { ReactNode } from "react"; @@ -9,5 +10,16 @@ type ProviderProps = { }; export function Provider({ locale, children }: ProviderProps) { - return {children}; + return ( + + + {children} + + + ); } diff --git a/apps/website/src/app/layout.tsx b/apps/website/src/app/layout.tsx index 9d30b2c0c4..28bf6353c6 100644 --- a/apps/website/src/app/layout.tsx +++ b/apps/website/src/app/layout.tsx @@ -1,4 +1,3 @@ -import { ThemeProvider } from "@/components/theme-provider"; import "@/styles/globals.css"; import "@midday/ui/globals.css"; import { cn } from "@midday/ui/utils"; @@ -38,14 +37,7 @@ export default function Layout({ return ( - - {children} - + {children} diff --git a/bun.lockb b/bun.lockb index 63d53870e6..169d35578c 100755 Binary files a/bun.lockb and b/bun.lockb differ