Files
sim/apps/sim/app/(auth)/components/sso-login-button.tsx
Waleed 5f1d5e0618 feat(generic): add generic resource tab, refactor home structure, and UI polish (#3803)
* feat(generic): add generic resource tab, refactor home structure, and UI polish

* reverted hardcoded ff

* fix build

* styling consistency

* styling

* fix(auth): extract shared auth button class and align SSO primary style

- Extract AUTH_SUBMIT_BTN constant to (auth)/components/auth-button-classes.ts,
  replacing 10 copy-pasted identical className strings across 7 files
- Update SSOLoginButton primary variant to use AUTH_SUBMIT_BTN instead of
  hardcoded purple gradient, making it consistent with all other auth form
  submit buttons
- Fix missing isEphemeralResource import in lib/copilot/resources.ts
  (was re-exported but not available in local scope)

* fix(auth): replace inline button class in chat auth components with AUTH_SUBMIT_BTN

* fix send button hover state
2026-03-27 00:13:41 -07:00

44 lines
1.1 KiB
TypeScript

'use client'
import { useRouter } from 'next/navigation'
import { Button } from '@/components/emcn'
import { getEnv, isTruthy } from '@/lib/core/config/env'
import { cn } from '@/lib/core/utils/cn'
import { AUTH_SUBMIT_BTN } from '@/app/(auth)/components/auth-button-classes'
interface SSOLoginButtonProps {
callbackURL?: string
className?: string
variant?: 'primary' | 'outline'
}
export function SSOLoginButton({
callbackURL,
className,
variant = 'outline',
}: SSOLoginButtonProps) {
const router = useRouter()
if (!isTruthy(getEnv('NEXT_PUBLIC_SSO_ENABLED'))) {
return null
}
const handleSSOClick = () => {
const ssoUrl = `/sso${callbackURL ? `?callbackUrl=${encodeURIComponent(callbackURL)}` : ''}`
router.push(ssoUrl)
}
const outlineBtnClasses = cn('w-full rounded-[10px]')
return (
<Button
type='button'
onClick={handleSSOClick}
variant={variant === 'outline' ? 'outline' : undefined}
className={cn(variant === 'outline' ? outlineBtnClasses : AUTH_SUBMIT_BTN, className)}
>
Sign in with SSO
</Button>
)
}