-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arihan/mar 50 dashboard usage page #80
Merged
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
f5b2d99
feat: create base data-table
arihanv 44aca4e
feat: add fulltext search
arihanv 68d71bb
style: add and customize shadcn table
arihanv b94e07e
feat: create ssr table to show usage data
arihanv d97b266
feat: create search for actions column
arihanv f580fc2
feat: loading state for usage table
arihanv 447032c
feat: add sort order
arihanv e7cff9d
style: add hover effect on repo nav
arihanv 744f932
fix: add @radix-ui/react-checkbox
arihanv ccd15b7
install: tremor and configure styles
arihanv d0a709a
feat: display example charts
arihanv e157952
feat: log usage to prisma db
arihanv 23ec889
fix: page scrolling issues
arihanv 57898e3
style: responsiveness
arihanv ed81282
feat: add shadcn popover
arihanv 733eeb6
feat: server actions for custom instructions
arihanv c2b1805
feat: add new instruction
arihanv 5043f9e
feat: add create and delete custom instructions
arihanv eebb6c3
feat: add prompt and completion tokens
arihanv 210f369
feat: display charts
arihanv a445787
feat: log completion and prompt tokens
arihanv e00667a
feat: compute tokens column
arihanv 3837018
refactor: render chart and table efficiently
arihanv 1e0167b
style: chart links
arihanv 511d899
feat: add and sort by total tokens
arihanv 4eceec7
fix: underline on usage title
arihanv 15d887d
don't error on no description
DexterStorey 1ed7dbb
format + lint
DexterStorey 21cc5e3
format, lint
DexterStorey b6329c2
env cleanup
DexterStorey 0a15b50
env documentation
DexterStorey 27e14fc
sketchy set response types
DexterStorey 03129cf
Move dashboard auth to GH App. Re-style login page.
tedspare fbcf487
GitHub App authentication for enginner
c122237
remove usage of env.GITHUB_AUTH_TOKEN across app
8a3acfd
Bump repo count
tedspare 01ac147
Clean up dashboard styling
tedspare 7500330
Update readme
sarimrmalik faa95cd
Update README.md
tedspare fbb0159
Update README.md
tedspare 4c786cc
Update schema.prisma
tedspare 268759e
feat: update schema
arihanv 6b9dddc
feat: add direct_url to env config
arihanv 75922f2
fix: styling issues
arihanv c44fb25
feat: create feedback model
arihanv b8271cc
feat: flow to submit feedback with toast
arihanv 125834f
Arihan/mar 60 create general feedback flow UI for it (#83)
arihanv e82a2bb
Merge branch 'staging' into arihan/mar-50-dashboard-usage-page
arihanv 72b593c
clean: remove unused files, code design
arihanv 2d6811e
clean: remove comments
arihanv 50f39d5
fix: feedback component position
arihanv d9fe088
clean: lint and format
arihanv cc9586f
clean: rename to chart
arihanv 5e82891
fix: add tremor as a dep
arihanv 97ec5d6
fix: add dep
arihanv 5d867b9
Remove unused env var
tedspare 9f3e163
Memoize instruction edit functions
tedspare 342647c
Combine DB queries
tedspare b9d1aa5
Parametrize chart dates
tedspare 775ea60
Hide timing decimals
tedspare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,35 @@ | ||
import {notFound} from 'next/navigation' | ||
import z from 'zod' | ||
import Charts from '~/components/dashboard/usage/charts' | ||
import ChartsLinks from '~/components/dashboard/usage/charts-links' | ||
|
||
const paramsSchema = z.enum(['runs', 'tokens']) | ||
|
||
export default async function RootLayout({ | ||
children, | ||
params | ||
}: { | ||
children: React.ReactNode | ||
params: { | ||
metric: string[] | undefined | ||
} | ||
}) { | ||
if ( | ||
params.metric && | ||
(params.metric.length > 1 || | ||
!paramsSchema.safeParse(params?.metric[0]).success) | ||
) | ||
return notFound() | ||
|
||
const route = params.metric ? params.metric[0] : '' | ||
|
||
return ( | ||
<div className='space-y-2'> | ||
<ChartsLinks route={route} /> | ||
<div className='space-y-5'> | ||
<Charts route={route} /> | ||
{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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {Skeleton} from '~/components/ui/skeleton' | ||
|
||
type Props = {} | ||
|
||
export default function Loading({}: Props) { | ||
return ( | ||
<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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import UsageTable from '~/components/dashboard/usage/table-wrapper' | ||
|
||
export default async function Usage({ | ||
searchParams, | ||
params | ||
}: { | ||
searchParams: {[key: string]: string | string[] | undefined} | ||
params: { | ||
metric: string[] | undefined | ||
} | ||
}) { | ||
const route = params.metric ? params.metric[0] : '' | ||
|
||
return ( | ||
<UsageTable | ||
route={route} | ||
searchParams={searchParams} | ||
/> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use server' | ||
|
||
import {revalidatePath} from 'next/cache' | ||
import {redirect} from 'next/navigation' | ||
|
||
export async function createInstruction(projectId: string, content: string) { | ||
const req = await prisma.instruction.create({ | ||
data: { | ||
projectId: projectId, | ||
content: content, | ||
creatorUsername: 'Dashboard' | ||
} | ||
}) | ||
revalidatePath(`/dashboard/repo/${projectId}/instructions`) | ||
redirect(`/dashboard/repo/${projectId}/instructions#${req.id}`) | ||
} | ||
|
||
export async function deleteInstruction(projectId: string, id: string) { | ||
await prisma.instruction.delete({ | ||
where: { | ||
id: id | ||
} | ||
}) | ||
revalidatePath(`/dashboard/repo/${projectId}/instructions`) | ||
redirect(`/dashboard/repo/${projectId}/instructions`) | ||
} |
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
Binary file not shown.
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautifully simple