Merge pull request #435 from makeplane/sync/ce-ee

sync: community changes
This commit is contained in:
Satish Gandham
2024-06-18 17:55:02 +05:30
committed by GitHub
15 changed files with 61 additions and 77 deletions

View File

@@ -1,4 +1,4 @@
import { IStateLite, IWorkspaceLite, TIssuePriorities, TStateGroups } from "@plane/types";
import { IStateLite, IWorkspaceLite, TIssue, TIssuePriorities, TStateGroups } from "@plane/types";
export type TIssueLayout = "list" | "kanban" | "calendar" | "spreadsheet" | "gantt";
export type TIssueLayoutOptions = {
@@ -39,18 +39,13 @@ export type TIssuesResponse = {
issues: IIssue[];
};
export interface IIssue {
id: string;
export interface IIssue
extends Pick<TIssue, "description_html" | "id" | "name" | "priority" | "sequence_id" | "start_date" | "target_date"> {
comments: Comment[];
description_html: string;
label_details: any;
name: string;
priority: TIssuePriorityKey | null;
project: string;
project_detail: any;
reactions: IIssueReaction[];
sequence_id: number;
start_date: any;
state: string;
state_detail: {
id: string;
@@ -58,7 +53,6 @@ export interface IIssue {
group: TIssueGroupKey;
color: string;
};
target_date: any;
votes: IVote[];
}

View File

@@ -1,18 +0,0 @@
import { TLogoProps } from "@plane/types";
export type TViewDetails = {
list: boolean;
gantt: boolean;
kanban: boolean;
calendar: boolean;
spreadsheet: boolean;
};
export type TProjectDetails = {
id: string;
identifier: string;
name: string;
cover_image: string | undefined;
logo_props: TLogoProps;
description: string;
};

View File

@@ -10,11 +10,13 @@ import { TLogoProps } from "@plane/types";
import { Breadcrumbs, Button, EmojiIconPicker, EmojiIconPickerTypes, TOAST_TYPE, setToast } from "@plane/ui";
// components
import { BreadcrumbLink, Logo } from "@/components/common";
// helper
// helpers
import { convertHexEmojiToDecimal } from "@/helpers/emoji.helper";
// hooks
import { usePage, useProject } from "@/hooks/store";
import { usePlatformOS } from "@/hooks/use-platform-os";
// plane web components
import { PageDetailsHeaderExtraActions } from "@/plane-web/components/pages";
export interface IPagesHeaderProps {
showButton?: boolean;
@@ -28,6 +30,10 @@ export const PageDetailsHeader = observer(() => {
// store hooks
const { currentProjectDetails } = useProject();
const { isContentEditable, isSubmitting, name, logo_props, updatePageLogo } = usePage(pageId?.toString() ?? "");
// use platform
const { platform } = usePlatformOS();
// derived values
const isMac = platform === "MacOS";
const handlePageLogoUpdate = async (data: TLogoProps) => {
if (data) {
@@ -48,10 +54,6 @@ export const PageDetailsHeader = observer(() => {
});
}
};
// use platform
const { platform } = usePlatformOS();
// derived values
const isMac = platform === "MacOS";
return (
<div className="relative z-10 flex h-[3.75rem] w-full flex-shrink-0 flex-row items-center justify-between gap-x-2 gap-y-4 bg-custom-sidebar-background-100 p-4">
@@ -146,6 +148,7 @@ export const PageDetailsHeader = observer(() => {
</Breadcrumbs>
</div>
</div>
<PageDetailsHeaderExtraActions />
{isContentEditable && (
<Button
variant="primary"
@@ -159,7 +162,7 @@ export const PageDetailsHeader = observer(() => {
});
window.dispatchEvent(event);
}}
className="flex-shrink-0"
className="flex-shrink-0 w-24"
loading={isSubmitting === "submitting"}
>
{isSubmitting === "submitting" ? "Saving" : "Save changes"}

View File

@@ -0,0 +1 @@
export const PageDetailsHeaderExtraActions = () => null;

View File

@@ -0,0 +1 @@
export * from "./extra-actions";

View File

@@ -11,7 +11,6 @@ export const ArchiveTabsList: FC = observer(() => {
// router
const { workspaceSlug, projectId } = useParams();
const pathname = usePathname();
const activeTab = pathname.split("/").pop();
// store hooks
const { getProjectById } = useProject();
@@ -28,7 +27,7 @@ export const ArchiveTabsList: FC = observer(() => {
<Link key={tab.key} href={`/${workspaceSlug}/projects/${projectId}/archives/${tab.key}`}>
<span
className={`flex min-w-min flex-shrink-0 whitespace-nowrap border-b-2 py-3 px-4 text-sm font-medium outline-none ${
tab.key === activeTab
pathname.includes(tab.key)
? "border-custom-primary-100 text-custom-primary-100"
: "border-transparent hover:border-custom-border-200 text-custom-text-300 hover:text-custom-text-400"
}`}

View File

@@ -8,6 +8,7 @@ import { Loader } from "@plane/ui";
import { IGanttBlock, IBlockUpdateData } from "@/components/gantt-chart/types";
//hooks
import { useIntersectionObserver } from "@/hooks/use-intersection-observer";
import { useIssuesStore } from "@/hooks/use-issue-layout-store";
import { TSelectionHelper } from "@/hooks/use-multiple-select";
import { GanttDnDHOC } from "../gantt-dnd-HOC";
import { handleOrderChange } from "../utils";
@@ -41,9 +42,20 @@ export const IssueGanttSidebar: React.FC<Props> = observer((props) => {
selectionHelpers,
} = props;
const {
issues: { getIssueLoader },
} = useIssuesStore();
const [intersectionElement, setIntersectionElement] = useState<HTMLDivElement | null>(null);
useIntersectionObserver(ganttContainerRef, intersectionElement, loadMoreBlocks, "50% 0% 50% 0%");
const isPaginating = !!getIssueLoader();
useIntersectionObserver(
ganttContainerRef,
isPaginating ? null : intersectionElement,
loadMoreBlocks,
"50% 0% 50% 0%"
);
const handleOnDrop = (
draggingBlockId: string | undefined,

View File

@@ -17,7 +17,6 @@ import { EInboxIssueCurrentTab } from "@/helpers/inbox.helper";
import { useProject, useProjectInbox } from "@/hooks/store";
import { useAppRouter } from "@/hooks/use-app-router";
import { useIntersectionObserver } from "@/hooks/use-intersection-observer";
import { useIssuesStore } from "@/hooks/use-issue-layout-store";
type IInboxSidebarProps = {
workspaceSlug: string;
@@ -52,9 +51,6 @@ export const InboxSidebar: FC<IInboxSidebarProps> = observer((props) => {
fetchInboxPaginationIssues,
getAppliedFiltersCount,
} = useProjectInbox();
const {
issues: { getIssueLoader },
} = useIssuesStore();
const router = useAppRouter();
@@ -63,10 +59,8 @@ export const InboxSidebar: FC<IInboxSidebarProps> = observer((props) => {
fetchInboxPaginationIssues(workspaceSlug.toString(), projectId.toString());
}, [workspaceSlug, projectId, fetchInboxPaginationIssues]);
const isPaginating = !!getIssueLoader();
// page observer
useIntersectionObserver(containerRef, isPaginating ? null : elementRef, fetchNextPages, "20%");
useIntersectionObserver(containerRef, elementRef, fetchNextPages, "20%");
return (
<div className="bg-custom-background-100 flex-shrink-0 w-full h-full border-r border-custom-border-300 ">

View File

@@ -264,7 +264,7 @@ export const SIDEBAR_MENU_ITEMS: {
label: "Home",
href: ``,
access: EUserWorkspaceRoles.GUEST,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/`,
Icon: Home,
},
{
@@ -272,7 +272,7 @@ export const SIDEBAR_MENU_ITEMS: {
label: "Analytics",
href: `/analytics`,
access: EUserWorkspaceRoles.MEMBER,
highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/analytics`),
highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/analytics/`),
Icon: BarChart2,
},
{
@@ -280,7 +280,7 @@ export const SIDEBAR_MENU_ITEMS: {
label: "Projects",
href: `/projects`,
access: EUserWorkspaceRoles.GUEST,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/projects`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/projects/`,
Icon: Briefcase,
},
{
@@ -288,7 +288,7 @@ export const SIDEBAR_MENU_ITEMS: {
label: "All Issues",
href: `/workspace-views/all-issues`,
access: EUserWorkspaceRoles.GUEST,
highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/workspace-views`),
highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/workspace-views/`),
Icon: CheckCircle,
},
{
@@ -296,7 +296,7 @@ export const SIDEBAR_MENU_ITEMS: {
label: "Active Cycles",
href: `/active-cycles`,
access: EUserWorkspaceRoles.GUEST,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/active-cycles`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/active-cycles/`,
Icon: ContrastIcon,
},
];

View File

@@ -13,21 +13,21 @@ export const PROFILE_ACTION_LINKS: {
key: "profile",
label: "Profile",
href: `/profile`,
highlight: (pathname: string) => pathname === "/profile",
highlight: (pathname: string) => pathname === "/profile/",
Icon: CircleUser,
},
{
key: "security",
label: "Security",
href: `/profile/security`,
highlight: (pathname: string) => pathname === "/profile/security",
highlight: (pathname: string) => pathname === "/profile/security/",
Icon: KeyRound,
},
{
key: "activity",
label: "Activity",
href: `/profile/activity`,
highlight: (pathname: string) => pathname === "/profile/activity",
highlight: (pathname: string) => pathname === "/profile/activity/",
Icon: Activity,
},
{
@@ -41,7 +41,7 @@ export const PROFILE_ACTION_LINKS: {
key: "notifications",
label: "Notifications",
href: `/profile/notifications`,
highlight: (pathname: string) => pathname === "/profile/notifications",
highlight: (pathname: string) => pathname === "/profile/notifications/",
Icon: Bell,
},
];

View File

@@ -80,7 +80,7 @@ export const PROJECT_SETTINGS_LINKS: {
label: "General",
href: `/settings`,
access: EUserProjectRoles.MEMBER,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/`,
Icon: SettingIcon,
},
{
@@ -88,7 +88,7 @@ export const PROJECT_SETTINGS_LINKS: {
label: "Members",
href: `/settings/members`,
access: EUserProjectRoles.MEMBER,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/members`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/members/`,
Icon: SettingIcon,
},
{
@@ -96,7 +96,7 @@ export const PROJECT_SETTINGS_LINKS: {
label: "Features",
href: `/settings/features`,
access: EUserProjectRoles.ADMIN,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/features`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/features/`,
Icon: SettingIcon,
},
{
@@ -104,7 +104,7 @@ export const PROJECT_SETTINGS_LINKS: {
label: "States",
href: `/settings/states`,
access: EUserProjectRoles.MEMBER,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/states`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/states/`,
Icon: SettingIcon,
},
{
@@ -112,7 +112,7 @@ export const PROJECT_SETTINGS_LINKS: {
label: "Labels",
href: `/settings/labels`,
access: EUserProjectRoles.MEMBER,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/labels`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/labels/`,
Icon: SettingIcon,
},
{
@@ -128,7 +128,7 @@ export const PROJECT_SETTINGS_LINKS: {
label: "Estimates",
href: `/settings/estimates`,
access: EUserProjectRoles.ADMIN,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/estimates`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/estimates/`,
Icon: SettingIcon,
},
{
@@ -136,7 +136,7 @@ export const PROJECT_SETTINGS_LINKS: {
label: "Automations",
href: `/settings/automations`,
access: EUserProjectRoles.ADMIN,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/automations`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/automations/`,
Icon: SettingIcon,
},
];

View File

@@ -149,7 +149,7 @@ export const WORKSPACE_SETTINGS_LINKS: {
label: "General",
href: `/settings`,
access: EUserWorkspaceRoles.GUEST,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/`,
Icon: SettingIcon,
},
{
@@ -157,7 +157,7 @@ export const WORKSPACE_SETTINGS_LINKS: {
label: "Members",
href: `/settings/members`,
access: EUserWorkspaceRoles.GUEST,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/members`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/members/`,
Icon: SettingIcon,
},
{
@@ -165,7 +165,7 @@ export const WORKSPACE_SETTINGS_LINKS: {
label: "Billing and plans",
href: `/settings/billing`,
access: EUserWorkspaceRoles.ADMIN,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/billing`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/billing/`,
Icon: SettingIcon,
},
{
@@ -189,7 +189,7 @@ export const WORKSPACE_SETTINGS_LINKS: {
label: "Exports",
href: `/settings/exports`,
access: EUserWorkspaceRoles.MEMBER,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/exports`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/exports/`,
Icon: SettingIcon,
},
{
@@ -197,7 +197,7 @@ export const WORKSPACE_SETTINGS_LINKS: {
label: "Webhooks",
href: `/settings/webhooks`,
access: EUserWorkspaceRoles.ADMIN,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/webhooks`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/webhooks/`,
Icon: SettingIcon,
},
{
@@ -205,7 +205,7 @@ export const WORKSPACE_SETTINGS_LINKS: {
label: "API tokens",
href: `/settings/api-tokens`,
access: EUserWorkspaceRoles.ADMIN,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/api-tokens`,
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/settings/api-tokens/`,
Icon: SettingIcon,
},
];

View File

@@ -299,23 +299,19 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
getIssueIds = (groupId?: string, subGroupId?: string) => {
const groupedIssueIds = this.groupedIssueIds;
const displayFilters = this.issueFilterStore?.issueFilters?.displayFilters;
if (!displayFilters || !groupedIssueIds) return undefined;
if (!groupedIssueIds) return undefined;
const subGroupBy = displayFilters?.sub_group_by;
const groupBy = displayFilters?.group_by;
const allIssues = groupedIssueIds[ALL_ISSUES];
if (!groupBy && !subGroupBy && allIssues && Array.isArray(allIssues)) {
const allIssues = groupedIssueIds[ALL_ISSUES] ?? [];
if (!this.groupBy && !this.subGroupBy && allIssues && Array.isArray(allIssues)) {
return allIssues as string[];
}
if (groupBy && groupId && groupedIssueIds?.[groupId] && Array.isArray(groupedIssueIds[groupId])) {
return groupedIssueIds[groupId] as string[];
if (this.groupBy && groupId && groupedIssueIds?.[groupId] && Array.isArray(groupedIssueIds[groupId])) {
return (groupedIssueIds[groupId] ?? []) as string[];
}
if (groupBy && subGroupBy && groupId && subGroupId) {
return (groupedIssueIds as TSubGroupedIssues)?.[groupId]?.[subGroupId] as string[];
if (this.groupBy && this.subGroupBy && groupId && subGroupId) {
return ((groupedIssueIds as TSubGroupedIssues)[groupId]?.[subGroupId] ?? []) as string[];
}
return undefined;

View File

@@ -0,0 +1 @@
export * from "ce/components/pages/extra-actions";

View File

@@ -1,5 +1,6 @@
export * from "./extra-actions";
export * from "./dashboard";
export * from "./editor";
export * from "./list";
export * from "./modals";
export * from "./sidebar";
export * from "./sidebar";