Skip to content

Commit 93c3674

Browse files
bidahclaude
andcommitted
🚸 feat(web): hide hero text and center input for logged-in users
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c1cf3ed commit 93c3674

1 file changed

Lines changed: 80 additions & 69 deletions

File tree

‎apps/web/components/home-client.tsx‎

Lines changed: 80 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
'use client'
22

3+
import { AuthDialog } from '@/components/auth-dialog'
34
import { ChatInput } from '@/components/chat-input'
5+
import { ImageAttachment } from '@/components/chat-panel-input'
46
import { NavHeader } from '@/components/nav-header'
7+
import { useToast } from '@/components/ui/use-toast'
8+
import { useClaudeModel } from '@/hooks/use-claude-model'
9+
import { useCookieStorage } from '@/hooks/useCookieStorage'
510
import { signOut } from '@/lib/auth/client'
611
import { LLMModelConfig } from '@/lib/models'
712
import modelsList from '@/lib/models.json'
13+
import type { AISkill } from '@/lib/skills'
814
import { TemplateId } from '@/lib/templates'
915
import { useRouter, useSearchParams } from 'next/navigation'
1016
import { usePostHog } from 'posthog-js/react'
1117
import { SetStateAction, useEffect, useState } from 'react'
12-
import { useCookieStorage } from '@/hooks/useCookieStorage'
13-
import { useClaudeModel } from '@/hooks/use-claude-model'
1418
import { v4 as uuidv4 } from 'uuid'
15-
import { useToast } from '@/components/ui/use-toast'
16-
import { AuthDialog } from '@/components/auth-dialog'
17-
import { ImageAttachment } from '@/components/chat-panel-input'
18-
import type { AISkill } from '@/lib/skills'
1919

