Skip to content

Commit

Permalink
119 bug cant visit artifact without first visiting root (#281)
Browse files Browse the repository at this point in the history
* Dependency patch

* Switch to using hashRouter
  • Loading branch information
kjy5 authored Oct 1, 2023
1 parent f9cb0af commit 6875b38
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/ArtifactCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function ArtifactCard(props: {
// Render
return (
/* skipcq: JS-0394 */
<NavLink to={`/honors-portfolio/${id}`} className="artifact-card">
<NavLink to={`/${id}`} className="artifact-card">
<div className="artifact-card__graphic-container" id={id} />
<h1 className="artifact-card__title">{title}</h1>
<h3 className="artifact-card__subtitle">{subtitle}</h3>
Expand Down
8 changes: 4 additions & 4 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ import React from "react";
import ReactDOM from "react-dom/client";
import Root from "./routes/Root";
// eslint-disable-next-line sort-imports
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import { createHashRouter, RouterProvider } from "react-router-dom";
import Graphics from "./scripts/graphics";

// Parse data and return as an array of ArtifactPage objects
const artifacts: ArtifactData[] = ParseData();

// Create router
const router = createBrowserRouter([
const router = createHashRouter([
{
path: "/honors-portfolio/",
path: "/",
element: <Root />,
errorElement: <ErrorPage fromArtifact={false} />,
loader: () => artifacts,
},
{
path: "/honors-portfolio/:id",
path: ":id",
element: <ArtifactPage />,
errorElement: <ErrorPage fromArtifact />,
loader: ({ params }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/ArtifactPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function ArtifactPage(): ReactElement {
{/* skipcq: JS-0394 */}
<NavLink
className={"ArtifactPage__return"}
to={"/honors-portfolio"}
to={"/"}
tabIndex={0}
role="button"
>
Expand Down

0 comments on commit 6875b38

Please sign in to comment.