ucsb-cs156-f24 / team02-f24-16

https://ucsb-cs156-f24.github.io/team02-f24-16/
0 stars 0 forks source link

Copy Placeholders for `UCSBOrganization` pages; add to App.js/AppNavbar.js #21

Open github-actions[bot] opened 6 days ago

github-actions[bot] commented 6 days ago

Dependencies

None: can be done in parallel with other issues

Discussion

In this issue, you'll set up placeholders for the three pages you are adding to the app.

These placeholder components are temporary, but they are necessary so that you can add routes to the pages in frontend/src/App.js and add a link to the /ucsborganization name in to the Navigation Bar of the app in frontend/src/components/AppNavbar.js.

Note that the contents of the placeholder pages and tests are temporary, and will be replaced in a later issue. However, the changes you make in App.js and AppNavbar.js will be permanent.

The reason for the placeholder code is that we can't really test the changes to App.js and AppNavbar.js until at least some placeholder component for the pages exists, and we can't really test the new pages unless they are routed to in the app. The placeholder solves this "chicken/egg" problem.

Acceptance Criteria

Implementation Steps

Notes

The changes you will need to make from the examples are minimal.

In the three page components, typically you will only need to change the name of the default export, changing Placeholder to UCSBOrganization

export default function PlaceholderCreatePage() {

In App.js, you will need to:

{
      hasRole(currentUser, "ROLE_USER") && (
        <>
          <Route exact path="/restaurants" element={<RestaurantIndexPage />} />
        </>
      )
}
{
      hasRole(currentUser, "ROLE_ADMIN") && (
        <>
          <Route exact path="/restaurants/edit/:id" element={<RestaurantEditPage />} />
          <Route exact path="/restaurants/create" element={<RestaurantCreatePage />} />
        </>
      )
}

In AppNavbar.js, copy/paste this section of code, and change /restaurants to /ucsborganization and Restaurants to UCSBOrganization:

{
      hasRole(currentUser, "ROLE_USER") && (
        <>
          <Nav.Link as={NavLink} to="/restaurants">Restaurants</Nav.Link>
        </>
      )
}

Reminders (all from frontend directory):

What to do next