snapshot of https://github.com/makeplane/plane.git @ d868349a55de79979eb8b98701bf1702c67ad634 (2026-09-15)
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 16s
CodeQL / Analyze (python) (push) Failing after 3s
i18n sync check / check:sync (push) Failing after 3s
React Doctor / react-doctor (push) Failing after 16s
Branch Build CE / Build-Push Admin Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Admin Manifest (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Web Manifest (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Proxy Manifest (push) Has been cancelled
Branch Build CE / Merge Space Manifest (push) Has been cancelled
Branch Build CE / Prepare AIO Assets (push) Has been cancelled
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Live Collaboration Manifest (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge API Server Manifest (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge AIO Manifest (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 16s
CodeQL / Analyze (python) (push) Failing after 3s
i18n sync check / check:sync (push) Failing after 3s
React Doctor / react-doctor (push) Failing after 16s
Branch Build CE / Build-Push Admin Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Admin Manifest (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Web Manifest (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Proxy Manifest (push) Has been cancelled
Branch Build CE / Merge Space Manifest (push) Has been cancelled
Branch Build CE / Prepare AIO Assets (push) Has been cancelled
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Live Collaboration Manifest (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge API Server Manifest (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge AIO Manifest (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
This commit is contained in:
81
apps/web/core/components/empty-state/comic-box-button.tsx
Normal file
81
apps/web/core/components/empty-state/comic-box-button.tsx
Normal file
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
import type { Ref } from "react";
|
||||
import { Fragment, useState } from "react";
|
||||
import { usePopper } from "react-popper";
|
||||
import { Popover } from "@headlessui/react";
|
||||
// plane imports
|
||||
import { Button } from "@plane/propel/button";
|
||||
|
||||
type Props = {
|
||||
label: string;
|
||||
icon?: any;
|
||||
title: string | undefined;
|
||||
description: string | undefined;
|
||||
onClick?: () => void;
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
export function ComicBoxButton(props: Props) {
|
||||
const { label, icon, title, description, onClick, disabled = false } = props;
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
|
||||
const handleMouseEnter = () => {
|
||||
setIsHovered(true);
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
setIsHovered(false);
|
||||
};
|
||||
|
||||
const [referenceElement, setReferenceElement] = useState<HTMLButtonElement | null>(null);
|
||||
const [popperElement, setPopperElement] = useState<HTMLDivElement | null>();
|
||||
const { styles, attributes } = usePopper(referenceElement, popperElement, {
|
||||
placement: "right-end",
|
||||
modifiers: [
|
||||
{
|
||||
name: "offset",
|
||||
options: {
|
||||
offset: [0, 10],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
return (
|
||||
<Popover as="div" className="relative">
|
||||
<Popover.Button as={Fragment}>
|
||||
<Button variant="primary" size="lg" ref={setReferenceElement} onClick={onClick} disabled={disabled}>
|
||||
{icon}
|
||||
<span className="leading-4">{label}</span>
|
||||
<span className="relative h-2 w-2">
|
||||
<div
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
className={`bg-blue-300 absolute right-0 z-10 h-2.5 w-2.5 animate-ping rounded-full`}
|
||||
/>
|
||||
<div className={`bg-blue-400/40 absolute right-0 mt-0.5 mr-0.5 h-1.5 w-1.5 rounded-full`} />
|
||||
</span>
|
||||
</Button>
|
||||
</Popover.Button>
|
||||
{isHovered && (
|
||||
<Popover.Panel className="fixed z-10" static>
|
||||
<div
|
||||
className="relative flex w-52 flex-col overflow-hidden rounded-sm rounded-xl border border-subtle bg-layer-1 p-5 hover:bg-layer-1-hover lg:w-60 xl:w-80"
|
||||
ref={setPopperElement as Ref<HTMLDivElement>}
|
||||
style={styles.popper}
|
||||
{...attributes.popper}
|
||||
>
|
||||
<div className="rounded-lb-sm absolute bottom-2 -left-[5px] h-2 w-2 rotate-45 transform border border-t-0 border-r-0 border-subtle bg-surface-1" />
|
||||
<h3 className="w-full text-16 font-semibold">{title}</h3>
|
||||
<h4 className="mt-1 text-13">{description}</h4>
|
||||
</div>
|
||||
</Popover.Panel>
|
||||
)}
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
// ui
|
||||
import { Button } from "@plane/propel/button";
|
||||
// utils
|
||||
import { cn } from "@plane/utils";
|
||||
|
||||
type EmptyStateSize = "sm" | "base" | "lg";
|
||||
|
||||
type ButtonConfig = {
|
||||
text: string;
|
||||
prependIcon?: React.ReactElement;
|
||||
appendIcon?: React.ReactElement;
|
||||
onClick?: () => void;
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
type Props = {
|
||||
title: string;
|
||||
description?: string;
|
||||
assetPath?: string;
|
||||
size?: EmptyStateSize;
|
||||
primaryButton?: ButtonConfig;
|
||||
secondaryButton?: ButtonConfig;
|
||||
customPrimaryButton?: React.ReactNode;
|
||||
customSecondaryButton?: React.ReactNode;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
const sizeClasses = {
|
||||
sm: "md:min-w-[24rem] max-w-[45rem]",
|
||||
base: "md:min-w-[28rem] max-w-[50rem]",
|
||||
lg: "md:min-w-[30rem] max-w-[60rem]",
|
||||
} as const;
|
||||
|
||||
function CustomButton({
|
||||
config,
|
||||
variant,
|
||||
size,
|
||||
}: {
|
||||
config: ButtonConfig;
|
||||
variant: "primary" | "secondary";
|
||||
size: EmptyStateSize;
|
||||
}) {
|
||||
return (
|
||||
<Button
|
||||
variant={variant}
|
||||
size={size}
|
||||
onClick={config.onClick}
|
||||
prependIcon={config.prependIcon}
|
||||
appendIcon={config.appendIcon}
|
||||
disabled={config.disabled}
|
||||
>
|
||||
{config.text}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
export const DetailedEmptyState = observer(function DetailedEmptyState(props: Props) {
|
||||
const {
|
||||
title,
|
||||
description,
|
||||
size = "lg",
|
||||
primaryButton,
|
||||
secondaryButton,
|
||||
customPrimaryButton,
|
||||
customSecondaryButton,
|
||||
assetPath,
|
||||
className,
|
||||
} = props;
|
||||
|
||||
const hasButtons = primaryButton || secondaryButton || customPrimaryButton || customSecondaryButton;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"flex min-h-full min-w-full items-center justify-center overflow-y-auto px-5 py-10 md:px-20",
|
||||
className
|
||||
)}
|
||||
>
|
||||
<div className={cn("flex flex-col gap-5", sizeClasses[size])}>
|
||||
<div className="flex shrink-0 flex-col gap-1.5">
|
||||
<h3 className={cn("text-18 font-semibold", { "font-medium": !description })}>{title}</h3>
|
||||
{description && <p className="text-13">{description}</p>}
|
||||
</div>
|
||||
|
||||
{assetPath && <img src={assetPath} alt={title} className="h-auto w-full" loading="lazy" />}
|
||||
|
||||
{hasButtons && (
|
||||
<div className="relative flex w-full flex-shrink-0 items-center justify-center gap-2">
|
||||
{/* primary button */}
|
||||
{customPrimaryButton ??
|
||||
(primaryButton?.text && <CustomButton config={primaryButton} variant="primary" size={size} />)}
|
||||
{/* secondary button */}
|
||||
{customSecondaryButton ??
|
||||
(secondaryButton?.text && <CustomButton config={secondaryButton} variant="secondary" size={size} />)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
8
apps/web/core/components/empty-state/helper.tsx
Normal file
8
apps/web/core/components/empty-state/helper.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
export const getEmptyStateImagePath = (category: string, type: string, isLightMode: boolean) =>
|
||||
`/empty-state/${category}/${type}-${isLightMode ? "light" : "dark"}.webp`;
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
import { cn } from "@plane/utils";
|
||||
|
||||
type Props = {
|
||||
icon: React.ReactNode;
|
||||
title: string;
|
||||
description?: string;
|
||||
actionElement?: React.ReactNode;
|
||||
customClassName?: string;
|
||||
};
|
||||
|
||||
export function SectionEmptyState(props: Props) {
|
||||
const { title, description, icon, actionElement, customClassName } = props;
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"flex flex-col items-center justify-center gap-4 rounded-md border border-subtle p-10",
|
||||
customClassName
|
||||
)}
|
||||
>
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<div className="flex size-8 items-center justify-center rounded-sm bg-layer-1">{icon}</div>
|
||||
<span className="text-13 font-medium">{title}</span>
|
||||
{description && <span className="text-11 text-tertiary">{description}</span>}
|
||||
</div>
|
||||
{actionElement && <>{actionElement}</>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
import { observer } from "mobx-react";
|
||||
// utils
|
||||
import { cn } from "@plane/utils";
|
||||
|
||||
type EmptyStateSize = "sm" | "lg";
|
||||
|
||||
type Props = {
|
||||
title: string;
|
||||
description?: string;
|
||||
assetPath?: string;
|
||||
size?: EmptyStateSize;
|
||||
};
|
||||
|
||||
const sizeConfig = {
|
||||
sm: {
|
||||
container: "size-24",
|
||||
dimensions: 78,
|
||||
},
|
||||
lg: {
|
||||
container: "size-28",
|
||||
dimensions: 96,
|
||||
},
|
||||
} as const;
|
||||
|
||||
const getTitleClassName = (hasDescription: boolean) =>
|
||||
cn("font-medium whitespace-pre-line", {
|
||||
"text-13 text-placeholder": !hasDescription,
|
||||
"text-16 text-tertiary": hasDescription,
|
||||
});
|
||||
|
||||
export const SimpleEmptyState = observer(function SimpleEmptyState(props: Props) {
|
||||
const { title, description, size = "sm", assetPath } = props;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center gap-2.5 text-center">
|
||||
{assetPath && (
|
||||
<div className={sizeConfig[size].container}>
|
||||
<img src={assetPath} alt={title} className="h-full w-full object-contain" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<h3 className={getTitleClassName(!!description)}>{title}</h3>
|
||||
|
||||
{description && <p className="text-14 font-medium whitespace-pre-line text-placeholder">{description}</p>}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user