mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
switch between issues and timeline pages
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
|
import { useLocation, useNavigate } from "react-router-dom";
|
||||||
import Account from "@/components/account";
|
import Account from "@/components/account";
|
||||||
import { IssueForm } from "@/components/issue-form";
|
import { IssueForm } from "@/components/issue-form";
|
||||||
import LogOutButton from "@/components/log-out-button";
|
import LogOutButton from "@/components/log-out-button";
|
||||||
@@ -20,6 +21,7 @@ import {
|
|||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
import Icon from "@/components/ui/icon";
|
import Icon from "@/components/ui/icon";
|
||||||
import { IconButton } from "@/components/ui/icon-button";
|
import { IconButton } from "@/components/ui/icon-button";
|
||||||
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { BREATHING_ROOM } from "@/lib/layout";
|
import { BREATHING_ROOM } from "@/lib/layout";
|
||||||
import { useOrganisations } from "@/lib/query/hooks";
|
import { useOrganisations } from "@/lib/query/hooks";
|
||||||
|
|
||||||
@@ -27,6 +29,9 @@ export default function TopBar({ showIssueForm = true }: { showIssueForm?: boole
|
|||||||
const { user } = useAuthenticatedSession();
|
const { user } = useAuthenticatedSession();
|
||||||
const { selectedOrganisationId, selectedProjectId } = useSelection();
|
const { selectedOrganisationId, selectedProjectId } = useSelection();
|
||||||
const { data: organisationsData = [] } = useOrganisations();
|
const { data: organisationsData = [] } = useOrganisations();
|
||||||
|
const location = useLocation();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const activeView = location.pathname.startsWith("/timeline") ? "timeline" : "issues";
|
||||||
|
|
||||||
const selectedOrganisation = useMemo(
|
const selectedOrganisation = useMemo(
|
||||||
() => organisationsData.find((org) => org.Organisation.id === selectedOrganisationId) ?? null,
|
() => organisationsData.find((org) => org.Organisation.id === selectedOrganisationId) ?? null,
|
||||||
@@ -50,6 +55,14 @@ export default function TopBar({ showIssueForm = true }: { showIssueForm?: boole
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{selectedOrganisationId && <ProjectSelect showLabel />}
|
{selectedOrganisationId && <ProjectSelect showLabel />}
|
||||||
|
{selectedOrganisationId && (
|
||||||
|
<Tabs value={activeView} onValueChange={(value) => navigate(`/${value}`)}>
|
||||||
|
<TabsList>
|
||||||
|
<TabsTrigger value="issues">Issues</TabsTrigger>
|
||||||
|
<TabsTrigger value="timeline">Timeline</TabsTrigger>
|
||||||
|
</TabsList>
|
||||||
|
</Tabs>
|
||||||
|
)}
|
||||||
{selectedOrganisationId && selectedProjectId && showIssueForm && (
|
{selectedOrganisationId && selectedProjectId && showIssueForm && (
|
||||||
<IssueForm
|
<IssueForm
|
||||||
trigger={
|
trigger={
|
||||||
|
|||||||
Reference in New Issue
Block a user