Skip to content

Commit 6895c5e

Browse files
committed
refactor: space app mentions
1 parent 6a26ce3 commit 6895c5e

File tree

5 files changed

+31
-16
lines changed

5 files changed

+31
-16
lines changed

apps/space/ce/components/editor/embeds/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// plane editor
22
import type { TCallbackMentionComponentProps } from "@plane/editor";
33

4-
export function EditorAdditionalMentionsRoot(_props: TCallbackMentionComponentProps) {
4+
export type TEditorMentionComponentProps = TCallbackMentionComponentProps;
5+
6+
export function EditorAdditionalMentionsRoot(_props: TEditorMentionComponentProps) {
57
return null;
68
}

apps/space/ce/components/editor/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/space/core/components/editor/embeds/mentions/root.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// plane editor
2-
import type { TCallbackMentionComponentProps } from "@plane/editor";
3-
// plane web components
4-
import { EditorAdditionalMentionsRoot } from "@/plane-web/components/editor";
1+
// plane web imports
2+
import type { TEditorMentionComponentProps } from "@/plane-web/components/editor/embeds/mentions";
3+
import { EditorAdditionalMentionsRoot } from "@/plane-web/components/editor/embeds/mentions";
54
// local components
65
import { EditorUserMention } from "./user";
76

8-
export function EditorMentionsRoot(props: TCallbackMentionComponentProps) {
7+
export function EditorMentionsRoot(props: TEditorMentionComponentProps) {
98
const { entity_identifier, entity_name } = props;
109

1110
switch (entity_name) {

apps/space/core/components/issues/issue-layouts/properties/state.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
1+
"use client";
2+
13
import { observer } from "mobx-react";
24
// plane ui
35
import { StateGroupIcon } from "@plane/propel/icons";
46
import { Tooltip } from "@plane/propel/tooltip";
7+
import type { TStateGroups } from "@plane/types";
58
// plane utils
69
import { cn } from "@plane/utils";
710
//hooks
811
import { useStates } from "@/hooks/store/use-state";
912

1013
type Props = {
11-
stateId: string | undefined;
1214
shouldShowBorder?: boolean;
13-
};
14-
export const IssueBlockState = observer(function IssueBlockState({ stateId, shouldShowBorder = true }: Props) {
15-
const { getStateById } = useStates();
15+
} & (
16+
| {
17+
stateDetails: {
18+
name: string;
19+
group: TStateGroups;
20+
};
21+
}
22+
| {
23+
stateId: string;
24+
}
25+
);
1626

17-
const state = getStateById(stateId);
27+
export const IssueBlockState: React.FC<Props> = observer((props) => {
28+
const { shouldShowBorder = true } = props;
29+
// store hooks
30+
const { getStateById } = useStates();
31+
// derived values
32+
const state = "stateId" in props ? getStateById(props.stateId) : props.stateDetails;
33+
if (!state) return null;
1834

1935
return (
20-
<Tooltip tooltipHeading="State" tooltipContent={state?.name ?? "State"}>
36+
<Tooltip tooltipHeading="State" tooltipContent={state.name}>
2137
<div
2238
className={cn("flex h-full w-full items-center justify-between gap-1 rounded px-2.5 py-1 text-xs", {
2339
"border-[0.5px] border-custom-border-300": shouldShowBorder,
2440
})}
2541
>
2642
<div className="flex w-full items-center gap-1.5">
27-
<StateGroupIcon stateGroup={state?.group ?? "backlog"} color={state?.color} />
28-
<div className="text-xs">{state?.name ?? "State"}</div>
43+
<StateGroupIcon stateGroup={state.group} />
44+
<div className="text-xs">{state.name}</div>
2945
</div>
3046
</div>
3147
</Tooltip>

0 commit comments

Comments
 (0)