feat: Implement news section with list and detail views, category filtering, and unread indicators.
This commit is contained in:
@@ -7,6 +7,7 @@ import { useLocalSearchParams, useRouter } from 'expo-router'
|
||||
import { useEffect } from 'react'
|
||||
import { Ionicons } from '@expo/vector-icons'
|
||||
import { useNewsDetail } from '@/hooks/useNews'
|
||||
import { useNewsReadStore } from '@/store/news.store'
|
||||
import { AttachmentRow } from '@/components/news/AttachmentRow'
|
||||
import { Badge } from '@/components/ui/Badge'
|
||||
import { NEWS_KATEGORIE_LABELS } from '@innungsapp/shared/types'
|
||||
@@ -98,8 +99,14 @@ export default function NewsDetailScreen() {
|
||||
const { id } = useLocalSearchParams<{ id: string }>()
|
||||
const router = useRouter()
|
||||
const { data: news, isLoading, onOpen } = useNewsDetail(id)
|
||||
const markRead = useNewsReadStore((s) => s.markRead)
|
||||
|
||||
useEffect(() => { if (news) onOpen() }, [news?.id])
|
||||
useEffect(() => {
|
||||
if (news) {
|
||||
markRead(news.id) // sofort lokal markieren → Badge weg beim Zurückgehen
|
||||
onOpen()
|
||||
}
|
||||
}, [news?.id])
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
@@ -121,7 +128,7 @@ export default function NewsDetailScreen() {
|
||||
{/* Nav bar */}
|
||||
<View style={styles.navBar}>
|
||||
<TouchableOpacity
|
||||
onPress={() => router.back()}
|
||||
onPress={() => router.navigate('/(app)/news')}
|
||||
style={styles.backBtn}
|
||||
activeOpacity={0.7}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user