Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WIKI-774] refactor: space app mentions #8152

Aaryan Khandelwal09f4e3d4ae70
diff --git a/apps/space/ce/components/editor/embeds/index.ts b/apps/space/ce/components/editor/embeds/index.ts
deleted file mode 100644
index 8146e94d92..0000000000
--- a/apps/space/ce/components/editor/embeds/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./mentions";
diff --git a/apps/space/ce/components/editor/embeds/mentions/root.tsx b/apps/space/ce/components/editor/embeds/mentions/root.tsx
index b04de12cf6..6fc36cc740 100644
--- a/apps/space/ce/components/editor/embeds/mentions/root.tsx
+++ b/apps/space/ce/components/editor/embeds/mentions/root.tsx
@@ -1,6 +1,8 @@
// plane editor
import type { TCallbackMentionComponentProps } from "@plane/editor";
-export function EditorAdditionalMentionsRoot(_props: TCallbackMentionComponentProps) {
+export type TEditorMentionComponentProps = TCallbackMentionComponentProps;
+
+export function EditorAdditionalMentionsRoot(_props: TEditorMentionComponentProps) {
return null;
}
diff --git a/apps/space/ce/components/editor/index.ts b/apps/space/ce/components/editor/index.ts
deleted file mode 100644
index cf8352ae4a..0000000000
--- a/apps/space/ce/components/editor/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./embeds";
diff --git a/apps/space/core/components/editor/embeds/mentions/root.tsx b/apps/space/core/components/editor/embeds/mentions/root.tsx
index fc6454bd46..7b1f7f718b 100644
--- a/apps/space/core/components/editor/embeds/mentions/root.tsx
+++ b/apps/space/core/components/editor/embeds/mentions/root.tsx
@@ -1,11 +1,10 @@
-// plane editor
-import type { TCallbackMentionComponentProps } from "@plane/editor";
-// plane web components
-import { EditorAdditionalMentionsRoot } from "@/plane-web/components/editor";
+// plane web imports
+import type { TEditorMentionComponentProps } from "@/plane-web/components/editor/embeds/mentions";
+import { EditorAdditionalMentionsRoot } from "@/plane-web/components/editor/embeds/mentions";
// local components
import { EditorUserMention } from "./user";
-export function EditorMentionsRoot(props: TCallbackMentionComponentProps) {
+export function EditorMentionsRoot(props: TEditorMentionComponentProps) {
const { entity_identifier, entity_name } = props;
switch (entity_name) {
diff --git a/apps/space/core/components/issues/issue-layouts/properties/state.tsx b/apps/space/core/components/issues/issue-layouts/properties/state.tsx
index 344c91c8e7..f689e26369 100644
--- a/apps/space/core/components/issues/issue-layouts/properties/state.tsx
+++ b/apps/space/core/components/issues/issue-layouts/properties/state.tsx
@@ -1,31 +1,47 @@
+"use client";
+
import { observer } from "mobx-react";
// plane ui
import { StateGroupIcon } from "@plane/propel/icons";
import { Tooltip } from "@plane/propel/tooltip";
+import type { TStateGroups } from "@plane/types";
// plane utils
import { cn } from "@plane/utils";
//hooks
import { useStates } from "@/hooks/store/use-state";
type Props = {
- stateId: string | undefined;
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 (
- <Tooltip tooltipHeading="State" tooltipContent={state?.name ?? "State"}>
+ <Tooltip tooltipHeading="State" tooltipContent={state.name}>
<div
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,
})}
>
<div className="flex w-full items-center gap-1.5">
- <StateGroupIcon stateGroup={state?.group ?? "backlog"} color={state?.color} />
- <div className="text-xs">{state?.name ?? "State"}</div>
+ <StateGroupIcon stateGroup={state.group} />
+ <div className="text-xs">{state.name}</div>
</div>
</div>
</Tooltip>