feat: Implement mobile application and lead processing utilities.

This commit is contained in:
2026-02-19 14:21:51 +01:00
parent fca42db4d2
commit c53a71a5f9
120 changed files with 24080 additions and 851 deletions

View File

@@ -1,22 +1,28 @@
import { trpc } from '@/lib/trpc'
import { useState } from 'react'
import { MOCK_NEWS } from '@/lib/mock-data'
import { useNewsReadStore } from '@/store/news.store'
export function useNewsList(kategorie?: string) {
return trpc.news.list.useQuery({
kategorie: kategorie as never,
})
const localReadIds = useNewsReadStore((s) => s.readIds)
const filtered = kategorie
? MOCK_NEWS.filter((n) => n.kategorie === kategorie)
: MOCK_NEWS
const data = filtered.map((n) => ({
...n,
isRead: n.isRead || localReadIds.has(n.id),
}))
return { data, isLoading: false, refetch: () => {}, isRefetching: false }
}
export function useNewsDetail(id: string) {
const markRead = useNewsReadStore((s) => s.markRead)
const markReadMutation = trpc.news.markRead.useMutation()
const query = trpc.news.byId.useQuery({ id })
const news = MOCK_NEWS.find((n) => n.id === id) ?? null
function onOpen() {
markRead(id)
markReadMutation.mutate({ newsId: id })
}
return { ...query, onOpen }
return { data: news, isLoading: false, onOpen }
}