| sessionId |
|---|
| session-261002-154517-19l9 |
Enhance user utility and application navigation by making individual proposals linkable and bookmarkable via browser URLs. Replacing in-memory state selection with URL-driven routing maximizes efficiency, enables direct sharing among users, and preserves standard browser history navigation (back/forward).
createMemoryHistory() to createWebHistory().HomeView for the empty state (/) and specific proposals (/proposals/:id).HomeView.vue with <RouterView />.ProposalView.vue) to fetch and render proposal details based on route parameters.Sidebar.vue and ProposalContainer.vue to trigger router navigation and synchronize active item highlights with the active route./ displays the proposal sidebar alongside ProposalEmptyState in the main view area./proposals/:id loads and displays the details for the proposal with ID :id.Sidebar.vue navigates to /proposals/:id, highlights the selected proposal in the sidebar, and closes the mobile sidebar drawer if open./proposals/:id highlights the respective item in the sidebar once the proposal list is loaded.ProposalDetail.vue, ProposalEmptyState.vue).src/router/index.ts uses createMemoryHistory() and only registers a single route { path: '/', component: HomeView }.src/views/HomeView.vue manages the selected proposal state locally in component memory (ref<ProposalWithParagraphs>()). Clicking a sidebar item triggers handleSelection which directly calls ProposalService.getProposal(id) and sets local state.src/components/Sidebar.vue tracks selection via an internal selectedId ref and emits an event upward.src/App.vue renders the top-level <RouterView />, which mounts HomeView.vue.HomeView.vue:
HomeView rather than creating separate top-level pages.createMemoryHistory() to createWebHistory()./proposals/:id) that work with browser history, bookmarks, and link sharing.src/views/ProposalView.vue as the route-level child component that reads route params, fetches data via ProposalService, and passes data to the existing ProposalDetail.vue.ProposalDetail.vue purely presentational and reusable while decoupling route logic and lifecycle hooks.useRoute().params.id instead of disconnected local component state.graph TD
App[App.vue - Root RouterView] --> HomeView[HomeView.vue]
HomeView --> Sidebar[Sidebar.vue - List & Filters]
HomeView --> ContentRouterView[Nested RouterView]
ContentRouterView -- path: '/' --> EmptyState[ProposalEmptyState.vue]
ContentRouterView -- path: '/proposals/:id' --> ProposalView[ProposalView.vue]
ProposalView --> ProposalDetail[ProposalDetail.vue]
Sidebar -.->|router.push('/proposals/:id')| ProposalView
src/router/index.ts:
createWebHistory().{
path: '/',
component: HomeView,
children: [
{ path: '', name: 'home', component: ProposalEmptyState },
{ path: 'proposals/:id', name: 'proposal', component: () => import('../views/ProposalView.vue'), props: true }
]
}
src/views/HomeView.vue:
<ProposalDetail>, <ProposalEmptyState>, and content <LoadingSpinner> in <main> with <RouterView />.selected state and handleSelection logic since routing handles proposal loading.isSidebarOpen on mobile viewports.src/views/ProposalView.vue (New File):
id prop (coerced to number).id to invoke ProposalService.getProposal(id) with useLoading('content').ProposalDetail when loaded, or appropriate error/empty fallback on failure.src/components/Sidebar.vue & src/components/ProposalContainer.vue:
handleSelection to navigate using router.push({ name: 'proposal', params: { id: proposal.id } }).selected state dynamically from the active route parameter matching proposal.id.src/router/index.ts (modified) — Configure HTML5 web history and nested routes.src/views/HomeView.vue (modified) — Host nested <RouterView /> and layout shell.src/views/ProposalView.vue (new) — Route view component for fetching and displaying a proposal.src/components/Sidebar.vue (modified) — Derive active selection from route and dispatch route navigation.Number(route.params.id) ensures compatibility with ProposalService.getProposal(number).Verification focuses on confirming that URLs accurately reflect the displayed proposal, deep links load expected data, and navigation between proposals works smoothly via both UI clicks and browser history.
/proposals/:id, updates the address bar URL, and displays the corresponding proposal content./ renders ProposalEmptyState in the main content pane without errors./proposals/abc or /proposals/-1 handles the error gracefully without throwing uncaught exceptions.Vue Router is configured with web history and nested routes for proposal viewing.
createMemoryHistory() with createWebHistory() in src/router/index.ts to support browser URLs, bookmarks, and standard history navigation.HomeView: an empty child path '' mapped to ProposalEmptyState.vue and a dynamic child path 'proposals/:id' mapped to a proposal detail route view.props: true (or custom prop mapping) on the dynamic route to pass the proposal id cleanly as a typed number prop.Dedicated route view created to load and display individual proposals based on URL parameters.
src/views/ProposalView.vue (or ProposalDetailView.vue) to encapsulate data retrieval for the selected proposal ID.ProposalService.getProposal(id) with reactive route parameter watchers so switching proposals updates content without remounting overhead.useLoading('content') and render ProposalDetail or handle not-found/error states gracefully.HomeView and Sidebar leverage Vue Router navigation and automatic route-based active selection.
src/views/HomeView.vue main area to render <RouterView /> instead of manual conditional rendering.src/components/Sidebar.vue and src/components/ProposalContainer.vue to navigate to /proposals/:id upon proposal click.Sidebar.vue with current route.params.id to ensure correct state on direct URL loads, back/forward navigation, and clicks.