Add dynamic breadcrumbs to Header via React Context
Replace hardcoded "Coffee Project / Projects" with a BreadcrumbsContext that each page registers into via useBreadcrumbs(). The Header reads breadcrumb items dynamically, renders links for items with href, and makes "Coffee Project" clickable to open the navigation drawer. Also removes the unused currentScreenName from Redux appState. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,25 +1,18 @@
|
||||
import type { PayloadAction } from "@reduxjs/toolkit"
|
||||
|
||||
import { createSlice } from "@reduxjs/toolkit"
|
||||
|
||||
import { AppState } from "./types"
|
||||
|
||||
const initialState: AppState = {
|
||||
currentScreenName: "",
|
||||
}
|
||||
const initialState: AppState = {}
|
||||
|
||||
const appStateSlice = createSlice({
|
||||
name: "appState",
|
||||
initialState,
|
||||
reducers: {
|
||||
setCurrentScreenName(state, action: PayloadAction<string>) {
|
||||
state.currentScreenName = action.payload
|
||||
},
|
||||
resetAppState(state) {
|
||||
state.currentScreenName = initialState.currentScreenName
|
||||
resetAppState() {
|
||||
return initialState
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export const { resetAppState, setCurrentScreenName } = appStateSlice.actions
|
||||
export const { resetAppState } = appStateSlice.actions
|
||||
export const appStateReducer = appStateSlice.reducer
|
||||
|
||||
Reference in New Issue
Block a user