-
Notifications
You must be signed in to change notification settings - Fork 38
feat(kiloclaw) onboarding calendar connect step #3083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
St0rmz1
wants to merge
7
commits into
main
Choose a base branch
from
feat/claw-calendar-connect-step
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
154bfd2
add calendar screen
St0rmz1 4c59b0a
Merge remote-tracking branch 'origin/main' into feat/claw-calendar-co…
St0rmz1 8789934
fix(claw): address review feedback on calendar step and posthog events
St0rmz1 e7bbdd9
fix(claw): address third-round review feedback
St0rmz1 c6ee684
fix(claw): address review feedback
St0rmz1 9c8f3aa
few bugs
St0rmz1 2430f6b
fixes
St0rmz1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
147 changes: 147 additions & 0 deletions
147
apps/web/src/app/(app)/claw/components/CalendarConnectStep.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| 'use client'; | ||
|
|
||
| import Link from 'next/link'; | ||
| import { Calendar, Check, X } from 'lucide-react'; | ||
| import { Button } from '@/components/ui/button'; | ||
| import { cn } from '@/lib/utils'; | ||
| import { OnboardingStepView } from './OnboardingStepView'; | ||
|
|
||
| type CalendarConnectStepViewProps = { | ||
| currentStep: number; | ||
| totalSteps: number; | ||
| connectUrl: string; | ||
| isConnected: boolean; | ||
| connectedAccountEmail?: string | null; | ||
| /** | ||
| * Whether the kiloclaw instance row is provisioned. The | ||
| * /api/integrations/google/connect route requires an active instance and | ||
| * bounces the user out of onboarding when it can't find one, so the Connect | ||
| * button stays disabled until the instance row exists. | ||
| */ | ||
| instanceReady: boolean; | ||
| onSkip: () => void; | ||
| onContinue: () => void; | ||
| onConnectClick?: () => void; | ||
| }; | ||
|
|
||
| const FEATURES: Array<{ included: boolean; title: string; detail: string }> = [ | ||
| { | ||
| included: true, | ||
| title: 'Read your calendar events', | ||
| detail: 'Titles, attendees, locations, descriptions for the next 14 days.', | ||
| }, | ||
| { | ||
| included: true, | ||
| title: 'Read calendars you own and subscribe to', | ||
| detail: 'Including team calendars shared with you.', | ||
| }, | ||
| { | ||
| included: false, | ||
| title: 'Create, modify, or delete events', | ||
| detail: "We don't request write access.", | ||
| }, | ||
| ]; | ||
|
|
||
| export function CalendarConnectStepView({ | ||
| currentStep, | ||
| totalSteps, | ||
| connectUrl, | ||
| isConnected, | ||
| connectedAccountEmail, | ||
| instanceReady, | ||
| onSkip, | ||
| onContinue, | ||
| onConnectClick, | ||
| }: CalendarConnectStepViewProps) { | ||
| return ( | ||
| <OnboardingStepView | ||
| currentStep={currentStep} | ||
| totalSteps={totalSteps} | ||
| stepLabel={`Step ${currentStep} of ${totalSteps} · Calendar`} | ||
| title="Connect a calendar." | ||
| description="This is what day one of your briefing is built from. Read access only, no writes." | ||
| showProvisioningBanner | ||
| > | ||
| <div className="border-border bg-card flex flex-col gap-5 rounded-lg border p-5 sm:p-6"> | ||
| <div className="flex items-start justify-between gap-3"> | ||
| <div className="flex items-start gap-3"> | ||
| <div className="border-border flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border"> | ||
| <Calendar className="h-5 w-5" /> | ||
| </div> | ||
| <div className="flex flex-col gap-0.5"> | ||
| <h3 className="text-foreground text-base font-semibold">Google Calendar</h3> | ||
| <p className="text-muted-foreground text-xs"> | ||
| {isConnected && connectedAccountEmail | ||
| ? `Connected as ${connectedAccountEmail}` | ||
| : 'via OAuth · read-only'} | ||
| </p> | ||
| </div> | ||
| </div> | ||
| <span | ||
| className={cn( | ||
| 'rounded-full border px-2.5 py-0.5 text-[10px] font-semibold tracking-wider uppercase', | ||
| isConnected | ||
| ? 'border-emerald-500/40 text-emerald-500' | ||
| : 'border-amber-500/40 text-amber-500' | ||
| )} | ||
| > | ||
| {isConnected ? 'Connected' : 'Recommended'} | ||
| </span> | ||
| </div> | ||
|
|
||
| <div className="flex flex-col gap-3"> | ||
| {FEATURES.map(feature => ( | ||
| <div key={feature.title} className="flex items-start gap-3"> | ||
| <div | ||
| className={cn( | ||
| 'flex h-5 w-5 shrink-0 items-center justify-center rounded-md border', | ||
| feature.included | ||
| ? 'border-emerald-500/60 bg-emerald-500/10 text-emerald-500' | ||
| : 'border-border text-muted-foreground/60' | ||
| )} | ||
| > | ||
| {feature.included ? <Check className="h-3 w-3" /> : <X className="h-3 w-3" />} | ||
| </div> | ||
| <div className="flex flex-col gap-0.5"> | ||
| <p | ||
| className={cn( | ||
| 'text-sm font-medium', | ||
| feature.included ? 'text-foreground' : 'text-muted-foreground/70' | ||
| )} | ||
| > | ||
| {feature.title} | ||
| </p> | ||
| <p className="text-muted-foreground text-xs">{feature.detail}</p> | ||
| </div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
|
|
||
| <div className="flex items-center justify-end gap-3 pt-2"> | ||
| <button | ||
| type="button" | ||
| onClick={() => onSkip()} | ||
| className="text-muted-foreground hover:text-foreground text-sm font-medium transition-colors" | ||
| > | ||
| Skip for now | ||
| </button> | ||
| {isConnected ? ( | ||
| <Button variant="primary" onClick={() => onContinue()}> | ||
| Continue | ||
| </Button> | ||
| ) : instanceReady ? ( | ||
| <Button asChild variant="primary"> | ||
| <Link href={connectUrl} onClick={() => onConnectClick?.()}> | ||
| Connect Google Calendar | ||
| </Link> | ||
| </Button> | ||
| ) : ( | ||
| <Button variant="primary" disabled> | ||
| Setting up your instance… | ||
| </Button> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </OnboardingStepView> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.