2020
interface HomeClientProps {
2121
initialSession: any
@@ -42,36 +42,36 @@ export function HomeClient({ initialSession }: HomeClientProps) {
4242
const [isUploadingImages, setIsUploadingImages] = useState(false)
4343
const [selectedSkills, setSelectedSkills] = useState<AISkill[]>([])
4444

45-
const [languageModelCookie, setLanguageModelCookie] = useCookieStorage<LLMModelConfig>(
46-
'languageModel',
47-
{
45+
const [languageModelCookie, setLanguageModelCookie] =
46+
useCookieStorage<LLMModelConfig>('languageModel', {
4847
model: 'claude-3-5-sonnet-latest',
49-
},
50-
)
48+
})
5149
const [languageModelState, setLanguageModelState] = useState<LLMModelConfig>({
5250
model: 'claude-3-5-sonnet-latest',
5351
})
5452
const languageModel = isDevelopment ? languageModelCookie : languageModelState
55-
const setLanguageModel = isDevelopment ? setLanguageModelCookie : setLanguageModelState
53+
const setLanguageModel = isDevelopment
54+
? setLanguageModelCookie
55+
: setLanguageModelState
5656

5757
const posthog = usePostHog()
5858
const [isAuthDialogOpen, setAuthDialog] = useState(false)
5959
const { selectedModel, setSelectedModel } = useClaudeModel()
6060

61-
6261
// Handle checkout success/cancel
6362
useEffect(() => {
6463
const checkoutStatus = searchParams?.get('checkout')
6564
const customerSessionToken = searchParams?.get('customer_session_token')
66-
65+
6766
if (checkoutStatus === 'success') {
6867
toast({
6968
title: 'Subscription Successful!',
70-
description: 'Your subscription has been activated. Thank you for subscribing!',
69+
description:
70+
'Your subscription has been activated. Thank you for subscribing!',
7171
})
7272
// Clean up URL parameters
7373
window.history.replaceState({}, document.title, '/')
74-
74+
7575
// If there's a customer session token, we could handle it here
7676
if (customerSessionToken) {
7777
// You could store this token or use it to fetch customer details
@@ -117,15 +117,19 @@ export function HomeClient({ initialSession }: HomeClientProps) {
117117

118118
// Add skills to query params if any are selected
119119
if (selectedSkills.length > 0) {
120-
const skillIds = selectedSkills.map(skill => skill.id)
120+
const skillIds = selectedSkills.map((skill) => skill.id)
121121
queryParams.set('skills', JSON.stringify(skillIds))
122122
}
123123

124124
// Upload files and get URLs if any files exist
125125
if (files.length > 0) {
126126
try {
127127
setIsUploadingImages(true)
128-
console.log('[HomeClient] Uploading', files.length, 'images before navigation...')
128+
console.log(
129+
'[HomeClient] Uploading',
130+
files.length,
131+
'images before navigation...',
132+
)
129133

130134
// Upload each image to Vercel Blob
131135
const uploadPromises = files.map(async (file) => {
@@ -141,11 +145,11 @@ export function HomeClient({ initialSession }: HomeClientProps) {
141145
throw new Error(`Failed to upload ${file.name}`)
142146
}
143147

144-
return await response.json() as ImageAttachment
148+
return (await response.json()) as ImageAttachment
145149
})
146150

147151
const uploadedAttachments = await Promise.all(uploadPromises)
148-
const imageUrls = uploadedAttachments.map(a => a.url)
152+
const imageUrls = uploadedAttachments.map((a) => a.url)
149153
queryParams.set('imageUrls', JSON.stringify(imageUrls))
150154
console.log('[HomeClient] Uploaded image URLs:', imageUrls)
151155
} catch (error) {
@@ -199,7 +203,10 @@ export function HomeClient({ initialSession }: HomeClientProps) {
199203

200204
function handleSocialClick(target: 'github' | 'x' | 'discord') {
201205
if (target === 'github') {
202-
window.open('https://github.com/react-native-vibe-code/react-native-vibe-code-sdk', '_blank')
206+
window.open(
207+
'https://github.com/react-native-vibe-code/react-native-vibe-code-sdk',
208+
'_blank',
209+
)
203210
} else if (target === 'x') {
204211
window.open('https://x.com/e2b_dev', '_blank')
205212
} else if (target === 'discord') {
@@ -224,17 +231,22 @@ export function HomeClient({ initialSession }: HomeClientProps) {
224231
canUndo={false}
225232
onUndo={() => {}}
226233
/>
227-
<div className="flex flex-1 items-start justify-center relative pt-[100px] md:pt-[200px]">
228-
<div className="text-center md:hidden p-4 md:p-0 ">
229-
<h2 className="text-2xl md:text-5xl font-semibold mb-2 text-center leading-[35px] md:leading-[70px] whitespace-normal px-0 md:px-0">
230-
The free and open source React Native vibe coding IDE
231-
</h2>
232-
<h2 className="text-2xl md:text-5xl font-semibold mb-2 text-center leading-[35px] md:leading-[70px] whitespace-normal px-0 md:px-0">
233-
Text to mobile & web apps in seconds
234-
</h2>
235-
<p className="text-muted-foreground mb-4 text-center text-md md:text-md px-0 md:px-0">
236-
Ask chat anything, and turn your words into iOS, Android and web apps at the same time.
237-
</p>
234+
<div className={`flex flex-1 justify-center relative ${initialSession ? 'items-center' : 'items-start pt-[100px] md:pt-[200px]'}`}>
235+
<div className="text-center md:hidden p-4 md:p-0">
236+
{!initialSession && (
237+
<>
238+
<h2 className="text-2xl md:text-5xl font-semibold mb-2 text-center leading-[35px] md:leading-[70px] whitespace-normal px-0 md:px-0">
239+
The free and open source React Native vibe coding IDE
240+
</h2>
241+
<h2 className="text-2xl md:text-5xl font-semibold mb-2 text-center leading-[35px] md:leading-[70px] whitespace-normal px-0 md:px-0">
242+
Text to mobile & web apps in seconds
243+
</h2>
244+
<p className="text-muted-foreground mb-4 text-center text-md md:text-md px-0 md:px-0">
245+
Ask chat anything, and turn your words into iOS, Android and
246+
web apps at the same time.
247+
</p>
248+
</>
249+
)}
238250
<ChatInput
239251
hideHoverModeToggle
240252
retry={() => {}}
@@ -256,46 +268,45 @@ export function HomeClient({ initialSession }: HomeClientProps) {
256268
onSkillsChange={setSelectedSkills}
257269
/>
258270
</div>
259-
<div className="text-center hidden md:block">
260-
<h2 className="w-full m-auto text-xl md:text-3xl font-semibold mb-2 leading-[45px] md:leading-[45px] px-4 pb-0 md:px-0 animate-fade-in-up animation-delay-300">
261-
The free and open source React Native vibe coding IDE
262-
</h2>
263-
<h2 className="w-full m-auto text-xl md:text-3xl font-semibold mb-2 leading-[45px] md:leading-[45px] px-4 pb-0 md:px-0 animate-fade-in-up animation-delay-300">
264-
Text to mobile apps in seconds
265-
{/* <br /> */}
266-
267-
</h2>
268-
<p className="text-muted-foreground mb-4 text-left text-lg md:text-md px-4 md:px-0 animate-fade-in-up animation-delay-600 text-center mb-12">
269-
Ask chat anything, and turn your words into iOS, Android and web apps at the same time.
270-
</p>
271-
{/* <p className="text-muted-foreground mb-4 text-left text-lg md:text-xl px-4 md:px-0">
272-
no need to choose one platform when creating your app. Build all at once for any platform to reach users anywhere and everywhere.
273-
</p> */}
274-
<ChatInput
275-
hideHoverModeToggle
276-
retry={() => {}}
277-
isErrored={false}
278-
errorMessage=""
279-
isLoading={false}
280-
isRateLimited={false}
281-
stop={() => {}}
282-
input={chatInput}
283-
handleInputChange={handleSaveInputChange}
284-
handleSubmit={handleSubmitAuth}
285-
isMultiModal={currentModel?.multiModal || false}
286-
files={files}
287-
handleFileChange={handleFileChange}
288-
disabled={false}
289-
isAuthenticated={!!initialSession}
290-
selectedModel={selectedModel}
291-
onModelChange={setSelectedModel}
292-
onSkillsChange={setSelectedSkills}
293-
/>
271+
<div className="text-center hidden md:block container">
272+
{!initialSession && (
273+
<>
274+
<h2 className="w-full m-auto text-xl md:text-3xl font-semibold mb-2 leading-[45px] md:leading-[45px] px-4 pb-0 md:px-0 animate-fade-in-up animation-delay-300">
275+
The free and open source React Native vibe coding IDE
276+
</h2>
277+
<h2 className="w-full m-auto text-xl md:text-3xl font-semibold mb-2 leading-[45px] md:leading-[45px] px-4 pb-0 md:px-0 animate-fade-in-up animation-delay-300">
278+
Text to mobile apps in seconds
279+
</h2>
280+
<p className="text-muted-foreground mb-4 text-center text-lg md:text-md px-4 md:px-0 animate-fade-in-up animation-delay-600 mb-12">
281+
Ask chat anything, and turn your words into iOS, Android and
282+
web apps at the same time.
283+
</p>
284+
</>
285+
)}
286+
<ChatInput
287+
hideHoverModeToggle
288+
retry={() => {}}
289+
isErrored={false}
290+
errorMessage=""
291+
isLoading={false}
292+
isRateLimited={false}
293+
stop={() => {}}
294+
input={chatInput}
295+
handleInputChange={handleSaveInputChange}
296+
handleSubmit={handleSubmitAuth}
297+
isMultiModal={currentModel?.multiModal || false}
298+
files={files}
299+
handleFileChange={handleFileChange}
300+
disabled={false}
301+
isAuthenticated={!!initialSession}
302+
selectedModel={selectedModel}
303+
onModelChange={setSelectedModel}
304+
onSkillsChange={setSelectedSkills}
305+
/>
294306
</div>
295307
</div>
296-
297308
</div>
298309
</div>
299310
</>
300311
)
301-
}
312+
}

0 commit comments

Comments
 (0)