2024-04-17 12:50:02 +00:00
|
|
|
import { ReactElement, useEffect, useRef } from "react";
|
|
|
|
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
|
|
import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
2024-02-20 08:06:38 +00:00
|
|
|
import { observer } from "mobx-react";
|
2022-12-20 10:35:21 +00:00
|
|
|
// layouts
|
2024-03-19 14:38:35 +00:00
|
|
|
import { PageHead } from "@/components/core";
|
|
|
|
import { ProjectSettingHeader } from "@/components/headers";
|
|
|
|
import { ProjectSettingsLabelList } from "@/components/labels";
|
|
|
|
import { useProject } from "@/hooks/store";
|
|
|
|
import { AppLayout } from "@/layouts/app-layout";
|
|
|
|
import { ProjectSettingLayout } from "@/layouts/settings-layout";
|
2022-12-20 10:35:21 +00:00
|
|
|
// components
|
|
|
|
// types
|
2024-03-19 14:38:35 +00:00
|
|
|
import { NextPageWithLayout } from "@/lib/types";
|
2024-02-20 08:06:38 +00:00
|
|
|
// hooks
|
2023-10-25 10:18:57 +00:00
|
|
|
|
2024-02-20 08:06:38 +00:00
|
|
|
const LabelsSettingsPage: NextPageWithLayout = observer(() => {
|
|
|
|
const { currentProjectDetails } = useProject();
|
|
|
|
const pageTitle = currentProjectDetails?.name ? `${currentProjectDetails?.name} - Labels` : undefined;
|
|
|
|
|
2024-04-17 12:50:02 +00:00
|
|
|
const scrollableContainerRef = useRef<HTMLDivElement | null>(null);
|
|
|
|
|
|
|
|
// Enable Auto Scroll for Labels list
|
|
|
|
useEffect(() => {
|
|
|
|
const element = scrollableContainerRef.current;
|
|
|
|
|
|
|
|
if (!element) return;
|
|
|
|
|
|
|
|
return combine(
|
|
|
|
autoScrollForElements({
|
|
|
|
element,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}, [scrollableContainerRef?.current]);
|
|
|
|
|
2024-02-20 08:06:38 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<PageHead title={pageTitle} />
|
2024-04-17 12:50:02 +00:00
|
|
|
<div ref={scrollableContainerRef} className="h-full w-full gap-10 overflow-y-auto py-8 pr-9">
|
2024-02-20 08:06:38 +00:00
|
|
|
<ProjectSettingsLabelList />
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
});
|
2022-12-06 14:38:28 +00:00
|
|
|
|
2023-11-02 18:27:44 +00:00
|
|
|
LabelsSettingsPage.getLayout = function getLayout(page: ReactElement) {
|
|
|
|
return (
|
2024-05-24 08:50:56 +00:00
|
|
|
<AppLayout withProjectWrapper header={<ProjectSettingHeader />}>
|
2023-11-02 18:27:44 +00:00
|
|
|
<ProjectSettingLayout>{page}</ProjectSettingLayout>
|
|
|
|
</AppLayout>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default LabelsSettingsPage;
|