This repository has been archived by the owner on Jan 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ab99a9
commit 875cc4f
Showing
14 changed files
with
228 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: '', | ||
}) | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<YStack f={1}> | ||
<SizableText>{tab}</SizableText> | ||
</YStack> | ||
) | ||
} | ||
|
||
export default function FeedPage() { | ||
const route = useNavRoute() | ||
if (route.key !== 'feed') throw new Error('invalid route') | ||
const replace = useNavigate('replace') | ||
return ( | ||
<> | ||
<MainWrapperNoScroll> | ||
<YStack f={1}> | ||
<PageContainer> | ||
<XStack> | ||
<RadioButtons | ||
value={route.tab} | ||
options={feedTabsOptions} | ||
onValue={(tab) => { | ||
replace({...route, tab}) | ||
}} | ||
/> | ||
</XStack> | ||
</PageContainer> | ||
<Feed tab={route.tab} /> | ||
</YStack> | ||
</MainWrapperNoScroll> | ||
<Footer /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.