feat(V2-6/V2-7/V2-8): Mobile MVP + Teams + Billing 스캐폴딩
V2-6 — Mobile (Expo) MVP
- apps/mobile/ 신규, npm workspace에서 제외 (Expo deps 부담 회피)
- Expo SDK 51 + Expo Router + AsyncStorage Supabase 클라이언트
- 화면: index/login/(tabs)/{meetings,record,profile}
- expo-av로 녹음 → Edge Function stt-proxy 호출
- expo-web-browser + expo-linking으로 OAuth 콜백 처리
- README에 setup/EAS build 가이드
- 루트 package.json workspaces를 명시 나열로 변경 (apps/mobile 제외)
V2-7 — 팀 기능 (Web)
- apps/web/src/app/teams/page.tsx — 가입한 팀 카드 그리드
- apps/web/src/app/teams/[id]/page.tsx — 멤버 + 공유 회의
- components/teams/create-team-form.tsx — 팀 생성 + owner 자동 team_members
- components/teams/invite-member-form.tsx — user_id 직접 초대 (V2-7b에서 invite flow)
- Sidebar에 Teams/Billing 메뉴 + 아이콘
- ko.json에 nav.teams/nav.billing 키 추가
- V2-2 teams/team_members RLS 활용
V2-8 — 결제 스캐폴딩
- apps/web/src/app/billing/page.tsx — Free/Pro/Team 가격표 + 현재 구독
- components/billing/checkout-button.tsx — Edge Function 호출 후 redirect
- server/supabase/functions/stripe-checkout/index.ts:
- JWT 인증 -> 기존 customer 조회/생성 -> Checkout Session 생성
- subscriptions 테이블에 customer_id upsert
- server/supabase/functions/stripe-webhook/index.ts:
- checkout.session.completed -> subscriptions tier=pro/team active
- customer.subscription.updated/created -> status/period 업데이트
- customer.subscription.deleted -> tier=free, status=canceled
- signature 검증은 placeholder (V2-8b에서 정식)
- server/supabase/config.toml에 두 함수 등록 (webhook verify_jwt=false)
검증:
- desktop typecheck OK (회귀 없음)
- web typecheck OK
- web next build OK (11 라우트)
- mobile은 별도 install 필요 (workspace 제외)
memory/project_status.md 갱신 — V2 마스터 플랜 전 페이즈 로컬 완료
This commit is contained in:
parent
5c0f4a2b98
commit
61a96b3e9b
136 changed files with 2641 additions and 251 deletions
110
apps/web/src/components/teams/create-team-form.tsx
Normal file
110
apps/web/src/components/teams/create-team-form.tsx
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
'use client'
|
||||
|
||||
// apps/web/src/components/teams/create-team-form.tsx
|
||||
// 새 팀 생성 폼
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { Box, Button, TextField, Stack, Alert } from '@mui/material'
|
||||
import AddIcon from '@mui/icons-material/Add'
|
||||
import { MetalCard } from '@d3ro/ui/components/ds'
|
||||
import { d3roPalette, typoSx } from '@d3ro/ui/theme'
|
||||
import { getSupabaseBrowserClient } from '@/lib/supabase-browser'
|
||||
|
||||
export function CreateTeamForm(): React.ReactElement {
|
||||
const router = useRouter()
|
||||
const [name, setName] = useState('')
|
||||
const [open, setOpen] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [busy, setBusy] = useState(false)
|
||||
|
||||
async function handleCreate(): Promise<void> {
|
||||
if (!name.trim()) return
|
||||
setError(null)
|
||||
setBusy(true)
|
||||
try {
|
||||
const supabase = getSupabaseBrowserClient()
|
||||
const {
|
||||
data: { user }
|
||||
} = await supabase.auth.getUser()
|
||||
if (!user) {
|
||||
setError('로그인이 필요합니다')
|
||||
return
|
||||
}
|
||||
|
||||
// teams 테이블 INSERT
|
||||
const { data: team, error: teamErr } = await supabase
|
||||
.from('teams')
|
||||
.insert({ name: name.trim(), owner_id: user.id })
|
||||
.select('id')
|
||||
.single()
|
||||
|
||||
if (teamErr || !team) {
|
||||
setError(teamErr?.message ?? '팀 생성 실패')
|
||||
return
|
||||
}
|
||||
|
||||
// owner를 team_members에 추가 (RLS owner 권한)
|
||||
const { error: memberErr } = await supabase
|
||||
.from('team_members')
|
||||
.insert({ team_id: (team as { id: string }).id, user_id: user.id, role: 'owner' })
|
||||
|
||||
if (memberErr) {
|
||||
setError(`멤버 등록 실패: ${memberErr.message}`)
|
||||
return
|
||||
}
|
||||
|
||||
setName('')
|
||||
setOpen(false)
|
||||
router.refresh()
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
if (!open) {
|
||||
return (
|
||||
<Button variant="outlined" startIcon={<AddIcon />} onClick={() => setOpen(true)}>
|
||||
새 팀 만들기
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<MetalCard sx={{ p: 3, maxWidth: 480 }}>
|
||||
<Box sx={{ ...typoSx('label'), color: d3roPalette.text.label, mb: 1 }}>새 팀 생성</Box>
|
||||
<Stack spacing={2}>
|
||||
<TextField
|
||||
autoFocus
|
||||
label="팀 이름"
|
||||
size="small"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
fullWidth
|
||||
disabled={busy}
|
||||
/>
|
||||
{error && (
|
||||
<Alert severity="error" variant="outlined">
|
||||
{error}
|
||||
</Alert>
|
||||
)}
|
||||
<Stack direction="row" spacing={1}>
|
||||
<Button variant="contained" onClick={() => void handleCreate()} disabled={busy || !name.trim()}>
|
||||
생성
|
||||
</Button>
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={() => {
|
||||
setOpen(false)
|
||||
setName('')
|
||||
setError(null)
|
||||
}}
|
||||
disabled={busy}
|
||||
>
|
||||
취소
|
||||
</Button>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</MetalCard>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue