-
Notifications
You must be signed in to change notification settings - Fork 607
refactor: ratelimit move rsc to trpc #3380
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
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
289d91e
refactor: move page to client using trpc
ogzhanolguncu 6452d44
feat: remove rsc from pages
ogzhanolguncu 186a704
refactor: prefetch on hover
ogzhanolguncu 6f7b651
fix: add missing client
ogzhanolguncu 33afb15
fix: add proper loading
ogzhanolguncu 503f35a
fix: typo
ogzhanolguncu 78f356d
chore: fmt
ogzhanolguncu 0aa02fa
chore: fmt
ogzhanolguncu b8b0ab0
fix: layoutshift
ogzhanolguncu 0f59344
fix: coderabbit issues
ogzhanolguncu 0d9291a
fix: invalidation issues
ogzhanolguncu 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
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
12 changes: 5 additions & 7 deletions
12
apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/page.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
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
91 changes: 0 additions & 91 deletions
91
apps/dashboard/app/(app)/ratelimits/[namespaceId]/namespace.actions.ts
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
apps/dashboard/app/(app)/ratelimits/[namespaceId]/overrides/last-used-cell.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,65 @@ | ||
| import { Badge } from "@/components/ui/badge"; | ||
| import { trpc } from "@/lib/trpc/client"; | ||
| import { cn } from "@/lib/utils"; | ||
| import { ChartActivity2 } from "@unkey/icons"; | ||
| import { TimestampInfo } from "@unkey/ui"; | ||
| import { useRef, useState } from "react"; | ||
| import { STATUS_STYLES } from "../_overview/components/table/utils/get-row-class"; | ||
|
|
||
| type LastUsedCellProps = { | ||
| namespaceId: string; | ||
| identifier: string; | ||
| }; | ||
|
|
||
| export const LastUsedCell = ({ namespaceId, identifier }: LastUsedCellProps) => { | ||
| const { data, isLoading, isError } = trpc.ratelimit.namespace.queryRatelimitLastUsed.useQuery({ | ||
| namespaceId, | ||
| identifier, | ||
| }); | ||
| const badgeRef = useRef<HTMLDivElement>(null); | ||
| const [showTooltip, setShowTooltip] = useState(false); | ||
|
|
||
| return ( | ||
| <Badge | ||
| ref={badgeRef} | ||
| className={cn( | ||
| "px-1.5 rounded-md flex gap-2 items-center max-w-min h-[22px] border-none cursor-pointer", | ||
| isError | ||
| ? "bg-error-3 text-error-11 border border-error-5" | ||
| : STATUS_STYLES.success.badge.default, | ||
| )} | ||
ogzhanolguncu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| onMouseOver={() => { | ||
| setShowTooltip(true); | ||
| }} | ||
| onMouseLeave={() => { | ||
| setShowTooltip(false); | ||
| }} | ||
| > | ||
| <div> | ||
| <ChartActivity2 size="sm-regular" /> | ||
| </div> | ||
| <div className="truncate"> | ||
| {isLoading ? ( | ||
| <div className="flex items-center w-full space-x-1"> | ||
| <div className="h-2 w-2 bg-grayA-5 rounded-full animate-pulse" /> | ||
| <div className="h-2 w-12 bg-grayA-5 rounded animate-pulse" /> | ||
| <div className="h-2 w-12 bg-grayA-5 rounded animate-pulse" /> | ||
| </div> | ||
| ) : isError ? ( | ||
| "Failed to load" | ||
| ) : data?.lastUsed ? ( | ||
| <TimestampInfo | ||
| displayType="relative" | ||
| value={data.lastUsed} | ||
| className="truncate" | ||
| triggerRef={badgeRef} | ||
| open={showTooltip} | ||
| onOpenChange={setShowTooltip} | ||
| /> | ||
| ) : ( | ||
| "Never used" | ||
| )} | ||
| </div> | ||
| </Badge> | ||
| ); | ||
| }; | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.