Skip to content

Commit 0340fba

Browse files
waleedlatif1claude
andcommitted
fix(landing): second pass — fix remaining code quality issues
- auth-modal: add @sim/logger, log social sign-in errors instead of swallowing silently - auth-modal: extract duplicated social button classes into SOCIAL_BTN constant - auth-modal: remove unused isProduction from ProviderStatus interface - auth-modal: memoize getBrandConfig() call - footer: remove stale arrow destructuring left after interface cleanup, use cn() throughout - footer-cta: replace inline styles on submit button with Tailwind classes via cn() - footer-cta: replace caretColor inline style with caret-white utility - templates: fix incorrect section value 'landing_preview' → 'templates' for PostHog tracking - events: add 'templates' to landing_cta_clicked section union - integrations: replace "canvas" with "workflow builder" per constitution rules - llms-full: replace "canvas" terminology with "visual builder"/"workflow builder" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 637e680 commit 0340fba

7 files changed

Lines changed: 43 additions & 33 deletions

File tree

apps/sim/app/(landing)/components/auth-modal/auth-modal.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22

3-
import { useCallback, useEffect, useState } from 'react'
3+
import { useCallback, useEffect, useMemo, useState } from 'react'
4+
import { createLogger } from '@sim/logger'
45
import { Loader2, X } from 'lucide-react'
56
import Image from 'next/image'
67
import { useRouter } from 'next/navigation'
@@ -11,6 +12,8 @@ import { captureClientEvent } from '@/lib/posthog/client'
1112
import type { PostHogEventMap } from '@/lib/posthog/events'
1213
import { getBrandConfig } from '@/ee/whitelabeling'
1314

15+
const logger = createLogger('AuthModal')
16+
1417
type AuthView = 'login' | 'signup'
1518

