diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-09-14 23:02:46 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-09-20 16:07:05 +0200 |
| commit | 9dd75a9a40f7f2aebbc617980c99085f9dc688f8 (patch) | |
| tree | 12b9fc2ef1b864c5773b78fe102f789508af7716 /opendc-web/opendc-web-ui/src/components/context/ProjectSelector.js | |
| parent | d2c0b9c038f5cbcb2b1528d4cb22b862309bd99a (diff) | |
refactor(web/ui): Move project selector into masthead
This change moves the project selector into the masthead since it
affects the whole application. This follows the PatternFly guidelines.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/context/ProjectSelector.js')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/components/context/ProjectSelector.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/context/ProjectSelector.js b/opendc-web/opendc-web-ui/src/components/context/ProjectSelector.js index 7721e04c..5f47c798 100644 --- a/opendc-web/opendc-web-ui/src/components/context/ProjectSelector.js +++ b/opendc-web/opendc-web-ui/src/components/context/ProjectSelector.js @@ -22,14 +22,16 @@ import { useRouter } from 'next/router' import { useState } from 'react' -import { useProjects } from '../../data/project' +import { useProjects, useProject } from '../../data/project' import { Project } from '../../shapes' import ContextSelector from './ContextSelector' -function ProjectSelector({ activeProject }) { +function ProjectSelector() { const router = useRouter() + const projectId = +router.query['project'] const [isOpen, setOpen] = useState(false) + const { data: activeProject } = useProject(+projectId) const { data: projects = [] } = useProjects({ enabled: isOpen }) return ( @@ -40,6 +42,8 @@ function ProjectSelector({ activeProject }) { onSelect={(project) => router.push(`/projects/${project.id}`)} onToggle={setOpen} isOpen={isOpen} + isFullHeight + type="app" /> ) } |
