-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec77f6d
commit bcb8c15
Showing
190 changed files
with
3,852 additions
and
4,387 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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,46 +1,48 @@ | ||
import {Suspense} from 'react' | ||
import {ProjectsList} from '~/components/dashboard/Projects/ProjectsList' | ||
import prisma from '~/prisma' | ||
import {getCurrentUser} from '~/utils/session' | ||
import { Suspense } from "react"; | ||
import { ProjectsList } from "~/components/dashboard/Projects/ProjectsList"; | ||
import prisma from "~/prisma"; | ||
import { getCurrentUser } from "~/utils/session"; | ||
|
||
export default async function Dashboard({params}: {params: {slug: string}}) { | ||
const user = await getCurrentUser() | ||
export default async function Dashboard({ | ||
params, | ||
}: { params: { slug: string } }) { | ||
const user = await getCurrentUser(); | ||
|
||
const memberships = await prisma.membership.findFirst({ | ||
where: { | ||
userId: user.id, | ||
team: { | ||
slug: params.slug | ||
} | ||
slug: params.slug, | ||
}, | ||
}, | ||
select: { | ||
team: { | ||
include: { | ||
Project: { | ||
include: { | ||
instructions: true, | ||
organization: true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
organization: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
if (!memberships) return <p>Could not find team {params.slug}</p> | ||
if (!memberships) return <p>Could not find team {params.slug}</p>; | ||
|
||
const {team} = memberships | ||
const {Project: projects} = team | ||
const { team } = memberships; | ||
const { Project: projects } = team; | ||
|
||
return ( | ||
<div className='flex flex-col items-center'> | ||
<div className="flex flex-col items-center"> | ||
<Suspense fallback={<p>Loading...</p>}> | ||
<ProjectsList | ||
username={user.userName} | ||
username={user.userName as string} | ||
teamSlug={params.slug} | ||
projects={projects} | ||
/> | ||
</Suspense> | ||
</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
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,32 +1,29 @@ | ||
import Link from 'next/link' | ||
import {UpgradeForm} from '~/components/dashboard/Billing/UpgradeForm' | ||
import {Button} from '~/components/ui/button' | ||
import {STRIPE} from '~/constants' | ||
import prisma from '~/prisma' | ||
import {getCurrentUser} from '~/utils/session' | ||
import Link from "next/link"; | ||
import { UpgradeForm } from "~/components/dashboard/Billing/UpgradeForm"; | ||
import { Button } from "~/components/ui/button"; | ||
import { STRIPE } from "~/constants"; | ||
import prisma from "~/prisma"; | ||
import { getCurrentUser } from "~/utils/session"; | ||
|
||
function ManageButton() { | ||
return ( | ||
<Link | ||
target='_blank' | ||
className='w-fit' | ||
href={STRIPE.MANAGE_LINK}> | ||
<Button variant='outline'>Manage Subscription</Button> | ||
<Link target="_blank" className="w-fit" href={STRIPE.MANAGE_LINK}> | ||
<Button variant="outline">Manage Subscription</Button> | ||
</Link> | ||
) | ||
); | ||
} | ||
|
||
export default async function Billing() { | ||
const {id} = await getCurrentUser() | ||
const { id } = await getCurrentUser(); | ||
const user = await prisma.user.findUnique({ | ||
where: {id}, | ||
select: {stripeCustomerId: true} | ||
}) | ||
where: { id }, | ||
select: { stripeCustomerId: true }, | ||
}); | ||
|
||
return ( | ||
<div className='flex flex-col gap-4'> | ||
<div className="flex flex-col gap-4"> | ||
<h3>Billing</h3> | ||
{user.stripeCustomerId ? <ManageButton /> : <UpgradeForm />} | ||
{user?.stripeCustomerId ? <ManageButton /> : <UpgradeForm />} | ||
</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 |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import TeamDetailsForm from '~/components/dashboard/Settings/TeamDetailsForm' | ||
import prisma from '~/prisma' | ||
import type { Team } from "@prisma/client"; | ||
import TeamDetailsForm from "~/components/dashboard/Settings/TeamDetailsForm"; | ||
import prisma from "~/prisma"; | ||
|
||
export default async function General({params}: {params: {slug: string}}) { | ||
const team = await prisma.team.findUnique({where: {slug: params.slug}}) | ||
export default async function General({ | ||
params, | ||
}: { params: { slug: string } }) { | ||
const team = await prisma.team.findUnique({ where: { slug: params.slug } }); | ||
return ( | ||
<div className='flex flex-col gap-6 py-0.5'> | ||
<div className="flex flex-col gap-6 py-0.5"> | ||
<h3>General</h3> | ||
<TeamDetailsForm team={team} /> | ||
<TeamDetailsForm team={team as Team} /> | ||
</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
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,41 +1,43 @@ | ||
import {redirect} from 'next/navigation' | ||
import { redirect } from "next/navigation"; | ||
import { | ||
ExistingMembers, | ||
InviteDialog, | ||
PendingInvitations | ||
} from '~/components/dashboard/Settings' | ||
import prisma from '~/prisma' | ||
import {getCurrentUser} from '~/utils/session' | ||
PendingInvitations, | ||
} from "~/components/dashboard/Settings"; | ||
import prisma from "~/prisma"; | ||
import { getCurrentUser } from "~/utils/session"; | ||
|
||
export default async function Members({params}: {params: {slug: string}}) { | ||
const user = await getCurrentUser() | ||
export default async function Members({ | ||
params, | ||
}: { params: { slug: string } }) { | ||
const user = await getCurrentUser(); | ||
const team = await prisma.team.findFirst({ | ||
where: {slug: params.slug, memberships: {some: {userId: user.id}}}, | ||
where: { slug: params.slug, memberships: { some: { userId: user.id } } }, | ||
select: { | ||
id: true, | ||
memberships: { | ||
select: { | ||
id: true, | ||
role: true, | ||
user: {select: {id: true, email: true, createdAt: true}} | ||
} | ||
user: { select: { id: true, email: true, createdAt: true } }, | ||
}, | ||
}, | ||
invites: { | ||
where: {acceptedBy: null}, | ||
select: {id: true, email: true, role: true, createdAt: true} | ||
} | ||
} | ||
}) | ||
if (!team) redirect('/') | ||
where: { acceptedBy: null }, | ||
select: { id: true, email: true, role: true, createdAt: true }, | ||
}, | ||
}, | ||
}); | ||
if (!team) redirect("/"); | ||
|
||
return ( | ||
<div className='flex flex-col gap-6 py-0.5'> | ||
<div className='flex items-center justify-between gap-2'> | ||
<div className="flex flex-col gap-6 py-0.5"> | ||
<div className="flex items-center justify-between gap-2"> | ||
<h3>Members</h3> | ||
<InviteDialog teamId={team.id} /> | ||
</div> | ||
<ExistingMembers members={team.memberships} /> | ||
{team.invites.length > 0 && <PendingInvitations invites={team.invites} />} | ||
</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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {redirect} from 'next/navigation' | ||
import { redirect } from 'next/navigation' | ||
|
||
export default async function Settings({params}: {params: {slug: string}}) { | ||
export default async function Settings({ params }: { params: { slug: string } }) { | ||
redirect(`/${params.slug}/settings/members`) | ||
} |
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,41 +1,35 @@ | ||
import {notFound} from 'next/navigation' | ||
import z from 'zod' | ||
import {ChartsLinks, UsageCharts} from '~/components/dashboard/Metrics' | ||
import { notFound } from "next/navigation"; | ||
import z from "zod"; | ||
import { ChartsLinks, UsageCharts } from "~/components/dashboard/Metrics"; | ||
|
||
const paramsSchema = z.enum(['runs', 'tokens']) | ||
const paramsSchema = z.enum(["runs", "tokens"]); | ||
|
||
export default async function RootLayout({ | ||
children, | ||
params | ||
params, | ||
}: { | ||
children: React.ReactNode | ||
children: React.ReactNode; | ||
params: { | ||
slug: string | ||
metric: string[] | undefined | ||
} | ||
slug: string; | ||
metric: string[] | undefined; | ||
}; | ||
}) { | ||
if ( | ||
params.metric && | ||
(params.metric.length > 1 || | ||
!paramsSchema.safeParse(params?.metric[0]).success) | ||
) | ||
return notFound() | ||
return notFound(); | ||
|
||
const route = params.metric ? params.metric[0] : '' | ||
const route = params.metric ? params.metric[0] : ""; | ||
|
||
return ( | ||
<div className='space-y-2'> | ||
<ChartsLinks | ||
teamSlug={params.slug} | ||
route={route} | ||
/> | ||
<div className='space-y-5'> | ||
<UsageCharts | ||
teamSlug={params.slug} | ||
route={route} | ||
/> | ||
<div className="space-y-2"> | ||
<ChartsLinks teamSlug={params.slug} route={route as string} /> | ||
<div className="space-y-5"> | ||
<UsageCharts teamSlug={params.slug} route={route as string} /> | ||
{children} | ||
</div> | ||
</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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import {Skeleton} from '~/components/ui/skeleton' | ||
import { Skeleton } from '~/components/ui/skeleton' | ||
|
||
// biome-ignore lint/complexity/noBannedTypes: <explanation> | ||
type Props = {} | ||
|
||
// biome-ignore lint/correctness/noEmptyPattern: <explanation> | ||
export default function Loading({}: Props) { | ||
return ( | ||
<div className='space-y-2'> | ||
<Skeleton className='h-10' /> | ||
<Skeleton className='h-56' /> | ||
<div className="space-y-2"> | ||
<Skeleton className="h-10" /> | ||
<Skeleton className="h-56" /> | ||
</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 |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import {UsageTable} from '~/components/dashboard/Metrics' | ||
import { UsageTable } from "~/components/dashboard/Metrics"; | ||
|
||
export default async function Usage({ | ||
searchParams, | ||
params | ||
params, | ||
}: { | ||
searchParams: {[key: string]: string | string[] | undefined} | ||
searchParams: { [key: string]: string | string[] | undefined }; | ||
params: { | ||
slug: string | ||
metric: string[] | undefined | ||
} | ||
slug: string; | ||
metric: string[] | undefined; | ||
}; | ||
}) { | ||
const route = params.metric ? params.metric[0] : '' | ||
const route = params.metric ? params.metric[0] : ""; | ||
|
||
return ( | ||
<UsageTable | ||
teamSlug={params.slug} | ||
route={route} | ||
route={route as string} | ||
searchParams={searchParams} | ||
/> | ||
) | ||
); | ||
} |
Oops, something went wrong.