diff --git a/frontend/packages/app/components/sidebar.tsx b/frontend/packages/app/components/sidebar.tsx index 8b091f66c..0d2a2f3cd 100644 --- a/frontend/packages/app/components/sidebar.tsx +++ b/frontend/packages/app/components/sidebar.tsx @@ -9,6 +9,7 @@ import { } from '@mintter/shared' import { Button, + Home, ListItem, ListItemProps, Separator, @@ -158,6 +159,17 @@ function FullAppSidebar() { )} + + { + navigate({key: 'feed', tab: 'trusted'}) + }} + title="Home Feed" + bold + icon={Home} + /> + + + + Home Feed + + {subtitle} + + ) + } + if (route.key === 'documents') { let subtitle: string | null = null if (route.tab === 'drafts') { diff --git a/frontend/packages/app/models/feed.ts b/frontend/packages/app/models/feed.ts new file mode 100644 index 000000000..ace71b21d --- /dev/null +++ b/frontend/packages/app/models/feed.ts @@ -0,0 +1,16 @@ +import {useQuery} from '@tanstack/react-query' +import {useGRPCClient} from '../app-context' +import {queryKeys} from './query-keys' + +export function useFeed() { + const grpcClient = useGRPCClient() + return useQuery({ + queryKey: [queryKeys.FEED], + queryFn: async () => { + return await grpcClient.activityFeed.listEvents({ + pageSize: 100, + pageToken: '', + }) + }, + }) +} diff --git a/frontend/packages/app/models/query-keys.ts b/frontend/packages/app/models/query-keys.ts index 72dc22c1c..d07a8d241 100644 --- a/frontend/packages/app/models/query-keys.ts +++ b/frontend/packages/app/models/query-keys.ts @@ -8,6 +8,9 @@ export const queryKeys = { // NOTE: Arguments to query keys documented in comments + // feed + FEED: 'FEED', + // daemon GET_DAEMON_INFO: 'GET_DAEMON_INFO', diff --git a/frontend/packages/app/pages/feed.tsx b/frontend/packages/app/pages/feed.tsx new file mode 100644 index 000000000..52f380fa6 --- /dev/null +++ b/frontend/packages/app/pages/feed.tsx @@ -0,0 +1,56 @@ +import { + Globe, + PageContainer, + RadioButtons, + SizableText, + XStack, + YStack, +} from '@mintter/ui' +import {Verified} from '@tamagui/lucide-icons' +import Footer from '../components/footer' +import {MainWrapperNoScroll} from '../components/main-wrapper' +import {useFeed} from '../models/feed' +import {useNavRoute} from '../utils/navigation' +import {useNavigate} from '../utils/useNavigate' + +const feedTabsOptions = [ + {key: 'trusted', label: 'Trusted Content', icon: Verified}, + {key: 'all', label: 'All Content', icon: Globe}, +] as const + +function Feed({tab}: {tab: 'trusted' | 'all'}) { + const feed = useFeed() + console.log(feed.data) + return ( + + {tab} + + ) +} + +export default function FeedPage() { + const route = useNavRoute() + if (route.key !== 'feed') throw new Error('invalid route') + const replace = useNavigate('replace') + return ( + <> + + + + + { + replace({...route, tab}) + }} + /> + + + + + +