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

Function Thread

apps/web/ui/Thread/index.tsx:94–296  ·  view source on GitHub ↗
({
  thread,
  channelId,
  channelName,
  currentCommunity,
  isBot,
  isSubDomainRouting,
  settings,
  permissions,
  currentUser,
  token,
  expanded,
  sendMessage,
  updateThread,
  onClose,
  onExpandClick,
  onDelete,
  onSend,
  onMount,
  onReaction,
  onMessage,
  onResolution,
  editMessage,
  useUsersContext,
  api,
  fetchMentions,
  breadcrumb,
  chat,
  sidebar,
  activeUsers,
  ...props
}: Props)

Source from the content-addressed store, hash-verified

92}
93
94function Thread({
95 thread,
96 channelId,
97 channelName,
98 currentCommunity,
99 isBot,
100 isSubDomainRouting,
101 settings,
102 permissions,
103 currentUser,
104 token,
105 expanded,
106 sendMessage,
107 updateThread,
108 onClose,
109 onExpandClick,
110 onDelete,
111 onSend,
112 onMount,
113 onReaction,
114 onMessage,
115 onResolution,
116 editMessage,
117 useUsersContext,
118 api,
119 fetchMentions,
120 breadcrumb,
121 chat,
122 sidebar,
123 activeUsers,
124 ...props
125}: Props) {
126 const ref = useRef<HTMLDivElement>(null);
127 const [progress, setProgress] = useState(0);
128 const [uploading, setUploading] = useState(false);
129 const [uploads, setUploads] = useState<UploadedFile[]>([]);
130 const { id, state, viewCount, incrementId } = thread;
131 const [modal, setModal] = useState<ModalView>(ModalView.NONE);
132 const [editedMessage, setEditedMessage] = useState<SerializedMessage>();
133 const [isUserTyping, setUserTyping] = useState(false);
134
135 const currentChannel = thread.channel!;
136
137 const handleScroll = () =>
138 setTimeout(() => scrollToBottom(ref.current as HTMLDivElement), 0);
139
140 useEffect(() => {
141 onMount?.();
142 }, []);
143
144 useEffect(() => {
145 if (incrementId) {
146 api.threadIncrementView({ incrementId });
147 if (currentUser?.id) {
148 api.notificationsMark({ threadId: thread.id });
149 }
150 }
151 }, []);

Callers

nothing calls this directly

Calls 3

isThreadCreatorFunction · 0.85
updateThreadFunction · 0.50
editMessageFunction · 0.50

Tested by

no test coverage detected