"use client"; import { FC } from "react"; import { observer } from "mobx-react-lite"; import { useRouter, useSearchParams } from "next/navigation"; // ui import { Tooltip } from "@plane/ui"; // constants import { ISSUE_LAYOUTS } from "@/constants/issue"; // helpers import { queryParamGenerator } from "@/helpers/query-param-generator"; // hooks import { useIssueFilter } from "@/hooks/store"; // mobx import { TIssueLayout } from "@/types/issue"; type Props = { anchor: string; }; export const IssuesLayoutSelection: FC = observer((props) => { const { anchor } = props; // router const router = useRouter(); const searchParams = useSearchParams(); // query params const labels = searchParams.get("labels"); const state = searchParams.get("state"); const priority = searchParams.get("priority"); const peekId = searchParams.get("peekId"); // hooks const { layoutOptions, getIssueFilters, updateIssueFilters } = useIssueFilter(); // derived values const issueFilters = getIssueFilters(anchor); const activeLayout = issueFilters?.display_filters?.layout || undefined; const handleCurrentBoardView = (boardView: TIssueLayout) => { updateIssueFilters(anchor, "display_filters", "layout", boardView); const { queryParam } = queryParamGenerator({ board: boardView, peekId, priority, state, labels }); router.push(`/issues/${anchor}?${queryParam}`); }; return (
{ISSUE_LAYOUTS.map((layout) => { if (!layoutOptions[layout.key]) return; return ( ); })}
); });