1619
interface AuthModalProps {
@@ -22,25 +25,29 @@ interface AuthModalProps {
2225
interface ProviderStatus {
2326
githubAvailable: boolean
2427
googleAvailable: boolean
25-
isProduction: boolean
2628
}
2729

2830
let fetchPromise: Promise<ProviderStatus> | null = null
2931

3032
const FALLBACK_STATUS: ProviderStatus = {
3133
githubAvailable: false,
3234
googleAvailable: false,
33-
isProduction: false,
3435
}
3536

37+
const SOCIAL_BTN =
38+
'relative flex h-[32px] w-full items-center justify-center rounded-[5px] border border-[var(--landing-border-strong)] text-[13.5px] text-[var(--landing-text)] transition-colors hover:bg-[var(--landing-bg-elevated)] disabled:cursor-not-allowed disabled:opacity-50'
39+
3640
function fetchProviderStatus(): Promise<ProviderStatus> {
3741
if (fetchPromise) return fetchPromise
3842
fetchPromise = fetch('/api/auth/providers')
3943
.then((r) => {
4044
if (!r.ok) throw new Error(`HTTP ${r.status}`)
4145
return r.json()
4246
})
43-
.then((data: ProviderStatus) => data)
47+
.then(({ githubAvailable, googleAvailable }: ProviderStatus) => ({
48+
githubAvailable,
49+
googleAvailable,
50+
}))
4451
.catch(() => {
4552
fetchPromise = null
4653
return FALLBACK_STATUS
@@ -54,7 +61,7 @@ export function AuthModal({ children, defaultView = 'login', source }: AuthModal
5461
const [view, setView] = useState<AuthView>(defaultView)
5562
const [providerStatus, setProviderStatus] = useState<ProviderStatus | null>(null)
5663
const [socialLoading, setSocialLoading] = useState<'github' | 'google' | null>(null)
57-
const brand = getBrandConfig()
64+
const brand = useMemo(() => getBrandConfig(), [])
5865

5966
useEffect(() => {
6067
fetchProviderStatus().then(setProviderStatus)
@@ -81,7 +88,8 @@ export function AuthModal({ children, defaultView = 'login', source }: AuthModal
8188
setSocialLoading(provider)
8289
try {
8390
await client.signIn.social({ provider, callbackURL: '/workspace' })
84-
} catch {
91+
} catch (error) {
92+
logger.warn('Social sign-in did not complete', { provider, error })
8593
} finally {
8694
setSocialLoading(null)
8795
}
@@ -140,7 +148,7 @@ export function AuthModal({ children, defaultView = 'login', source }: AuthModal
140148
type='button'
141149
onClick={() => handleSocialLogin('google')}
142150
disabled={!!socialLoading}
143-
className='relative flex h-[32px] w-full items-center justify-center rounded-[5px] border border-[var(--landing-border-strong)] text-[13.5px] text-[var(--landing-text)] transition-colors hover:bg-[var(--landing-bg-elevated)] disabled:cursor-not-allowed disabled:opacity-50'
151+
className={SOCIAL_BTN}
144152
>
145153
<GoogleIcon className='absolute left-4 h-[18px] w-[18px] shrink-0' />
146154
<span>
@@ -153,7 +161,7 @@ export function AuthModal({ children, defaultView = 'login', source }: AuthModal
153161
type='button'
154162
onClick={() => handleSocialLogin('github')}
155163
disabled={!!socialLoading}
156-
className='relative flex h-[32px] w-full items-center justify-center rounded-[5px] border border-[var(--landing-border-strong)] text-[13.5px] text-[var(--landing-text)] transition-colors hover:bg-[var(--landing-bg-elevated)] disabled:cursor-not-allowed disabled:opacity-50'
164+
className={SOCIAL_BTN}
157165
>
158166
<GithubIcon className='absolute left-4 h-[18px] w-[18px] shrink-0' />
159167
<span>

apps/sim/app/(landing)/components/footer/footer-cta.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,19 @@ export function FooterCTA() {
7171
aria-label='Describe what you want to build'
7272
placeholder={animatedPlaceholder}
7373
rows={2}
74-
className='m-0 box-border min-h-[48px] w-full resize-none border-0 bg-transparent px-1 py-1 font-body text-[var(--landing-text)] text-base leading-[24px] tracking-[-0.015em] outline-none placeholder:font-[380] placeholder:text-[var(--landing-text-muted)] focus-visible:ring-0'
75-
style={{ caretColor: '#FFFFFF', maxHeight: `${MAX_HEIGHT}px` }}
74+
className='m-0 box-border min-h-[48px] w-full resize-none border-0 bg-transparent px-1 py-1 font-body text-[var(--landing-text)] text-base leading-[24px] tracking-[-0.015em] caret-white outline-none placeholder:font-[380] placeholder:text-[var(--landing-text-muted)] focus-visible:ring-0'
75+
style={{ maxHeight: `${MAX_HEIGHT}px` }}
7676
/>
7777
<div className='flex items-center justify-end'>
7878
<button
7979
type='button'
8080
onClick={handleSubmit}
8181
disabled={isEmpty}
8282
aria-label='Submit message'
83-
className='flex h-[28px] w-[28px] items-center justify-center rounded-full border-0 p-0 transition-colors'
84-
style={{
85-
background: isEmpty ? '#555555' : '#FFFFFF',
86-
cursor: isEmpty ? 'not-allowed' : 'pointer',
87-
}}
83+
className={cn(
84+
'flex h-[28px] w-[28px] items-center justify-center rounded-full border-0 p-0 transition-colors',
85+
isEmpty ? 'cursor-not-allowed bg-[#555555]' : 'cursor-pointer bg-white'
86+
)}
8887
>
8988
<ArrowUp size={16} strokeWidth={2.25} color={isEmpty ? '#888888' : '#1C1C1C'} />
9089
</button>

apps/sim/app/(landing)/components/footer/footer.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Image from 'next/image'
22
import Link from 'next/link'
3+
import { cn } from '@/lib/core/utils/cn'
34
import { FooterCTA } from '@/app/(landing)/components/footer/footer-cta'
45

56
const LINK_CLASS =
@@ -92,7 +93,7 @@ const LEGAL_LINKS: FooterItem[] = [
9293
function ChevronArrow({ external }: { external?: boolean }) {
9394
return (
9495
<svg
95-
className={`h-3 w-3 shrink-0${external ? ' -rotate-45' : ''}`}
96+
className={cn('h-3 w-3 shrink-0', external && '-rotate-45')}
9697
viewBox='0 0 10 10'
9798
fill='none'
9899
xmlns='http://www.w3.org/2000/svg'
@@ -125,26 +126,24 @@ function FooterColumn({ title, items }: { title: string; items: FooterItem[] })
125126
<div>
126127
<h3 className='mb-4 font-medium text-[var(--landing-text)] text-sm'>{title}</h3>
127128
<div className='flex flex-col gap-2.5'>
128-
{items.map(({ label, href, external, arrow, externalArrow }) =>
129+
{items.map(({ label, href, external, externalArrow }) =>
129130
external ? (
130131
<a
131132
key={label}
132133
href={href}
133134
target='_blank'
134135
rel='noopener noreferrer'
135-
className={`${LINK_CLASS}${externalArrow ? ' group/link inline-flex items-center gap-1' : ''}`}
136+
className={cn(
137+
LINK_CLASS,
138+
externalArrow && 'group/link inline-flex items-center gap-1'
139+
)}
136140
>
137141
{label}
138142
{externalArrow && <ChevronArrow external />}
139143
</a>
140144
) : (
141-
<Link
142-
key={label}
143-
href={href}
144-
className={`${LINK_CLASS}${arrow ? ' group/link inline-flex items-center gap-1.5' : ''}`}
145-
>
145+
<Link key={label} href={href} className={LINK_CLASS}>
146146
{label}
147-
{arrow && <ChevronArrow />}
148147
</Link>
149148
)
150149
)}
@@ -161,7 +160,10 @@ export default function Footer({ hideCTA }: FooterProps) {
161160
return (
162161
<footer
163162
role='contentinfo'
164-
className={`bg-[var(--landing-bg)] pb-10 font-[430] font-season text-sm${hideCTA ? ' pt-10' : ''}`}
163+
className={cn(
164+
'bg-[var(--landing-bg)] pb-10 font-[430] font-season text-sm',
165+
hideCTA && 'pt-10'
166+
)}
165167
>
166168
{!hideCTA && <FooterCTA />}
167169
<div className='relative px-[1.6vw] sm:px-8 lg:px-16'>

apps/sim/app/(landing)/components/templates/templates.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export default function Templates() {
300300
setIsPreparingTemplate(false)
301301
trackLandingCta({
302302
label: activeWorkflow.name,
303-
section: 'landing_preview',
303+
section: 'templates',
304304
destination: '/signup',
305305
})
306306
router.push('/signup')

apps/sim/app/(landing)/integrations/[slug]/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function buildFAQs(integration: Integration): FAQItem[] {
9797
},
9898
{
9999
question: `How do I connect ${name} to Sim?`,
100-
answer: `Getting started takes under five minutes: (1) Create a free account at sim.ai. (2) Open your workspace and create an agent. (3) Drag a ${name} block onto the canvas. (4) ${authStep} (5) Choose the tool you want to use, wire it to the inputs you need, and click Run. Your agent is live.`,
100+
answer: `Getting started takes under five minutes: (1) Create a free account at sim.ai. (2) Open your workspace and create an agent. (3) Drag a ${name} block onto the workflow builder. (4) ${authStep} (5) Choose the tool you want to use, wire it to the inputs you need, and click Run. Your agent is live.`,
101101
},
102102
{
103103
question: `Can I use ${name} as a tool inside an AI agent in Sim?`,
@@ -262,7 +262,7 @@ export default async function IntegrationPage({ params }: { params: Promise<{ sl
262262
'@type': 'HowToStep',
263263
position: 2,
264264
name: `Add a ${name} block`,
265-
text: `Open your workspace, drag a ${name} block onto the canvas, and authenticate with your ${name} credentials.`,
265+
text: `Open your workspace, drag a ${name} block onto the workflow builder, and authenticate with your ${name} credentials.`,
266266
},
267267
{
268268
'@type': 'HowToStep',
@@ -455,10 +455,10 @@ export default async function IntegrationPage({ params }: { params: Promise<{ sl
455455
title: `Add a ${name} block`,
456456
body:
457457
authType === 'oauth'
458-
? `Open your workspace, drag a ${name} block onto the canvas, and connect your account with one-click OAuth.`
458+
? `Open your workspace, drag a ${name} block onto the workflow builder, and connect your account with one-click OAuth.`
459459
: authType === 'api-key'
460-
? `Open your workspace, drag a ${name} block onto the canvas, and paste in your ${name} API key.`
461-
: `Open your workspace, drag a ${name} block onto the canvas, and authenticate your account.`,
460+
? `Open your workspace, drag a ${name} block onto the workflow builder, and paste in your ${name} API key.`
461+
: `Open your workspace, drag a ${name} block onto the workflow builder, and authenticate your account.`,
462462
},
463463
{
464464
step: '03',

apps/sim/app/llms-full.txt/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Built-in table creation and management:
123123
124124
### Frontend
125125
- Next.js 15 with App Router
126-
- React Flow for canvas visualization
126+
- React Flow for the visual builder
127127
- Tailwind CSS for styling
128128
- Zustand for state management
129129
@@ -143,7 +143,7 @@ Built-in table creation and management:
143143
144144
1. **Sign Up**: Create a free account at ${baseUrl}
145145
2. **Create Workspace**: Set up your first workspace
146-
3. **Build Workflow**: Drag blocks onto canvas and connect them
146+
3. **Build Workflow**: Drag blocks onto the workflow builder and connect them
147147
4. **Configure Blocks**: Set up LLM providers, tools, and integrations
148148
5. **Test**: Run the workflow manually to verify
149149
6. **Deploy**: Set up triggers for automated execution

apps/sim/lib/posthog/events.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface PostHogEventMap {
2323
| 'pricing'
2424
| 'features'
2525
| 'collaboration'
26+
| 'templates'
2627
| 'landing_preview'
2728
| 'integrations'
2829
destination: 'auth_modal' | 'demo_modal' | '/signup' | '/login' | '/workspace' | (string & {})

0 commit comments

Comments
 (0)