forked from Codehagen/Badget
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/196 csv import (Codehagen#249)
- Loading branch information
1 parent
cb83ab6
commit 8a5bac7
Showing
13 changed files
with
633 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,77 @@ | ||
import "@/styles/globals.css"; | ||
|
||
import { fontHeading, fontSans, fontUrban } from "@/assets/fonts"; | ||
import { ClerkProvider } from "@clerk/nextjs"; | ||
|
||
import { siteConfig } from "@/config/site"; | ||
import { cn } from "@/lib/utils"; | ||
import { Toaster } from "@/components/ui/toaster"; | ||
import { Analytics } from "@/components/analytics"; | ||
import { ClerkProvider } from "@clerk/nextjs"; | ||
import { Providers } from "@/components/providers"; | ||
import { TailwindIndicator } from "@/components/tailwind-indicator"; | ||
import { Toaster } from "@/components/ui/toaster"; | ||
import { cn } from "@/lib/utils"; | ||
import { siteConfig } from "@/config/site"; | ||
|
||
interface RootLayoutProps { | ||
children: React.ReactNode; | ||
children: React.ReactNode; | ||
} | ||
|
||
export const metadata = { | ||
title: { | ||
default: siteConfig.name, | ||
template: `%s | ${siteConfig.name}`, | ||
}, | ||
description: siteConfig.description, | ||
keywords: ["Badget keywords"], | ||
authors: [ | ||
{ | ||
name: "christer", | ||
}, | ||
], | ||
creator: "codehagen", | ||
metadataBase: new URL(siteConfig.url), | ||
openGraph: { | ||
type: "website", | ||
locale: "en_US", | ||
url: siteConfig.url, | ||
title: siteConfig.name, | ||
description: siteConfig.description, | ||
siteName: siteConfig.name, | ||
}, | ||
twitter: { | ||
card: "summary_large_image", | ||
title: siteConfig.name, | ||
description: siteConfig.description, | ||
images: [siteConfig.ogImage], | ||
creator: "@codehagen", | ||
}, | ||
icons: { | ||
icon: "/favicon.ico", | ||
shortcut: "/favicon-16x16.png", | ||
apple: "/apple-touch-icon.png", | ||
}, | ||
manifest: `${siteConfig.url}/site.webmanifest`, | ||
title: { | ||
default: siteConfig.name, | ||
template: `%s | ${siteConfig.name}`, | ||
}, | ||
description: siteConfig.description, | ||
keywords: ["badget", "open source", "tracker", "free", "budget", "finance"], | ||
authors: [ | ||
{ | ||
name: "christer", | ||
}, | ||
], | ||
creator: "codehagen", | ||
metadataBase: new URL(siteConfig.url), | ||
openGraph: { | ||
type: "website", | ||
locale: "en_US", | ||
url: siteConfig.url, | ||
title: siteConfig.name, | ||
description: siteConfig.description, | ||
siteName: siteConfig.name, | ||
}, | ||
twitter: { | ||
card: "summary_large_image", | ||
title: siteConfig.name, | ||
description: siteConfig.description, | ||
images: [siteConfig.ogImage], | ||
creator: "@codehagen", | ||
}, | ||
icons: { | ||
icon: "/favicon.ico", | ||
shortcut: "/favicon-16x16.png", | ||
apple: "/apple-touch-icon.png", | ||
}, | ||
manifest: `${siteConfig.url}/site.webmanifest`, | ||
}; | ||
|
||
export default function RootLayout({ children }: RootLayoutProps) { | ||
return ( | ||
<ClerkProvider> | ||
<html lang="en" suppressHydrationWarning> | ||
<head /> | ||
<body | ||
className={cn( | ||
"min-h-screen bg-background font-sans antialiased", | ||
fontSans.variable, | ||
fontUrban.variable, | ||
fontHeading.variable, | ||
)} | ||
> | ||
<Providers attribute="class" defaultTheme="system" enableSystem> | ||
{children} | ||
<Analytics /> | ||
<Toaster /> | ||
<TailwindIndicator /> | ||
</Providers> | ||
</body> | ||
</html> | ||
</ClerkProvider> | ||
); | ||
return ( | ||
<ClerkProvider> | ||
<html lang="en" suppressHydrationWarning> | ||
<head /> | ||
<body | ||
className={cn( | ||
"min-h-screen bg-background font-sans antialiased", | ||
fontSans.variable, | ||
fontUrban.variable, | ||
fontHeading.variable, | ||
)} | ||
> | ||
<Providers attribute="class" defaultTheme="system" enableSystem> | ||
{children} | ||
<Analytics /> | ||
<Toaster /> | ||
<TailwindIndicator /> | ||
</Providers> | ||
</body> | ||
</html> | ||
</ClerkProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,68 @@ | ||
"use client"; | ||
|
||
import Link from "next/link"; | ||
import { useRouter, useSearchParams } from "next/navigation"; | ||
import { AnimatePresence, motion } from "framer-motion"; | ||
import { ArrowLeft } from "lucide-react"; | ||
import { useRouter, useSearchParams } from "next/navigation"; | ||
|
||
import { Toaster } from "@/components/ui/toaster"; | ||
import { ArrowLeft } from "lucide-react"; | ||
import ConnectAccount from "@/components/onboarding/connect-account"; | ||
import FinancialGoals from "@/components/onboarding/financial-goals"; | ||
import Link from "next/link"; | ||
import { Toaster } from "@/components/ui/toaster"; | ||
import Welcome from "@/components/onboarding/welcome"; | ||
import { db } from "@projectx/db"; | ||
import { customer } from "../../../../packages/db/src/schema/customer"; | ||
import { db } from "@projectx/db"; | ||
import { nanoid } from "nanoid"; | ||
import { useUser } from "@clerk/nextjs"; | ||
import { nanoid } from 'nanoid' | ||
|
||
export default function Intro() { | ||
const router = useRouter(); | ||
const searchParams = useSearchParams(); | ||
const user = useUser(); | ||
const step = searchParams.get("step"); | ||
const router = useRouter(); | ||
const searchParams = useSearchParams(); | ||
const user = useUser(); | ||
const step = searchParams.get("step"); | ||
|
||
async function createUser() { | ||
await db.insert(customer).values({ | ||
id: `prefix_${nanoid(16)}`, | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
stripeId: "stripe_id", | ||
userId: user.user?.id || "error", | ||
}); | ||
async function createUser() { | ||
await db.insert(customer).values({ | ||
id: `prefix_${nanoid(16)}`, | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
stripeId: "stripe_id", | ||
userId: user.user?.id || "error", | ||
}); | ||
|
||
return { message: "user created" }; | ||
} | ||
return { message: "user created" }; | ||
} | ||
|
||
return ( | ||
<div className="dark mx-auto flex h-screen w-screen flex-col items-center justify-center overflow-x-hidden bg-zinc-950 text-white"> | ||
<Toaster /> | ||
<AnimatePresence mode="wait"> | ||
{step ? ( | ||
<button | ||
className="group absolute left-2 top-10 z-40 rounded-full p-2 transition-all hover:bg-zinc-400 sm:left-10" | ||
onClick={() => router.back()} | ||
> | ||
<ArrowLeft className="h-8 w-8 text-zinc-500 group-hover:text-zinc-800 group-active:scale-90" /> | ||
</button> | ||
) : ( | ||
<Welcome /> | ||
)} | ||
{step === "financial-goals" && <FinancialGoals />} | ||
{step === "connect-accounts" && <ConnectAccount />} | ||
{step === "done" && ( | ||
<div> | ||
<h1 className="font-display max-w-md text-3xl font-semibold transition-colors sm:text-4xl"> | ||
Done! | ||
</h1> | ||
<Link href="/dashboard" className="rounded-2xl" onClick={createUser}> | ||
Go to Dashboard | ||
</Link> | ||
</div> | ||
)} | ||
</AnimatePresence> | ||
</div> | ||
); | ||
return ( | ||
<div className="dark mx-auto flex h-screen w-screen flex-col items-center justify-center overflow-x-hidden bg-zinc-950 text-white"> | ||
<Toaster /> | ||
<AnimatePresence mode="wait"> | ||
{step ? ( | ||
<button | ||
className="group absolute left-2 top-10 z-40 rounded-full p-2 transition-all hover:bg-zinc-400 sm:left-10" | ||
onClick={() => router.back()} | ||
> | ||
<ArrowLeft className="h-8 w-8 text-zinc-500 group-hover:text-zinc-800 group-active:scale-90" /> | ||
</button> | ||
) : ( | ||
<Welcome /> | ||
)} | ||
{step === "financial-goals" && <FinancialGoals key="financialgoals" />} | ||
{step === "connect-accounts" && <ConnectAccount key="connectaccount" />} | ||
{step === "done" && ( | ||
<div key="done"> | ||
<h1 className="font-display max-w-md text-3xl font-semibold transition-colors sm:text-4xl"> | ||
Done! | ||
</h1> | ||
<Link | ||
href="/dashboard" | ||
className="rounded-2xl" | ||
// onClick={createUser} | ||
> | ||
Go to Dashboard | ||
</Link> | ||
</div> | ||
)} | ||
</AnimatePresence> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"Date","Name","Amount" | ||
"2016-01-01","Food","10.00" | ||
"2016-01-01","Transport","5.00" | ||
"2016-01-02","Food","20.00" | ||
"2016-01-02","Transport","10.00" | ||
"2016-01-03","Food","30.00" | ||
"2016-01-03","Transport","15.00" | ||
"2016-01-04","Food","40.00" | ||
"2016-01-04","Transport","20.00" | ||
"2016-01-05","Food","50.00" | ||
"2016-01-05","Transport","25.00" |
Oops, something went wrong.