From 504d6c717425491a117b26bad13a9d7089cb6211 Mon Sep 17 00:00:00 2001 From: Oliver Bryan <04oliverbryan@gmail.com> Date: Wed, 21 Jan 2026 16:42:24 +0000 Subject: [PATCH] moved top bar to its own component --- packages/frontend/src/components/top-bar.tsx | 102 +++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 packages/frontend/src/components/top-bar.tsx diff --git a/packages/frontend/src/components/top-bar.tsx b/packages/frontend/src/components/top-bar.tsx new file mode 100644 index 0000000..d81f839 --- /dev/null +++ b/packages/frontend/src/components/top-bar.tsx @@ -0,0 +1,102 @@ +import { useMemo } from "react"; +import Account from "@/components/account"; +import { IssueForm } from "@/components/issue-form"; +import LogOutButton from "@/components/log-out-button"; +import OrgIcon from "@/components/org-icon"; +import { OrganisationSelect } from "@/components/organisation-select"; +import Organisations from "@/components/organisations"; +import { ProjectSelect } from "@/components/project-select"; +import { useSelection } from "@/components/selection-provider"; +import { ServerConfiguration } from "@/components/server-configuration"; +import { useAuthenticatedSession } from "@/components/session-provider"; +import SmallUserDisplay from "@/components/small-user-display"; +import { Button } from "@/components/ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import Icon from "@/components/ui/icon"; +import { IconButton } from "@/components/ui/icon-button"; +import { BREATHING_ROOM } from "@/lib/layout"; +import { useOrganisations } from "@/lib/query/hooks"; + +export default function TopBar({ showIssueForm = true }: { showIssueForm?: boolean }) { + const { user } = useAuthenticatedSession(); + const { selectedOrganisationId, selectedProjectId } = useSelection(); + const { data: organisationsData = [] } = useOrganisations(); + + const selectedOrganisation = useMemo( + () => organisationsData.find((org) => org.Organisation.id === selectedOrganisationId) ?? null, + [organisationsData, selectedOrganisationId], + ); + + return ( +
+
+ + } + /> + + {selectedOrganisationId && } + {selectedOrganisationId && selectedProjectId && showIssueForm && ( + + + + } + /> + )} +
+
+ + + + + + + + + + + + + + Server Configuration + + } + /> + + + + + + + +
+
+ ); +}