2023-11-06 15:12:24 +00:00
|
|
|
import { computed, makeObservable } from "mobx";
|
2024-05-07 11:54:45 +00:00
|
|
|
import { IMentionHighlight } from "@plane/lite-text-editor";
|
|
|
|
import { RootStore } from "./root.store";
|
2023-11-06 15:12:24 +00:00
|
|
|
|
|
|
|
export interface IMentionsStore {
|
2023-11-08 15:01:46 +00:00
|
|
|
// mentionSuggestions: IMentionSuggestion[];
|
|
|
|
mentionHighlights: IMentionHighlight[];
|
2023-11-06 15:12:24 +00:00
|
|
|
}
|
|
|
|
|
2023-11-08 15:01:46 +00:00
|
|
|
export class MentionsStore implements IMentionsStore {
|
|
|
|
// root store
|
|
|
|
rootStore;
|
|
|
|
|
|
|
|
constructor(_rootStore: RootStore) {
|
|
|
|
// rootStore
|
|
|
|
this.rootStore = _rootStore;
|
|
|
|
|
|
|
|
makeObservable(this, {
|
|
|
|
mentionHighlights: computed,
|
|
|
|
// mentionSuggestions: computed
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// get mentionSuggestions() {
|
|
|
|
// const projectMembers = this.rootStore.project.project.
|
|
|
|
|
|
|
|
// const suggestions = projectMembers === null ? [] : projectMembers.map((member) => ({
|
|
|
|
// id: member.member.id,
|
|
|
|
// type: "User",
|
|
|
|
// title: member.member.display_name,
|
|
|
|
// subtitle: member.member.email ?? "",
|
|
|
|
// avatar: member.member.avatar,
|
|
|
|
// redirect_uri: `/${member.workspace.slug}/profile/${member.member.id}`,
|
|
|
|
// }))
|
|
|
|
|
|
|
|
// return suggestions
|
|
|
|
// }
|
|
|
|
|
|
|
|
get mentionHighlights() {
|
2024-05-07 11:54:45 +00:00
|
|
|
const user = this.rootStore.user.data;
|
2023-11-08 15:01:46 +00:00
|
|
|
return user ? [user.id] : [];
|
|
|
|
}
|
|
|
|
}
|