From 96fb4fe9998131752873e63a93e2ce3fc48bf81c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 30 Sep 2025 17:05:10 +0000 Subject: [PATCH 1/2] feat: Add spinning loader for AI token generation This commit introduces a spinning loader on the top-left plant icon to indicate when the AI is generating tokens. A new `IsLoadingProvider` is created to manage the loading state, which is updated from the `Chat` component based on the `isGenerating` streamable value. The `Header` component consumes this state to conditionally apply a counter-clockwise spinning animation. --- app/globals.css | 13 +++++++++ app/layout.tsx | 43 ++++++++++++++++-------------- components/chat.tsx | 19 ++++++++++++- components/header.tsx | 13 ++++++++- components/is-loading-provider.tsx | 30 +++++++++++++++++++++ 5 files changed, 96 insertions(+), 22 deletions(-) create mode 100644 components/is-loading-provider.tsx diff --git a/app/globals.css b/app/globals.css index fd4bcddd..56dd31d8 100644 --- a/app/globals.css +++ b/app/globals.css @@ -237,3 +237,16 @@ .mapboxgl-ctrl-group button { pointer-events: auto !important; } + +@keyframes spin-counter-clockwise { + from { + transform: rotate(360deg); + } + to { + transform: rotate(0deg); + } +} + +.animate-spin-counter-clockwise { + animation: spin-counter-clockwise 1s linear infinite; +} diff --git a/app/layout.tsx b/app/layout.tsx index ab3f150b..6bdfe725 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -12,6 +12,7 @@ import { Toaster } from '@/components/ui/sonner' import { MapToggleProvider } from '@/components/map-toggle-context' import { ProfileToggleProvider } from '@/components/profile-toggle-context' import { MapLoadingProvider } from '@/components/map-loading-context'; +import { IsLoadingProvider } from '@/components/is-loading-provider'; import ConditionalLottie from '@/components/conditional-lottie'; const fontSans = FontSans({ @@ -54,26 +55,28 @@ export default function RootLayout({ return ( - - - - -
- - {children} - -