Some checks failed
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Admin Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Codespell / Check for spelling errors (push) Has been cancelled
Sync Repositories / sync_changes (push) Has been cancelled
Synced from upstream: 8853637e981ed7d8a6cff32bd98e7afe20f54362
67 lines
2.2 KiB
TypeScript
67 lines
2.2 KiB
TypeScript
"use client";
|
|
|
|
import { observer } from "mobx-react";
|
|
import { Outlet } from "react-router";
|
|
import useSWR from "swr";
|
|
// components
|
|
import { LogoSpinner } from "@/components/common/logo-spinner";
|
|
import { PoweredBy } from "@/components/common/powered-by";
|
|
import { SomethingWentWrongError } from "@/components/issues/issue-layouts/error";
|
|
import { IssuesNavbarRoot } from "@/components/issues/navbar";
|
|
// hooks
|
|
import { usePublish, usePublishList } from "@/hooks/store/publish";
|
|
import { useIssueFilter } from "@/hooks/store/use-issue-filter";
|
|
import type { Route } from "./+types/client-layout";
|
|
|
|
const IssuesClientLayout = observer((props: Route.ComponentProps) => {
|
|
const { anchor } = props.params;
|
|
// store hooks
|
|
const { fetchPublishSettings } = usePublishList();
|
|
const publishSettings = usePublish(anchor);
|
|
const { updateLayoutOptions } = useIssueFilter();
|
|
// fetch publish settings
|
|
const { error } = useSWR(
|
|
anchor ? `PUBLISH_SETTINGS_${anchor}` : null,
|
|
anchor
|
|
? async () => {
|
|
const response = await fetchPublishSettings(anchor);
|
|
if (response.view_props) {
|
|
updateLayoutOptions({
|
|
list: !!response.view_props.list,
|
|
kanban: !!response.view_props.kanban,
|
|
calendar: !!response.view_props.calendar,
|
|
gantt: !!response.view_props.gantt,
|
|
spreadsheet: !!response.view_props.spreadsheet,
|
|
});
|
|
}
|
|
}
|
|
: null
|
|
);
|
|
|
|
if (!publishSettings && !error) {
|
|
return (
|
|
<div className="flex items-center justify-center h-screen w-full">
|
|
<LogoSpinner />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (error) return <SomethingWentWrongError />;
|
|
|
|
return (
|
|
<>
|
|
<div className="relative flex h-screen min-h-[500px] w-screen flex-col overflow-hidden">
|
|
<div className="relative flex h-[60px] flex-shrink-0 select-none items-center border-b border-custom-border-300 bg-custom-sidebar-background-100">
|
|
<IssuesNavbarRoot publishSettings={publishSettings} />
|
|
</div>
|
|
<div className="relative h-full w-full overflow-hidden bg-custom-background-90">
|
|
<Outlet />
|
|
</div>
|
|
</div>
|
|
<PoweredBy />
|
|
</>
|
|
);
|
|
});
|
|
|
|
export default IssuesClientLayout;
|