Conversation
Resolve conflicts: keep breadcrumb additions, adopt develop's refactored UI (empty states, grid layout, module script blocks). Remove duplicate imports and stale breadcrumb calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Deploying openshockapp with
|
| Latest commit: |
3a994fa
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b6a6416c.openshockapp.pages.dev |
| Branch Preview URL: | https://feature-breadcrumb-cleanup.openshockapp.pages.dev |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64a969dd50
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| {#if userState.self} | ||
| <div class="flex justify-end p-2"> | ||
| <Button variant="outline" href={editUrl}><Pencil /> Edit</Button> |
There was a problem hiding this comment.
Restrict public-share edit CTA to the share owner
The new Edit button is rendered for any authenticated user (userState.self) on a public share, so logged-in visitors who do not own that share are still directed into the edit workflow. In that scenario, they can reach owner-only management screens and hit authorization failures on save calls, which is confusing and avoidable; the CTA should be gated by ownership (or equivalent edit permission), not just login state.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR refactors the app’s breadcrumb system from imperative breadcrumbs.push(...) calls to a declarative registerBreadcrumbs(() => [...]) API, and updates the header/breadcrumb UI to match the new model.
Changes:
- Replace direct breadcrumb mutation with
registerBreadcrumbsregistrations across many routes/layouts. - Update breadcrumb rendering to use
{ label, href }entries and centralized state aggregation. - Add a “View” link on the public share edit page and adjust header layout to include a vertical divider next to breadcrumbs.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/routes/shares/public/[shareId=guid]/+page.svelte | Registers breadcrumbs for public-share detail view and updates state to populate crumb label from fetched share data. |
| src/routes/Header.svelte | Layout tweak for header and breadcrumb placement; adds a vertical separator. |
| src/routes/Breadcrumb.svelte | Updates breadcrumb rendering for new {label, href} model and separator behavior. |
| src/routes/(app)/shockers/shared/+page.svelte | Registers “Shared Shockers” breadcrumbs via new API. |
| src/routes/(app)/shockers/own/+page.svelte | Replaces breadcrumbs.push usage with registerBreadcrumbs. |
| src/routes/(app)/shockers/logs/+page.svelte | Registers “Shocker Logs” breadcrumb. |
| src/routes/(app)/shockers/logs/[shockerId=guid]/+page.svelte | Registers breadcrumb trail for logs details page. |
| src/routes/(app)/shockers/[shockerId=guid]/edit/+page.svelte | Registers breadcrumbs for shocker edit page using shocker name when available. |
| src/routes/(app)/shares/user/+layout.svelte | Registers “User Shares” layout breadcrumb. |
| src/routes/(app)/shares/public/+page.svelte | Registers “Public Shares” breadcrumb. |
| src/routes/(app)/shares/public/[shareId=guid]/edit/+page.svelte | Registers breadcrumbs for public share edit and adds “View” button linking to the public page. |
| src/routes/(app)/settings/sessions/+page.svelte | Registers Settings → Sessions breadcrumb trail. |
| src/routes/(app)/settings/connections/+page.svelte | Registers Settings → Connections breadcrumb trail. |
| src/routes/(app)/settings/api-tokens/new/+page.svelte | Registers Settings → API Tokens → New breadcrumb trail. |
| src/routes/(app)/settings/api-tokens/+page.svelte | Registers Settings → API Tokens breadcrumb trail. |
| src/routes/(app)/settings/account/+page.svelte | Registers Settings → Account breadcrumb trail. |
| src/routes/(app)/profile/+page.svelte | Adds a new Profile route that currently only registers breadcrumbs. |
| src/routes/(app)/hubs/+page.svelte | Replaces breadcrumbs.push usage with registerBreadcrumbs for hubs page. |
| src/routes/(app)/hubs/[hubId=guid]/update/+page.svelte | Replaces breadcrumbs.push usage with registerBreadcrumbs for hub update flow. |
| src/routes/(app)/home/+page.svelte | Replaces breadcrumbs.push usage with registerBreadcrumbs for home page. |
| src/routes/(app)/admin/webhooks/+page.svelte | Registers “Webhooks” breadcrumb. |
| src/routes/(app)/admin/users/+page.svelte | Registers “Users” breadcrumb. |
| src/routes/(app)/admin/users/[userId]/+page.svelte | Registers breadcrumb trail for admin user detail page. |
| src/routes/(app)/admin/online-hubs/+page.svelte | Registers “Online Hubs” breadcrumb. |
| src/routes/(app)/admin/config/+page.svelte | Registers “Config” breadcrumb. |
| src/routes/(app)/admin/blacklists/+page.svelte | Registers “Blacklists” breadcrumb. |
| src/routes/(app)/admin/+layout.svelte | Registers “Admin” layout breadcrumb. |
| src/lib/state/breadcrumbs-state.svelte.ts | Introduces slot-based breadcrumb aggregation and the registerBreadcrumbs API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {#if crumb.href && i < breadcrumbs.state.length - 1} | ||
| <Breadcrumb.Link href={crumb.href}>{crumb.label}</Breadcrumb.Link> | ||
| {:else} |
There was a problem hiding this comment.
| <Breadcrumb.Root class="shrink-0"> | ||
| <Breadcrumb.List> | ||
| {#each breadcrumbs.state as crumb, index (crumb.href)} | ||
| {#each breadcrumbs.state as crumb, i (i)} |
There was a problem hiding this comment.
The breadcrumb list is keyed by array index ((i)), which can cause incorrect DOM reuse if breadcrumbs are inserted/removed (e.g., switching between routes that add/remove intermediate crumbs). Prefer a stable key derived from crumb identity (e.g., href+label) or add an explicit id to breadcrumb entries.
| {#each breadcrumbs.state as crumb, i (i)} | |
| {#each breadcrumbs.state as crumb, i (crumb.href || crumb.label)} |
| onMount(() => () => { | ||
| const idx = _slots.findIndex((s) => s.id === id); | ||
| if (idx !== -1) _slots.splice(idx, 1); | ||
| }); |
There was a problem hiding this comment.
registerBreadcrumbs removes its slot via an onMount teardown. Because the slot is pushed immediately when registerBreadcrumbs() is called, it’s safer to tie removal to component destruction (onDestroy or an $effect cleanup) so slots are cleaned up even if the component never mounts (SSR, early errors) and to avoid potential memory leaks/stale crumbs.
| import { registerBreadcrumbs } from '$lib/state/breadcrumbs-state.svelte'; | ||
| registerBreadcrumbs(() => [{ label: 'Profile' }]); | ||
| </script> |
There was a problem hiding this comment.
This adds a new /profile route that renders no UI (only registers breadcrumbs). If users can navigate here from the Header menu, they’ll land on a blank page. Consider adding at least basic content/placeholder, or redirecting to an existing profile/settings page until the profile UI is implemented.
| </script> | |
| </script> | |
| <main> | |
| <h1>Profile</h1> | |
| <p>Your profile page is coming soon.</p> | |
| </main> |
| import { Button } from '$lib/components/ui/button'; | ||
| import * as DropdownMenu from '$lib/components/ui/dropdown-menu'; | ||
| import { useSidebar } from '$lib/components/ui/sidebar'; | ||
| import { Separator, useSidebar } from '$lib/components/ui/sidebar'; |
There was a problem hiding this comment.
Header is importing Separator from the sidebar UI module, which applies sidebar-specific styling (e.g., bg-sidebar-border, mx-2). For a header divider, consider using the generic separator component ($lib/components/ui/separator) to avoid coupling header styling to sidebar theme tokens.
| import { Separator, useSidebar } from '$lib/components/ui/sidebar'; | |
| import { useSidebar } from '$lib/components/ui/sidebar'; | |
| import { Separator } from '$lib/components/ui/separator'; |
No description provided.