Repository navigation
Conversation
|
@Kvngcisco is attempting to deploy a commit to the nanle-code's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Kvngcisco Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Resolves merge conflicts against Nanle-code/stellar-dev-dashboard@682db49 (279 commit(s) behind) so the PR is mergeable.
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
Adds a global network + time-range context to the Stellar Dev Dashboard and
persists it in the URL query string (#987). A new header context bar selects the
network and a time range (presets such as
24h/7d/30d/all, or a customfrom/towindow). All changes are written to the URL, so links are shareableand browser back/forward restores the previous context. Invalid hand-edited
values never break the page: parsing is total and falls back to documented
defaults with an inline explanation.
Related Issue
layout header, analytics viewsChanges
Context parsing & validation
src/lib/context/url-context.ts?network=…&range=…(+from/tofor custom ranges).parseDashboardContext()validates the network and range, substitutesdefaults, and records issues (
unknown-network,invalid-range,incomplete-custom-range,reversed-custom-range) — it never throws.buildContextParams()merges the context into an existing query string(preserving unrelated/deep-link params) and drops stale
from/towhen therange is a preset.
resolveTimeRange()turns a preset/custom range into concretestart/enddates (including the unbounded
allpreset).React context + header bar
[ADD]
src/context/DashboardContext.tsxDashboardProvider/useDashboardContext(); URL is canonical viauseSearchParams.setSearchParams(push) so back/forward restores context.store.setNetwork(), so every existinganalytics/chart view that reads
store.networkfollows the context.resolvedRangeandtimeRangeLabelfor views.[ADD]
src/components/layout/ContextBar.tsx<select>, time-range preset buttons, a customfrom/to date picker with inline validation, a reset action, and a
role="status"message for invalid URL values.[ADD]
src/components/layout/ContextScopeNotice.tsxlocal override with a one-click Use global reset.
Wiring
[MODIFY]
src/App.tsxDashboardProvider(insideBrowserRouter, outside theerror boundary).
[MODIFY]
src/routes/DashboardLayout.tsx<ContextBar />in the header.location.searchwhen syncing the active tab to the URL, soswitching views no longer drops the context params.
[MODIFY]
src/components/dashboard/Analytics.tsxuseDashboardContext(), rendersContextScopeNotice, and adds aview-scoped range override that is surfaced as a labelled local override.
[MODIFY]
src/components/dashboard/ChartsTab.tsxContextScopeNoticeso chart views make their context explicit.Tests
src/lib/context/__tests__/url-context.test.tsboundary cases (
all, equal custom bounds, epoch bounds, case-insensitivevalues) and failure cases (unknown network, invalid range, missing /
unparseable / reversed custom bounds, malformed input).
src/context/__tests__/DashboardContext.test.tsxback-navigation restoration and safe fallbacks.
Documentation
docs/CONTEXT_BAR.md— full URL contract, validation/fallback table,consumption guidance, compatibility/migration/security notes and test
instructions.
README.md— user-facing section for the global context.docs/ROUTING.md— global context section + testing notes.Verification Results
Implementation was produced through the GitHub REST API (no local clone of the
dashboard repo), so the repository's pnpm/Vitest suite could not be executed
here. Verification performed:
.ts/.tsxfile compiles cleanly withesbuild --loader:.ts=ts --loader:.tsx=tsx(no parse errors).src/lib/context/url-context.tswas transpiled and executedagainst a standalone assertion script covering the primary, boundary and
failure cases listed below — all passed.
react-router-domandvitest, both already present).Tests added for the primary flow, at least one boundary case and at least one
failure case (run them with
pnpm run test -- src/lib/context/__tests__/url-context.test.ts src/context/__tests__/DashboardContext.test.tsx).ContextBar+DashboardProvider(?network,?range,?from,?to)AnalyticsandChartsTabconsume the shared context andContextScopeNoticelabels local overridesuseSearchParams; covered byDashboardContext.test.tsxurl-context.test.tsfailure cases forunknown-network,invalid-range,incomplete-custom-range,reversed-custom-rangedocs/CONTEXT_BAR.md,README.md,docs/ROUTING.mdCloses #987