Skip to content

Commit

Permalink
optimize file routing
Browse files Browse the repository at this point in the history
  • Loading branch information
barbalex committed Nov 28, 2024
1 parent 6c0dd7b commit 18237ad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
28 changes: 20 additions & 8 deletions src/components/Router/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,16 @@ export const Router = () => {
index={true}
lazy={() => import('../shared/Files/Files/index.jsx')}
/>
<Route
path=":fileId/Vorschau"
lazy={() => import('../shared/Files/Preview/index.jsx')}
/>
<Route path=":fileId">
<Route
path="*"
lazy={() => import('../shared/Files/Preview/index.jsx')}
/>
<Route
path="Vorschau"
lazy={() => import('../shared/Files/Preview/index.jsx')}
/>
</Route>
</Route>
<Route
path="Historien"
Expand Down Expand Up @@ -394,10 +400,16 @@ export const Router = () => {
index={true}
lazy={() => import('../shared/Files/Files/index.jsx')}
/>
<Route
path=":fileId/Vorschau"
lazy={() => import('../shared/Files/Preview/index.jsx')}
/>
<Route path=":fileId">
<Route
index={true}
lazy={() => import('../shared/Files/Preview/index.jsx')}
/>
<Route
path="Vorschau"
lazy={() => import('../shared/Files/Preview/index.jsx')}
/>
</Route>
</Route>
<Route
path="Historien"
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/Files/Menu/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const Menu = memo(
const { fileId } = useParams()
const navigate = useNavigate()
const { pathname } = useLocation()
const isPreview = pathname.endsWith('Vorschau')
const isPreview = pathname.endsWith('Vorschau') || pathname.includes(fileId)
const client = useApolloClient()
const uploaderCtx = useContext(UploaderContext)
const api = uploaderCtx?.current?.getAPI?.()
Expand Down

0 comments on commit 18237ad

Please sign in to comment.