feat: replace HomePageRecentlyVisited with custom RecentlyVisitedCard#449
Conversation
Built-in Backstage component uses hardcoded color variants that render custom OpenChoreo kinds (environment, deploymentpipeline, dataplane, etc.) as dark grey. Custom component uses ENTITY_KIND_COLORS from the catalog graph for consistent kind coloring, adds kind icons next to entity names, and overrides non-entity page visits with friendly labels and sidebar-matching icons instead of raw pathnames. Fixes: openchoreo/openchoreo#2883 Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughReplaces the plugin-provided HomePageRecentlyVisited with a locally implemented RecentlyVisitedCard; the new component fetches recent visits, parses entity refs, applies kind-based icons/colors, maps certain page paths to friendly labels/icons, and renders a collapsible recently-visited InfoCard. Changes
Sequence DiagramsequenceDiagram
participant HomePage
participant RecentlyVisitedCard
participant VisitsAPI as visitsApiRef
participant Catalog as Catalog API
participant IconRegistry as app.getSystemIcon
participant InfoCard
HomePage->>RecentlyVisitedCard: render
RecentlyVisitedCard->>VisitsAPI: fetchRecentVisits()
VisitsAPI-->>RecentlyVisitedCard: visits[]
loop each visit
alt visit.entityRef exists
RecentlyVisitedCard->>Catalog: (parse entityRef) get kind / ref info
RecentlyVisitedCard->>IconRegistry: request icon for kind
IconRegistry-->>RecentlyVisitedCard: icon
RecentlyVisitedCard->>RecentlyVisitedCard: determine kind color & label
else known pathname (PAGE_OVERRIDES)
RecentlyVisitedCard->>RecentlyVisitedCard: map pathname -> label, icon, color
else unknown page
RecentlyVisitedCard->>RecentlyVisitedCard: use default "other" label & color
end
end
RecentlyVisitedCard->>InfoCard: render rows (chip, icon/link, timestamp)
InfoCard-->>HomePage: displayed card (collapsible)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/app/src/components/Home/RecentlyVisitedCard.tsx`:
- Around line 142-153: The relative-time function getRelativeTime currently uses
Math.round which causes time labels to jump early; change the calculations to
use Math.floor instead: compute seconds = Math.floor((Date.now() - timestamp) /
1000), then minutes = Math.floor(seconds / 60), hours = Math.floor(minutes /
60), days = Math.floor(hours / 24), and keep the same bucket checks (seconds <
60, minutes < 60, hours < 24) so labels use floor-based bucketing and avoid
premature promotion to the next unit.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6cbe477e-15ce-4012-899f-234b681f8b24
📒 Files selected for processing (2)
packages/app/src/components/Home/HomePage.tsxpackages/app/src/components/Home/RecentlyVisitedCard.tsx
Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
Built-in Backstage component uses hardcoded color variants that render
custom OpenChoreo kinds (environment, deploymentpipeline, dataplane,
etc.) as dark grey. Custom component uses ENTITY_KIND_COLORS from the
catalog graph for consistent kind coloring, adds kind icons next to
entity names, and overrides non-entity page visits with friendly labels
and sidebar-matching icons instead of raw pathnames.
Fixes: openchoreo/openchoreo#2883
Summary by CodeRabbit
New Features
Refactor