import React, { useState, useCallback } from 'react' import { View, Text, FlatList, Modal, TouchableOpacity, StyleSheet, RefreshControl } from 'react-native' import { router, useFocusEffect } from 'expo-router' import { COLORS } from '../../constants/Config' import { getMeetingMinutes } from '../../services/api' import MarkdownViewer from '../../components/MarkdownViewer' export default function MeetingMinutesScreen() { const [items, setItems] = useState([]) const [loading, setLoading] = useState(false) const [detail, setDetail] = useState(null) const load = useCallback(async () => { setLoading(true) try { const r = await getMeetingMinutes(); setItems(r.data?.items ?? r.data ?? []) } catch { setItems([]) } finally { setLoading(false) } }, []) useFocusEffect(useCallback(() => { load() }, [load])) return ( String(i)} refreshControl={} ListEmptyComponent={회의록이 없습니다.} contentContainerStyle={{ padding: 12 }} renderItem={({ item }) => ( setDetail(item)}> {item.title ?? item.subject ?? '회의록'} {item.meeting_date?.slice(0, 10) ?? item.created_at?.slice(0, 10)} · {(item.attendees ?? []).join(', ')} {(item.action_items ?? []).length > 0 && ( 액션 아이템 {item.action_items.length}개 )} )} /> setDetail(null)}>← 닫기 {(detail?.action_items ?? []).length > 0 && ( { setDetail(null); router.push('/(tabs)/meeting_sr') }}> SR 등록 )} {detail?.title ?? '회의록'} ) } const s = StyleSheet.create({ container: { flex: 1, backgroundColor: COLORS.bg }, card: { backgroundColor: '#fff', borderRadius: 10, padding: 14, marginBottom: 8, elevation: 1 }, title: { fontSize: 14, fontWeight: '700', color: COLORS.text, marginBottom: 4 }, meta: { fontSize: 12, color: COLORS.muted }, actions: { fontSize: 12, color: COLORS.accent, marginTop: 4, fontWeight: '600' }, empty: { textAlign: 'center', color: COLORS.muted, marginTop: 40 }, modalContainer: { flex: 1, backgroundColor: '#fff' }, modalHeader: { flexDirection: 'row', justifyContent: 'space-between', padding: 16, borderBottomWidth: 1, borderBottomColor: COLORS.border }, back: { fontSize: 15, color: COLORS.accent, fontWeight: '600' }, srBtn: { fontSize: 15, color: COLORS.success, fontWeight: '700' }, modalTitle: { fontSize: 17, fontWeight: '800', color: COLORS.text, padding: 16, paddingBottom: 0 }, })