MCPcopy Index your code
hub / github.com/21st-dev/1code / App

Function App

src/renderer/App.tsx:168–225  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166}
167
168export function App() {
169 // Initialize analytics on mount
170 useEffect(() => {
171 initAnalytics()
172
173 // Sync analytics opt-out status to main process
174 const syncOptOutStatus = async () => {
175 try {
176 const optOut =
177 localStorage.getItem("preferences:analytics-opt-out") === "true"
178 await window.desktopApi?.setAnalyticsOptOut(optOut)
179 } catch (error) {
180 console.warn("[Analytics] Failed to sync opt-out status:", error)
181 }
182 }
183 syncOptOutStatus()
184
185 // Identify user if already authenticated
186 const identifyUser = async () => {
187 try {
188 const user = await window.desktopApi?.getUser()
189 if (user?.id) {
190 identify(user.id, { email: user.email, name: user.name })
191 }
192 } catch (error) {
193 console.warn("[Analytics] Failed to identify user:", error)
194 }
195 }
196 identifyUser()
197
198 // Cleanup on unmount
199 return () => {
200 shutdown()
201 }
202 }, [])
203
204 return (
205 <WindowProvider>
206 <JotaiProvider store={appStore}>
207 <ThemeProvider attribute="class" defaultTheme="system" enableSystem>
208 <VSCodeThemeProvider>
209 <TooltipProvider delayDuration={100}>
210 <TRPCProvider>
211 <div
212 data-agents-page
213 className="h-screen w-screen bg-background text-foreground overflow-hidden"
214 >
215 <AppContent />
216 </div>
217 <ThemedToaster />
218 </TRPCProvider>
219 </TooltipProvider>
220 </VSCodeThemeProvider>
221 </ThemeProvider>
222 </JotaiProvider>
223 </WindowProvider>
224 )
225}

Callers

nothing calls this directly

Calls 4

initAnalyticsFunction · 0.90
shutdownFunction · 0.90
syncOptOutStatusFunction · 0.85
identifyUserFunction · 0.85

Tested by

no test coverage detected