묶음 E — V2-4b pull 확장:
- CloudSyncService.pullAll()에 meetings/meeting_memos/meeting_documents 추가
- meetings: LWW, 모든 컬럼 매핑 (minutes_json JSON 직렬화)
- meeting_memos: immutable INSERT-only 전략
- meeting_documents: LWW UPDATE
묶음 F — api-client types:
- interface -> type alias 전환 (11개)
- Database 타입에 TypedTable<Row, Insert, Update> 유틸 도입
(Row & Record<string, unknown> 교차로 GenericTable 제약 만족)
- @supabase/ssr 2.102는 supabase-js 버전 불일치로 제네릭 주입 불가 -
다음 사이클로 이월, api-client index.ts는 types만 재수출
묶음 G — apps/mobile UI 교체:
- login.tsx: MetalCard + PhosphorText(hero/label) + PhysicalButton
- meetings.tsx: MetalCard + Led(status) + PhosphorText(body/meta)
- record.tsx: Led + PhosphorText + PhysicalButton
- profile.tsx: MetalCard + PhysicalButton(danger) + d3roNativePalette
묶음 H — V2-7b 이메일 invite flow:
- migrations/20260410000001_team_invites.sql
- team_invites 테이블 (token, email, role, expires_at 7일)
- RLS: 같은 팀 멤버 + 초대 이메일 소유자 SELECT,
owner/admin만 INSERT/DELETE
- generate_invite_token() SECURITY DEFINER RPC (service_role)
- functions/team-invite: 권한 체크 -> 토큰 생성 -> 초대 URL 반환
- functions/team-accept: 토큰 검증 -> expires_at/accepted_at/이메일 일치 ->
team_members upsert -> 초대 accepted 표시
- config.toml에 team-invite/team-accept 함수 등록
- InviteMemberForm 재작성: 이메일 입력 + 역할 선택 -> URL 복사 UI
- /accept-invite 페이지 신규 (Suspense 내 useSearchParams + token 수락)
묶음 I — Realtime transcripts:
- apps/web/components/meetings/live-transcript-list.tsx (client)
- supabase.channel('transcripts:meeting:${id}').on('postgres_changes')
- INSERT -> 세그먼트 추가, UPDATE -> row 교체
- 중복 방지 segment_index 기준
- edited 배지 표시
- meetings/[id]/page.tsx의 transcript 섹션을 LiveTranscriptList로 교체
묶음 J — 테스트:
- packages/api-client/__tests__/client.test.ts (9 tests)
- createD3roSupabaseClient, isClientConfigured 팩토리 검증
- packages/api-client/__tests__/types.test.ts (10 tests)
- 모든 Row 타입 + 리터럴 union + Database keyof
- vitest.config.ts 신규
- apps/web/playwright.config.ts 신규 (baseURL, webServer dev 서버)
- apps/web/e2e/smoke.spec.ts 신규 (6 스모크 테스트)
- apps/web tsconfig exclude에 e2e/playwright.config.ts 추가
- package.json scripts: test, test:e2e, test:e2e:ui
검증:
- desktop typecheck OK
- web typecheck OK
- web next build OK (12 라우트, /accept-invite Suspense 적용)
- desktop build OK
- api-client test 19 passed
115 lines
3.3 KiB
TypeScript
115 lines
3.3 KiB
TypeScript
// apps/mobile/app/login.tsx
|
|
// OAuth 로그인 화면 — @d3ro/ui-native 사용
|
|
|
|
import { useState } from 'react'
|
|
import { View, StyleSheet, Alert } from 'react-native'
|
|
import * as WebBrowser from 'expo-web-browser'
|
|
import * as Linking from 'expo-linking'
|
|
import { MetalCard, PhosphorText, PhysicalButton, d3roNativePalette } from '@d3ro/ui-native'
|
|
import { supabase, isSupabaseConfigured } from '../lib/supabase'
|
|
|
|
WebBrowser.maybeCompleteAuthSession()
|
|
|
|
export default function LoginScreen(): React.ReactElement {
|
|
const [busy, setBusy] = useState(false)
|
|
const configured = isSupabaseConfigured()
|
|
|
|
async function signInWithProvider(provider: 'google' | 'github'): Promise<void> {
|
|
if (!configured) {
|
|
Alert.alert('미설정', 'Supabase 환경변수가 설정되지 않았습니다.')
|
|
return
|
|
}
|
|
setBusy(true)
|
|
try {
|
|
const redirectTo = Linking.createURL('auth-callback')
|
|
const { data, error } = await supabase.auth.signInWithOAuth({
|
|
provider,
|
|
options: { redirectTo, skipBrowserRedirect: true }
|
|
})
|
|
|
|
if (error || !data.url) {
|
|
Alert.alert('로그인 실패', error?.message ?? 'OAuth URL을 받지 못했습니다')
|
|
return
|
|
}
|
|
|
|
const result = await WebBrowser.openAuthSessionAsync(data.url, redirectTo)
|
|
if (result.type === 'success' && result.url) {
|
|
const url = new URL(result.url)
|
|
const code = url.searchParams.get('code')
|
|
if (code) {
|
|
const { error: exchangeErr } = await supabase.auth.exchangeCodeForSession(code)
|
|
if (exchangeErr) {
|
|
Alert.alert('세션 교환 실패', exchangeErr.message)
|
|
}
|
|
}
|
|
}
|
|
} finally {
|
|
setBusy(false)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<MetalCard style={styles.card}>
|
|
<View style={styles.header}>
|
|
<PhosphorText variant="hero">D3RO VOICE</PhosphorText>
|
|
<PhosphorText variant="label" color="secondary" style={styles.subtitle}>
|
|
AI 음성 어시스턴트
|
|
</PhosphorText>
|
|
</View>
|
|
|
|
{!configured && (
|
|
<View style={styles.warningBox}>
|
|
<PhosphorText variant="small" color="label">
|
|
Supabase가 설정되지 않았습니다. app.json의 extra 필드를 확인하세요.
|
|
</PhosphorText>
|
|
</View>
|
|
)}
|
|
|
|
<View style={styles.buttons}>
|
|
<PhysicalButton
|
|
label="Google로 계속하기"
|
|
variant="primary"
|
|
disabled={!configured || busy}
|
|
onPress={() => void signInWithProvider('google')}
|
|
/>
|
|
<PhysicalButton
|
|
label="GitHub로 계속하기"
|
|
variant="secondary"
|
|
disabled={!configured || busy}
|
|
onPress={() => void signInWithProvider('github')}
|
|
/>
|
|
</View>
|
|
</MetalCard>
|
|
</View>
|
|
)
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: d3roNativePalette.bg.app,
|
|
justifyContent: 'center',
|
|
padding: 24
|
|
},
|
|
card: {
|
|
padding: 32
|
|
},
|
|
header: {
|
|
alignItems: 'center',
|
|
marginBottom: 32
|
|
},
|
|
subtitle: {
|
|
marginTop: 8
|
|
},
|
|
warningBox: {
|
|
borderWidth: 1,
|
|
borderColor: d3roNativePalette.tag.orange,
|
|
padding: 12,
|
|
borderRadius: 8,
|
|
marginBottom: 16
|
|
},
|
|
buttons: {
|
|
gap: 12
|
|
}
|
|
})
|