From 61b7f4210eb34c6a265e0fd647ee1dd68dbec41d Mon Sep 17 00:00:00 2001 From: Oliver Bryan <04oliverbryan@gmail.com> Date: Wed, 21 Jan 2026 12:04:20 +0000 Subject: [PATCH] new org select on app page --- .../src/components/organisation-select.tsx | 17 ++++++- packages/frontend/src/pages/App.tsx | 44 ++++++++++++++----- 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/packages/frontend/src/components/organisation-select.tsx b/packages/frontend/src/components/organisation-select.tsx index 9b0ba41..af642f5 100644 --- a/packages/frontend/src/components/organisation-select.tsx +++ b/packages/frontend/src/components/organisation-select.tsx @@ -14,6 +14,7 @@ import { SelectValue, } from "@/components/ui/select"; import { useOrganisations } from "@/lib/query/hooks"; +import { cn } from "@/lib/utils"; export function OrganisationSelect({ placeholder = "Select Organisation", @@ -21,12 +22,18 @@ export function OrganisationSelect({ showLabel = false, label = "Organisation", labelPosition = "top", + triggerClassName, + noDecoration, + trigger, }: { placeholder?: string; contentClass?: string; showLabel?: boolean; label?: string; labelPosition?: "top" | "bottom"; + triggerClassName?: string; + noDecoration?: boolean; + trigger?: React.ReactNode; }) { const [open, setOpen] = useState(false); const [pendingOrganisationId, setPendingOrganisationId] = useState(null); @@ -66,13 +73,19 @@ export function OrganisationSelect({ onOpenChange={setOpen} > - + {trigger ? trigger : } diff --git a/packages/frontend/src/pages/App.tsx b/packages/frontend/src/pages/App.tsx index 084abeb..a197879 100644 --- a/packages/frontend/src/pages/App.tsx +++ b/packages/frontend/src/pages/App.tsx @@ -7,6 +7,7 @@ import { IssueDetailPane } from "@/components/issue-detail-pane"; import { IssueModal } from "@/components/issue-modal"; import { IssuesTable } from "@/components/issues-table"; import LogOutButton from "@/components/log-out-button"; +import OrgIcon from "@/components/org-icon"; import { OrganisationSelect } from "@/components/organisation-select"; import OrganisationsDialog from "@/components/organisations-dialog"; import { ProjectSelect } from "@/components/project-select"; @@ -23,6 +24,8 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; +import Icon from "@/components/ui/icon"; +import { IconButton } from "@/components/ui/icon-button"; import { ResizablePanel, ResizablePanelGroup, ResizableSeparator } from "@/components/ui/resizable"; import { useIssues, useOrganisations, useProjects, useSelectedIssue } from "@/lib/query/hooks"; @@ -76,7 +79,7 @@ export default function App() { const findProjectByKey = (key: string) => projects.find((project) => project.Project.key.toLowerCase() === key) ?? null; - const deepLinkActive = deepLinkParams.projectKey !== "" || deepLinkParams.issueNumber != null; + const deepLinkActive = deepLinkParams.projectKey !== "" || deepLinkParams.issueNumber != null; const deepLinkFlowRef = useRef({ stage: "idle" as "idle" | "org" | "project" | "issue" | "done", orgSlug: "", @@ -126,16 +129,16 @@ export default function App() { } }, [organisations, selectedOrganisationId, deepLinkActive, selectOrganisation]); - useEffect(() => { - if (projects.length === 0) return; - if (!deepLinkActive && selectedProjectId == null) { - selectProject(projects[0]); - return; - } + useEffect(() => { + if (projects.length === 0) return; + if (!deepLinkActive && selectedProjectId == null) { + selectProject(projects[0]); + return; + } - if (deepLinkActive) { - const flow = deepLinkFlowRef.current; - if (flow.stage !== "project") return; + if (deepLinkActive) { + const flow = deepLinkFlowRef.current; + if (flow.stage !== "project") return; if (flow.targetOrgId != null && selectedOrganisationId !== flow.targetOrgId) { return; } @@ -181,7 +184,26 @@ export default function App() {
- + org.Organisation.id === selectedOrganisationId, + )?.Organisation.name || "" + } + slug={ + organisations.find( + (org) => org.Organisation.id === selectedOrganisationId, + )?.Organisation.slug || "" + } + size={7} + className="hover:border hover:border-foreground/30" + /> + } + /> {selectedOrganisationId && } {selectedOrganisationId && selectedProjectId && }