MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / JoinLinen

Function JoinLinen

apps/web/ui/JoinButton/JoinLinen/index.tsx:16–87  ·  view source on GitHub ↗
({
  brandColor,
  fontColor,
  accountId,
  status,
  startSignUp,
  reload,
  api,
}: Props)

Source from the content-addressed store, hash-verified

14}
15
16export default function JoinLinen({
17 brandColor,
18 fontColor,
19 accountId,
20 status,
21 startSignUp,
22 reload,
23 api,
24}: Props) {
25 const showModal = async (
26 event: React.MouseEvent<HTMLAnchorElement>,
27 flow: 'signin' | 'signup'
28 ) => {
29 event.preventDefault();
30 event.stopPropagation();
31 startSignUp?.({
32 flow,
33 communityId: accountId,
34 });
35 };
36
37 async function joinCommunity(
38 event: React.MouseEvent<HTMLAnchorElement, MouseEvent>
39 ) {
40 event.preventDefault();
41 event.stopPropagation();
42 try {
43 await api.joinCommunity({ communityId: accountId });
44 Toast.success('Welcome aboard');
45 reload();
46 } catch (error) {
47 Toast.info('Something went wrong, please try again');
48 }
49 }
50
51 if (status === 'loading') {
52 return <div />;
53 }
54
55 if (status === 'authenticated') {
56 return (
57 <Link
58 lighter
59 brandColor={brandColor}
60 fontColor={fontColor}
61 onClick={joinCommunity}
62 >
63 Join Community
64 </Link>
65 );
66 }
67
68 return (
69 <>
70 <Link
71 lighter
72 brandColor={brandColor}
73 fontColor={fontColor}

Callers

nothing calls this directly

Calls 1

showModalFunction · 0.70

Tested by

no test coverage detected