diff --git a/apps/web/src/app/(private)/dashboard/layout.tsx b/apps/web/src/app/(private)/dashboard/layout.tsx index 598b365f0..79a010ebd 100644 --- a/apps/web/src/app/(private)/dashboard/layout.tsx +++ b/apps/web/src/app/(private)/dashboard/layout.tsx @@ -2,8 +2,8 @@ import { ReactNode } from 'react' import { Container, - ListingHeader, TableBlankSlate, + TableWithHeader, Text, } from '@latitude-data/web-ui' import { AppLayout } from '$/components/layouts' @@ -46,33 +46,33 @@ export default async function DashboardLayout({ > {children} -
- - Add project - - } - /> -
- {projects.length > 0 && ( - - )} - {projects.length === 0 && ( - - - Create your first project - - - } - /> - )} -
-
+ + Add project + + } + table={ + <> + {projects.length > 0 && ( + + )} + {projects.length === 0 && ( + + + Create your first project + + + } + /> + )} + + } + />
) diff --git a/apps/web/src/app/(private)/datasets/layout.tsx b/apps/web/src/app/(private)/datasets/layout.tsx index 70ce8302e..dc5d2e204 100644 --- a/apps/web/src/app/(private)/datasets/layout.tsx +++ b/apps/web/src/app/(private)/datasets/layout.tsx @@ -2,8 +2,8 @@ import { ReactNode } from 'react' import { Container, - ListingHeader, TableBlankSlate, + TableWithHeader, } from '@latitude-data/web-ui' import { AppLayout } from '$/components/layouts' import { getCurrentUser } from '$/services/auth/getCurrentUser' @@ -32,22 +32,24 @@ export default async function DatasetsList({ > {children} - - Upload dataset + Upload dataset } - /> - - - Create your first dataset - - + table={ + + + Create your first dataset + + + } + /> } /> diff --git a/apps/web/src/app/(private)/evaluations/_components/ActiveEvaluations/index.tsx b/apps/web/src/app/(private)/evaluations/_components/ActiveEvaluations/index.tsx index ae0a7caac..56e2921bb 100644 --- a/apps/web/src/app/(private)/evaluations/_components/ActiveEvaluations/index.tsx +++ b/apps/web/src/app/(private)/evaluations/_components/ActiveEvaluations/index.tsx @@ -1,4 +1,4 @@ -import { ListingHeader, TableBlankSlate } from '@latitude-data/web-ui' +import { TableBlankSlate, TableWithHeader } from '@latitude-data/web-ui' import useEvaluations from '$/stores/evaluations' import ActiveEvaluationsTable from './Table' @@ -12,27 +12,29 @@ export default function ActiveEvaluations({ if (isLoading) return null return ( -
- - Add evaluation - - } - /> - {evaluations?.length ? ( - - ) : ( - - Create your first evaluation - - } - /> - )} -
+ + Add evaluation + + } + table={ + <> + {evaluations?.length ? ( + + ) : ( + + Create your first evaluation + + } + /> + )} + + } + /> ) } diff --git a/apps/web/src/app/(private)/evaluations/_components/Evaluations.tsx b/apps/web/src/app/(private)/evaluations/_components/Evaluations.tsx index d9e33c909..a80b764fd 100644 --- a/apps/web/src/app/(private)/evaluations/_components/Evaluations.tsx +++ b/apps/web/src/app/(private)/evaluations/_components/Evaluations.tsx @@ -20,38 +20,32 @@ export default function Evaluations({ useState() return ( - <> - - + + + setNewEvaluationData({ + title: 'New Evaluation', + description: '', + prompt: '', + }) + } + /> + {evaluationTemplates.length > 0 && ( + setNewEvaluationData({ - title: 'New Evaluation', - description: '', - prompt: '', + title: template.name, + description: template.description, + prompt: template.prompt, }) } /> - - {evaluationTemplates.length > 0 && ( -
- - - setNewEvaluationData({ - title: template.name, - description: template.description, - prompt: template.prompt, - }) - } - /> - -
)} setNewEvaluationData(undefined)} /> - +
) } diff --git a/apps/web/src/app/(private)/settings/layout.tsx b/apps/web/src/app/(private)/settings/layout.tsx index 1269f31a2..1e555b882 100644 --- a/apps/web/src/app/(private)/settings/layout.tsx +++ b/apps/web/src/app/(private)/settings/layout.tsx @@ -1,6 +1,6 @@ import { ReactNode } from 'react' -import { Container, ListingHeader, Text } from '@latitude-data/web-ui' +import { Container, Text, TitleWithActions } from '@latitude-data/web-ui' import { AppLayout } from '$/components/layouts' import { getCurrentUser } from '$/services/auth/getCurrentUser' import { getSession } from '$/services/auth/getSession' @@ -36,7 +36,7 @@ export default async function SettingsLayout({ > {children} - + diff --git a/packages/web-ui/src/ds/molecules/ListingHeader/index.tsx b/packages/web-ui/src/ds/molecules/ListingHeader/index.tsx index 6a7c38542..85a1bfbd3 100644 --- a/packages/web-ui/src/ds/molecules/ListingHeader/index.tsx +++ b/packages/web-ui/src/ds/molecules/ListingHeader/index.tsx @@ -1,6 +1,7 @@ import { ButtonHTMLAttributes, ReactNode } from 'react' -import { Button, Text } from '../../atoms' +import { Button } from '../../atoms' +import { TitleWithActions } from '../TitleWithActions' export function ListingButton({ children, @@ -13,21 +14,21 @@ export function ListingButton({ ) } -const ListingHeader = ({ +export const TableWithHeader = ({ title, actions, + table, }: { title: string actions?: ReactNode + table?: ReactNode }) => { return ( -
- {title} - {actions ?
{actions}
: null} +
+ +
{table}
) } -ListingHeader.Button = ListingButton - -export { ListingHeader } +TableWithHeader.Button = ListingButton diff --git a/packages/web-ui/src/ds/molecules/TitleWithActions/index.tsx b/packages/web-ui/src/ds/molecules/TitleWithActions/index.tsx new file mode 100644 index 000000000..6a90a22e9 --- /dev/null +++ b/packages/web-ui/src/ds/molecules/TitleWithActions/index.tsx @@ -0,0 +1,18 @@ +import { ReactNode } from 'react' + +import { Text } from '../../atoms' + +export const TitleWithActions = ({ + title, + actions, +}: { + title: string + actions?: ReactNode +}) => { + return ( +
+ {title} + {actions ?
{actions}
: null} +
+ ) +} diff --git a/packages/web-ui/src/ds/molecules/index.ts b/packages/web-ui/src/ds/molecules/index.ts index 8f7eb422b..eb83aa301 100644 --- a/packages/web-ui/src/ds/molecules/index.ts +++ b/packages/web-ui/src/ds/molecules/index.ts @@ -5,3 +5,4 @@ export * from './ClicktoCopy' export * from './TabSelector' export * from './TableBlankSlate' export * from './ListingHeader' +export * from './TitleWithActions'