MCPcopy Create free account
hub / github.com/Swizec/article-threader / KeyInsight

Function KeyInsight

components/KeyInsight.tsx:37–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35};
36
37export const KeyInsight = () => {
38 const [url, setUrl] = useState<string>("");
39 const [isError, setIsError] = useState<boolean>(false);
40
41 const plausible = usePlausible();
42
43 const {
44 data: keyInsight,
45 isLoading,
46 mutateAsync,
47 } = useMutation(findKeyInsight);
48
49 async function makeThread(event: React.FormEvent) {
50 event.preventDefault();
51
52 setIsError(false);
53
54 if (url) {
55 try {
56 await mutateAsync({ url });
57 } catch (e) {
58 console.error(e);
59 setIsError(true);
60 }
61 }
62 }
63
64 return (
65 <Box
66 sx={{
67 textAlign: "center",
68 }}
69 >
70 <h1>What is the point?</h1>
71 <Paragraph>
72 Reading? Ain&apos;t nobody got time for that. Paste the URL, get
73 the point 👇
74 </Paragraph>
75 <Paragraph>
76 Don&apos;t have a URL handy?{" "}
77 <Link
78 href="#"
79 onClick={() => {
80 setUrl(
81 "https://swizec.com/blog/why-senior-engineers-get-nothing-done/"
82 );
83 }}
84 >
85 Try an example
86 </Link>
87 </Paragraph>
88 <Flex
89 as="form"
90 onSubmit={makeThread}
91 sx={{
92 p: 1,
93 flexDirection: "column",
94 alignItems: "center",

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected