Repository navigation
Add manual credit granting to the dashboard #15420
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
Merged
strandhvilliam
merged 18 commits into
main
from
villiam/manual-credit-granting-dashboard
Oct 15, 2026
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f4cb8e9
clients/web: Add manual credit granting to customer meters
strandhvilliam 9f75d21
clients/web: Add credits from customer usage table rows
strandhvilliam 086d17b
clients/web: Simplify the add credits panel
strandhvilliam 82f08b8
clients/web: Tidy the add credits panel
strandhvilliam f0ddaf4
clients/web: Name the duplicate credit check in the add credits panel
strandhvilliam 9846e67
clients/web: Tighten the add credits panel UX
strandhvilliam 1714c23
clients/web: Keep the add credits summary a fixed height
strandhvilliam f25a626
clients/web: Name the customer in the add credits panel
strandhvilliam bf00935
modify customer-meter header aligment
strandhvilliam 00bfc24
clients/web: Right-align the add credits panel buttons
strandhvilliam ea1a673
Poll for changes
strandhvilliam 36d7aa6
clients/web: Match the usage table's subscription and wait for pricin…
strandhvilliam ad0a7d8
clients/web: Wrap the customer meter toolbar and keep the customer fa…
strandhvilliam d200195
clients/web: Use the split credit request schema
cursoragent 453730c
remove polling and config_as_code flag
strandhvilliam 19427d6
copy update
strandhvilliam afe1322
server/customer_meter: Balance the customer meter when crediting
pieterbeulque 0169da5
server/customer_meter: Re-balance after crediting a locked customer m…
pieterbeulque 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 hidden or 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
43 changes: 43 additions & 0 deletions
43
clients/apps/web/src/components/Customer/AddCredits/AddCreditsButton.tsx
This file contains hidden or 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,43 @@ | ||
| 'use client' | ||
|
|
||
| import { useModal } from '@/components/Modal/useModal' | ||
| import { useHasPermission } from '@/hooks/permissions' | ||
| import { schemas } from '@polar-sh/client' | ||
| import { Button, InlineModal } from '@polar-sh/orbit' | ||
| import { AddCreditsModal } from './AddCreditsModal' | ||
|
|
||
| export const AddCreditsButton = ({ | ||
| organization, | ||
| customer, | ||
| meterId, | ||
| }: { | ||
| organization: schemas['Organization'] | ||
| customer: schemas['Customer'] | ||
| meterId: string | ||
| }) => { | ||
| const { show, hide, isShown } = useModal() | ||
| const canManageCustomers = useHasPermission( | ||
| organization.id, | ||
| 'customers:manage', | ||
| ) | ||
|
|
||
| if (!canManageCustomers) return null | ||
|
|
||
| return ( | ||
| <> | ||
| <Button onClick={show}>Add credits</Button> | ||
| <InlineModal | ||
| isShown={isShown} | ||
| hide={hide} | ||
| modalContent={ | ||
| <AddCreditsModal | ||
| organization={organization} | ||
| customer={customer} | ||
| meterId={meterId} | ||
| onClose={hide} | ||
| /> | ||
| } | ||
| /> | ||
| </> | ||
| ) | ||
| } |
Oops, something went wrong.
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.
fucking linter rule
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.
the linter really wanted it, so I made a drive-by divs-to-box refactor 🤷♂️