-
Notifications
You must be signed in to change notification settings - Fork 17
feat(ensadmin): include projection info on status page #1332
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
Changes from 6 commits
b9c5eb6
ecab5ef
a12735c
45849d1
ec183a8
f00f0a7
a032afd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "ensadmin": minor | ||
| --- | ||
|
|
||
| Updates `useIndexingStatusWithSwr` to always return current realtime indexing status projection. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "ensadmin": minor | ||
| --- | ||
|
|
||
| Includes `ProjectionInfo` component on Indexing Status page. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,61 @@ | ||||||
| "use client"; | ||||||
|
|
||||||
| import { RelativeTime, useNow } from "@namehash/namehash-ui"; | ||||||
| import { InfoIcon } from "lucide-react"; | ||||||
|
|
||||||
| import type { Duration, UnixTimestamp } from "@ensnode/ensnode-sdk"; | ||||||
|
|
||||||
| import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; | ||||||
|
|
||||||
| interface ProjectionInfoProps { | ||||||
| snapshotTime: UnixTimestamp; | ||||||
| worstCaseDistance: Duration; | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Displays metadata about the current indexing status projection in a tooltip. | ||||||
| * Shows when the projection was generated, when the snapshot was taken, and worst-case distance. | ||||||
| */ | ||||||
| export function ProjectionInfo({ snapshotTime, worstCaseDistance }: ProjectionInfoProps) { | ||||||
| const now = useNow(); | ||||||
|
|
||||||
| return ( | ||||||
|
tk-o marked this conversation as resolved.
Outdated
|
||||||
| <Tooltip delayDuration={300}> | ||||||
| <TooltipTrigger asChild> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please optimize the hover state. The way there's a rectangular light-grey panel appearing in the background on hover doesn't feel good. |
||||||
| <button | ||||||
| type="button" | ||||||
| className="inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground w-8" | ||||||
| aria-label="Indexing Status Metadata" | ||||||
| > | ||||||
| <InfoIcon className="h-4 w-4" /> | ||||||
| </button> | ||||||
| </TooltipTrigger> | ||||||
| <TooltipContent | ||||||
| side="right" | ||||||
| className="bg-gray-50 text-sm text-black shadow-md outline-none w-80 p-4" | ||||||
| > | ||||||
| <div className="flex flex-col gap-3"> | ||||||
| <div className="flex flex-col gap-1"> | ||||||
| <div className="font-semibold text-xs text-gray-500 uppercase"> | ||||||
| Worst-Case Distance* | ||||||
| </div> | ||||||
| <div className="text-sm"> | ||||||
| {worstCaseDistance} second{worstCaseDistance !== 1 ? "s" : ""} | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| </div> | ||||||
|
tk-o marked this conversation as resolved.
|
||||||
| </div> | ||||||
|
|
||||||
| <div className="text-xs text-gray-600 leading-relaxed"> | ||||||
| * as of real-time projection generated just now from indexing status snapshot captured{" "} | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| <RelativeTime | ||||||
| timestamp={snapshotTime} | ||||||
| relativeTo={now} | ||||||
| includeSeconds | ||||||
| conciseFormatting | ||||||
| /> | ||||||
| . | ||||||
| </div> | ||||||
| </div> | ||||||
| </TooltipContent> | ||||||
| </Tooltip> | ||||||
| ); | ||||||
| } | ||||||

Uh oh!
There was an error while loading. Please reload this page.