MCPcopy Create free account
hub / github.com/dailydotdev/apps / AskInstall

Function AskInstall

packages/shared/src/features/ask/components/AskInstall.tsx:81–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79];
80
81export const AskInstall = (): ReactElement => {
82 const { displayToast } = useToastNotification();
83 const { isPlus, logSubscriptionEvent } = usePlusSubscription();
84 const { isLoggedIn, showLogin } = useAuthContext();
85 const { logEvent } = useLogContext();
86 const [expandedTool, setExpandedTool] = useState<string | null>(null);
87
88 const handleToggleTool = (tool: string) => {
89 const isExpanding = expandedTool !== tool;
90 setExpandedTool(isExpanding ? tool : null);
91 if (isExpanding) {
92 logEvent({
93 event_name: LogEvent.Click,
94 target_id: TargetId.AskPage,
95 extra: JSON.stringify({ install_tool: tool }),
96 });
97 }
98 };
99
100 const handleCopy = async (value: string) => {
101 try {
102 await navigator.clipboard.writeText(value);
103 displayToast('Copied to clipboard');
104 } catch {
105 displayToast('Failed to copy');
106 }
107 };
108
109 return (
110 <FlexCol className="gap-4">
111 <Typography type={TypographyType.Title3} bold center>
112 Get started
113 </Typography>
114 <Typography
115 type={TypographyType.Callout}
116 color={TypographyColor.Secondary}
117 center
118 >
119 You&apos;ll need an{' '}
120 <Link href={`${webappUrl}settings/api`} passHref>
121 <a className="font-bold text-text-primary underline">API token</a>
122 </Link>
123 . Pick your tool and install in seconds.
124 {!isPlus && (
125 <>
126 {' '}
127 <Link href={plusUrl} passHref>
128 <a
129 className="font-bold text-text-primary underline"
130 // eslint-disable-next-line jsx-a11y/no-redundant-roles
131 role="link"
132 tabIndex={0}
133 onClick={(e) => {
134 if (!isLoggedIn) {
135 e.preventDefault();
136 showLogin({ trigger: AuthTriggers.Plus });
137 return;
138 }

Callers

nothing calls this directly

Calls 6

useToastNotificationFunction · 0.90
usePlusSubscriptionFunction · 0.90
useAuthContextFunction · 0.90
useLogContextFunction · 0.90
handleToggleToolFunction · 0.85
handleCopyFunction · 0.70

Tested by

no test coverage detected