MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / EditThreadModal

Function EditThreadModal

apps/web/ui/EditThreadModal/index.tsx:35–128  ·  view source on GitHub ↗
({
  communityId,
  currentUser,
  currentThread,
  open,
  close,
  onSend,
  uploadFiles,
  progress,
  uploading,
  uploads,
  api,
}: Props)

Source from the content-addressed store, hash-verified

33}
34
35export default function EditThreadModal({
36 communityId,
37 currentUser,
38 currentThread,
39 open,
40 close,
41 onSend,
42 uploadFiles,
43 progress,
44 uploading,
45 uploads,
46 api,
47}: Props) {
48 const [message, setMessage] = useState('');
49 const [users] = useUsersContext();
50 const currentMessage = currentThread.messages[0];
51 const allUsers = [...users, ...currentMessage.mentions];
52 const [title, setTitle] = useState<string>(currentThread.title || '');
53 return (
54 <Modal open={open} close={close} size="xl">
55 <div className={styles.grid}>
56 <div className={styles.column}>
57 <div className={styles.header}>
58 <H3 className={styles.h3}>Edit Thread</H3>
59 </div>
60 <Field>
61 <TextInput
62 id="new-thread-title"
63 label="Title"
64 value={title}
65 onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
66 setTitle(event.target.value)
67 }
68 onKeyUp={(event: React.KeyboardEvent<HTMLInputElement>) => {
69 event.stopPropagation();
70 event.preventDefault();
71 }}
72 />
73 </Field>
74 <Field>
75 <MessageForm
76 id="inbox-message-form"
77 currentUser={currentUser}
78 draft={false}
79 onSend={(message: string) => {
80 return onSend({ title, message });
81 }}
82 fetchMentions={(term?: string) => {
83 if (!term) return Promise.resolve([]);
84 return api.fetchMentions(term, communityId);
85 }}
86 onMessageChange={(message) => setMessage(message)}
87 rows={4}
88 progress={progress}
89 uploading={uploading}
90 uploads={uploads}
91 sendOnEnter={false}
92 preview={false}

Callers

nothing calls this directly

Calls 4

useUsersContextFunction · 0.90
preprocessFunction · 0.90
postprocessFunction · 0.90
fetchMentionsMethod · 0.65

Tested by

no test coverage detected