-
Notifications
You must be signed in to change notification settings - Fork 60
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
6391a0d
commit df04807
Showing
19 changed files
with
434 additions
and
106 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
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { ReactNode } from 'react' | ||
|
||
import { | ||
Container, | ||
ListingHeader, | ||
TableBlankSlate, | ||
} from '@latitude-data/web-ui' | ||
import { AppLayout } from '$/components/layouts' | ||
import { getCurrentUser } from '$/services/auth/getCurrentUser' | ||
import { getSession } from '$/services/auth/getSession' | ||
import { ROUTES } from '$/services/routes' | ||
import Link from 'next/link' | ||
import { redirect } from 'next/navigation' | ||
|
||
import { MAIN_NAV_LINKS, NAV_LINKS } from '../_lib/constants' | ||
|
||
export default async function DatasetsList({ | ||
children, | ||
}: Readonly<{ | ||
children: ReactNode | ||
}>) { | ||
const data = await getSession() | ||
if (!data.session) return redirect(ROUTES.auth.login) | ||
|
||
const { user } = await getCurrentUser() | ||
|
||
return ( | ||
<AppLayout | ||
navigationLinks={NAV_LINKS} | ||
currentUser={{ ...user }} | ||
sectionLinks={MAIN_NAV_LINKS} | ||
> | ||
<Container> | ||
{children} | ||
<ListingHeader | ||
title='Datasets' | ||
actions={ | ||
<Link href={ROUTES.datasets.new.root}> | ||
<ListingHeader.Button>Upload dataset</ListingHeader.Button> | ||
</Link> | ||
} | ||
/> | ||
<TableBlankSlate | ||
description='There are no datasets yet. Create one to start testing your prompts.' | ||
link={ | ||
<Link href={ROUTES.datasets.new.root}> | ||
<TableBlankSlate.Button> | ||
Create your first dataset | ||
</TableBlankSlate.Button> | ||
</Link> | ||
} | ||
/> | ||
</Container> | ||
</AppLayout> | ||
) | ||
} |
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,69 @@ | ||
'use client' | ||
|
||
import { | ||
Button, | ||
CloseTrigger, | ||
DropzoneInput, | ||
FormWrapper, | ||
Input, | ||
Modal, | ||
// useToast, | ||
} from '@latitude-data/web-ui' | ||
// import { useFormAction } from '$/hooks/useFormAction' | ||
import { useNavigate } from '$/hooks/useNavigate' | ||
import { ROUTES } from '$/services/routes' | ||
|
||
// import useProjects from '$/stores/projects' | ||
|
||
export default function NewDataset() { | ||
const data = { name: '' } | ||
const navigate = useNavigate() | ||
// const { toast } = useToast() | ||
// const { create } = useProjects() | ||
// const { data, action } = useFormAction(create, { | ||
// onSuccess: (project) => { | ||
// toast({ | ||
// title: 'Success', | ||
// description: `Project "${project.name}" created.`, | ||
// }) | ||
// | ||
// navigate.push(ROUTES.datasets.root) | ||
// }, | ||
// }) | ||
return ( | ||
<Modal | ||
open | ||
onOpenChange={(open) => !open && navigate.push(ROUTES.datasets.root)} | ||
title='Create new dataset' | ||
description='Datasets allow you to test prompts and evaluations with your own data.' | ||
footer={ | ||
<> | ||
<CloseTrigger /> | ||
<Button fancy form='createDatasetForm' type='submit'> | ||
Create dataset | ||
</Button> | ||
</> | ||
} | ||
> | ||
<form className='min-w-0' id='createDatasetForm'> | ||
<FormWrapper> | ||
<Input | ||
required | ||
type='text' | ||
label='Name' | ||
name='name' | ||
defaultValue={data?.name} | ||
placeholder='Amazing dataset' | ||
/> | ||
<DropzoneInput | ||
label='Upload dataset' | ||
name='dataset_file' | ||
placeholder='Upload csv' | ||
multiple={false} | ||
accept='.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel' | ||
/> | ||
</FormWrapper> | ||
</form> | ||
</Modal> | ||
) | ||
} |
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,3 @@ | ||
export default function DatasetsRoot() { | ||
return null // --> layout.tsx | ||
} |
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
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
Oops, something went wrong.