mirror of
https://github.com/makeplane/plane.git
synced 2025-12-16 20:07:56 +01:00
[WIKI-774] refactor: space app mentions #8152
Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
committed by
GitHub
parent
7c8cbc4ead
commit
09f4e3d4ae
@@ -1 +0,0 @@
|
|||||||
export * from "./mentions";
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
// plane editor
|
// plane editor
|
||||||
import type { TCallbackMentionComponentProps } from "@plane/editor";
|
import type { TCallbackMentionComponentProps } from "@plane/editor";
|
||||||
|
|
||||||
export function EditorAdditionalMentionsRoot(_props: TCallbackMentionComponentProps) {
|
export type TEditorMentionComponentProps = TCallbackMentionComponentProps;
|
||||||
|
|
||||||
|
export function EditorAdditionalMentionsRoot(_props: TEditorMentionComponentProps) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./embeds";
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
// plane editor
|
// plane web imports
|
||||||
import type { TCallbackMentionComponentProps } from "@plane/editor";
|
import type { TEditorMentionComponentProps } from "@/plane-web/components/editor/embeds/mentions";
|
||||||
// plane web components
|
import { EditorAdditionalMentionsRoot } from "@/plane-web/components/editor/embeds/mentions";
|
||||||
import { EditorAdditionalMentionsRoot } from "@/plane-web/components/editor";
|
|
||||||
// local components
|
// local components
|
||||||
import { EditorUserMention } from "./user";
|
import { EditorUserMention } from "./user";
|
||||||
|
|
||||||
export function EditorMentionsRoot(props: TCallbackMentionComponentProps) {
|
export function EditorMentionsRoot(props: TEditorMentionComponentProps) {
|
||||||
const { entity_identifier, entity_name } = props;
|
const { entity_identifier, entity_name } = props;
|
||||||
|
|
||||||
switch (entity_name) {
|
switch (entity_name) {
|
||||||
|
|||||||
@@ -1,31 +1,47 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
// plane ui
|
// plane ui
|
||||||
import { StateGroupIcon } from "@plane/propel/icons";
|
import { StateGroupIcon } from "@plane/propel/icons";
|
||||||
import { Tooltip } from "@plane/propel/tooltip";
|
import { Tooltip } from "@plane/propel/tooltip";
|
||||||
|
import type { TStateGroups } from "@plane/types";
|
||||||
// plane utils
|
// plane utils
|
||||||
import { cn } from "@plane/utils";
|
import { cn } from "@plane/utils";
|
||||||
//hooks
|
//hooks
|
||||||
import { useStates } from "@/hooks/store/use-state";
|
import { useStates } from "@/hooks/store/use-state";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
stateId: string | undefined;
|
|
||||||
shouldShowBorder?: boolean;
|
shouldShowBorder?: boolean;
|
||||||
};
|
} & (
|
||||||
export const IssueBlockState = observer(function IssueBlockState({ stateId, shouldShowBorder = true }: Props) {
|
| {
|
||||||
const { getStateById } = useStates();
|
stateDetails: {
|
||||||
|
name: string;
|
||||||
|
group: TStateGroups;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
stateId: string;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const state = getStateById(stateId);
|
export const IssueBlockState: React.FC<Props> = observer((props) => {
|
||||||
|
const { shouldShowBorder = true } = props;
|
||||||
|
// store hooks
|
||||||
|
const { getStateById } = useStates();
|
||||||
|
// derived values
|
||||||
|
const state = "stateId" in props ? getStateById(props.stateId) : props.stateDetails;
|
||||||
|
if (!state) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip tooltipHeading="State" tooltipContent={state?.name ?? "State"}>
|
<Tooltip tooltipHeading="State" tooltipContent={state.name}>
|
||||||
<div
|
<div
|
||||||
className={cn("flex h-full w-full items-center justify-between gap-1 rounded px-2.5 py-1 text-xs", {
|
className={cn("flex h-full w-full items-center justify-between gap-1 rounded px-2.5 py-1 text-xs", {
|
||||||
"border-[0.5px] border-custom-border-300": shouldShowBorder,
|
"border-[0.5px] border-custom-border-300": shouldShowBorder,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<div className="flex w-full items-center gap-1.5">
|
<div className="flex w-full items-center gap-1.5">
|
||||||
<StateGroupIcon stateGroup={state?.group ?? "backlog"} color={state?.color} />
|
<StateGroupIcon stateGroup={state.group} />
|
||||||
<div className="text-xs">{state?.name ?? "State"}</div>
|
<div className="text-xs">{state.name}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
Reference in New Issue
Block a user