Commit 908b255a authored by Adam Parák's avatar Adam Parák 💬
Browse files

Merge branch 'simplify-pages-dir' into 'master'

Simplify `pages/` directory

See merge request inject/frontend!181
parents 00eb4495 fdbaa097
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
import NavbarView from '@/views/NavbarView'
import { Outlet } from 'react-router-dom'

const Layout = () => (
  <NavbarView>
    <Outlet />
  </NavbarView>
)

export default Layout
+10 −4
Original line number Diff line number Diff line
@@ -2,14 +2,20 @@ import DefinitionManager from '@/exercisepanel/DefinitionManager'
import ExerciseManager from '@/exercisepanel/ExerciseManager'
import { useSetPageTitle } from '@/utils'
import GitVersion from '@/components/GitVersion'
import Container from '@inject/shared/components/Container'
import useDefaultNavigation from '@/views/useDefaultNavigation'

const ExercisePanel = () => {
  useSetPageTitle('Admin Panel')
  useDefaultNavigation()

  return (
    <div>
    <div style={{ padding: '1rem' }}>
      <Container>
        <DefinitionManager />
        <ExerciseManager />
        <GitVersion />
      </Container>
    </div>
  )
}
+10 −0
Original line number Diff line number Diff line
import OverlayView from '@/views/OverlayView'
import { Outlet } from 'react-router-dom'

const Layout = () => (
  <OverlayView>
    <Outlet />
  </OverlayView>
)

export default Layout
+38 −0
Original line number Diff line number Diff line
// eslint-disable-next-line consistent-default-export-name/default-import-match-filename
import InjectLogo from '@/assets/inject-logo--vertical-black.svg?react'
import Container from '@inject/shared/components/Container'
import TeamSelector from '@/logic/TeamSelector'
import { useSetPageTitle } from '@/utils'
import useDefaultNavigation from '@/views/useDefaultNavigation'

const Index = () => {
  useSetPageTitle('Team Selection')
  useDefaultNavigation()

  return (
    <div className='DashboardOverlay'>
      <main className='DashboardOverlay__generic'>
        <Container>
          <InjectLogo
            style={{
              width: '100%',
              height: '300px',
              margin: 'auto',
            }}
          />
          <h1>Welcome to INJECT – Tabletop Exercise Platform!</h1>
          <p>
            Embark on a journey of strategic crisis management and incident
            response. Our scenarios will enhance your skills and team
            collaboration to boost the resilience of your organization.
          </p>
          <h2>Choose your team to start your exercise</h2>
          <TeamSelector />
          <div style={{ height: '100px' }} />
        </Container>
      </main>
    </div>
  )
}

export default Index
+2 −39
Original line number Diff line number Diff line
import { Outlet, useLocation } from 'react-router-dom'
import useApolloHealthStatus from '@inject/graphql/utils/useApolloHealthStatus'
import NavbarView from '@/views/NavbarView'
import TraineeView from '@/views/TraineeView'
import OverlayView from '@/views/OverlayView'
import InstructorView from '@/views/InstructorView'
import { useNotifyContext } from '@inject/shared/notification/contexts/NotifyContext'
import { Outlet } from 'react-router-dom'

const LocalLayout = () => {
  const { notify } = useNotifyContext()
  useApolloHealthStatus({ notify })

  const loc = useLocation().pathname

  if (loc.startsWith('/team')) {
    return (
      <TraineeView>
        <Outlet />
      </TraineeView>
    )
  }
  if (loc.startsWith('/instructor')) {
    return (
      <InstructorView>
        <Outlet />
      </InstructorView>
    )
  }
  if (loc.startsWith('/dashboard')) {
  return <Outlet />
}
  if (loc.startsWith('/file')) {
    return <Outlet />
  }
  if (loc === '/') {
    return (
      <OverlayView>
        <Outlet />
      </OverlayView>
    )
  }
  return (
    <NavbarView>
      <Outlet />
    </NavbarView>
  )
}

export default LocalLayout
Loading