diff --git a/app/dashboard/(base)/usage/[[...metric]]/layout.tsx b/app/dashboard/(base)/usage/[[...metric]]/layout.tsx index 3cac0f9b..af04345b 100644 --- a/app/dashboard/(base)/usage/[[...metric]]/layout.tsx +++ b/app/dashboard/(base)/usage/[[...metric]]/layout.tsx @@ -1,9 +1,6 @@ import {notFound} from 'next/navigation' import z from 'zod' -import { - ChartsLinks, - UsageCharts -} from '../../../../../lib/components/dashboard/Usage' +import {ChartsLinks, UsageCharts} from '~/components/dashboard/Metrics' const paramsSchema = z.enum(['runs', 'tokens']) diff --git a/app/dashboard/(base)/usage/[[...metric]]/page.tsx b/app/dashboard/(base)/usage/[[...metric]]/page.tsx index 49e345aa..975147a0 100644 --- a/app/dashboard/(base)/usage/[[...metric]]/page.tsx +++ b/app/dashboard/(base)/usage/[[...metric]]/page.tsx @@ -1,4 +1,4 @@ -import {UsageTable} from '~/components/dashboard/Usage' +import {UsageTable} from '~/components/dashboard/Metrics' export default async function Usage({ searchParams, diff --git a/lib/components/dashboard/usage/chart.tsx b/lib/components/dashboard/Metrics/Chart.tsx similarity index 100% rename from lib/components/dashboard/usage/chart.tsx rename to lib/components/dashboard/Metrics/Chart.tsx index 1a34a101..fc4034af 100644 --- a/lib/components/dashboard/usage/chart.tsx +++ b/lib/components/dashboard/Metrics/Chart.tsx @@ -1,5 +1,4 @@ 'use client' - import {LineChart} from '@tremor/react' export function Chart({ @@ -13,6 +12,7 @@ export function Chart({ }) { const customTooltip = ({payload, active}: {payload: any; active: any}) => { if (!active || !payload) return null + return (
{payload.map((category: any, idx: number) => ( diff --git a/lib/components/dashboard/usage/charts.tsx b/lib/components/dashboard/Metrics/Charts.tsx similarity index 97% rename from lib/components/dashboard/usage/charts.tsx rename to lib/components/dashboard/Metrics/Charts.tsx index 534d6c27..3de8725c 100644 --- a/lib/components/dashboard/usage/charts.tsx +++ b/lib/components/dashboard/Metrics/Charts.tsx @@ -1,7 +1,7 @@ import {getServerSession} from 'next-auth' import {authOptions} from '~/authOptions' -import {Chart} from '~/components/dashboard/Usage/Chart' import prisma from '~/prisma' +import {Chart} from '.' type UsageDay = { usageDay: Date diff --git a/lib/components/dashboard/usage/ChartsLinks.tsx b/lib/components/dashboard/Metrics/ChartsLinks.tsx similarity index 100% rename from lib/components/dashboard/usage/ChartsLinks.tsx rename to lib/components/dashboard/Metrics/ChartsLinks.tsx diff --git a/lib/components/dashboard/usage/CustomTable.tsx b/lib/components/dashboard/Metrics/CustomTable.tsx similarity index 98% rename from lib/components/dashboard/usage/CustomTable.tsx rename to lib/components/dashboard/Metrics/CustomTable.tsx index 9d5596ca..07a69393 100644 --- a/lib/components/dashboard/usage/CustomTable.tsx +++ b/lib/components/dashboard/Metrics/CustomTable.tsx @@ -14,7 +14,7 @@ import { TableRow } from '~/components/ui/table' import {cn} from '~/utils' -import {UsageRow} from './TableWrapper' +import {type UsageRow} from './TableWrapper' const TableColNames = [ { diff --git a/lib/components/dashboard/usage/search.tsx b/lib/components/dashboard/Metrics/Search.tsx similarity index 100% rename from lib/components/dashboard/usage/search.tsx rename to lib/components/dashboard/Metrics/Search.tsx diff --git a/lib/components/dashboard/usage/TableWrapper.tsx b/lib/components/dashboard/Metrics/TableWrapper.tsx similarity index 96% rename from lib/components/dashboard/usage/TableWrapper.tsx rename to lib/components/dashboard/Metrics/TableWrapper.tsx index f9996f69..002c7b99 100644 --- a/lib/components/dashboard/usage/TableWrapper.tsx +++ b/lib/components/dashboard/Metrics/TableWrapper.tsx @@ -3,11 +3,10 @@ import Link from 'next/link' import {redirect} from 'next/navigation' import z from 'zod' import {authOptions} from '~/authOptions' -import {CustomTable} from '~/components/dashboard/Usage/CustomTable' -import {TableSearch} from '~/components/dashboard/Usage/Search' import {Button} from '~/components/ui/button' import prisma from '~/prisma' import {cn} from '~/utils' +import {CustomTable, TableSearch} from '.' type UsageProject = { name: string diff --git a/lib/components/dashboard/usage/index.ts b/lib/components/dashboard/Metrics/index.ts similarity index 100% rename from lib/components/dashboard/usage/index.ts rename to lib/components/dashboard/Metrics/index.ts diff --git a/tsconfig.json b/tsconfig.json index 4a16ef4b..5c6add55 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,8 +3,7 @@ "baseUrl": ".", "lib": ["DOM", "DOM.Iterable", "ESNext"], "paths": { - "~/*": ["./lib/*"], - "~/components/*": ["./lib/components/*"] + "~/*": ["./lib/*"] }, "plugins": [{"name": "next"}], "types": ["bun-types", "web"]