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

Function onLinkClick

apps/web/ui/GridRow/index.tsx:204–235  ·  view source on GitHub ↗
(event: React.MouseEvent<HTMLAnchorElement>)

Source from the content-addressed store, hash-verified

202 const resolution = thread.resolutionId === message.id;
203
204 function onLinkClick(event: React.MouseEvent<HTMLAnchorElement>) {
205 const url = event.currentTarget.href;
206 if (isArchiveUrl(url)) {
207 event.stopPropagation();
208 event.preventDefault();
209 fetch('/api/link', {
210 method: 'POST',
211 body: JSON.stringify({
212 url,
213 }),
214 headers: {
215 'Content-Type': 'application/json',
216 },
217 })
218 .then((response) => response.json())
219 .then(({ incrementId }) => {
220 if (incrementId) {
221 window.location.href = getThreadUrl({
222 isSubDomainRouting,
223 settings,
224 incrementId,
225 LINEN_URL:
226 process.env.NODE_ENV === 'development'
227 ? 'http://localhost:3000'
228 : 'https://www.linen.dev',
229 });
230 } else {
231 window.location.href = url;
232 }
233 });
234 }
235 }
236
237 const isAdminOrOwner =
238 message.author?.role === Roles.ADMIN ||

Callers

nothing calls this directly

Calls 2

getThreadUrlFunction · 0.90
isArchiveUrlFunction · 0.70

Tested by

no test coverage detected