From 685c86da394eaae91d9d22c64fb3781c2a03565f Mon Sep 17 00:00:00 2001 From: mantikoros Date: Thu, 17 Feb 2022 01:04:16 -0600 Subject: [PATCH] fast follow folds --- web/components/follow-fold-button.tsx | 2 +- web/components/tags-list.tsx | 16 +++++++-- web/lib/firebase/folds.ts | 6 ++-- web/pages/home.tsx | 48 ++++++++++++++++----------- 4 files changed, 46 insertions(+), 26 deletions(-) diff --git a/web/components/follow-fold-button.tsx b/web/components/follow-fold-button.tsx index 106b2489..f394aae9 100644 --- a/web/components/follow-fold-button.tsx +++ b/web/components/follow-fold-button.tsx @@ -11,7 +11,7 @@ export function FollowFoldButton(props: { fold: Fold; className?: string }) { const following = useFollowingFold(fold, user) const onFollow = () => { - if (user) followFold(fold, user) + if (user) followFold(fold.id, user.id) } const onUnfollow = () => { diff --git a/web/components/tags-list.tsx b/web/components/tags-list.tsx index e307c577..16cf5357 100644 --- a/web/components/tags-list.tsx +++ b/web/components/tags-list.tsx @@ -1,4 +1,6 @@ import clsx from 'clsx' +import { useUser } from '../hooks/use-user' +import { followFold } from '../lib/firebase/folds' import { Row } from './layout/row' import { SiteLink } from './site-link' @@ -44,9 +46,19 @@ export function TagsList(props: { ) } -export function FoldTag(props: { fold: { slug: string; name: string } }) { - const { fold } = props +export function FoldTag(props: { + fold: { slug: string; name: string } + isFollowButton?: boolean +}) { + const { fold, isFollowButton } = props const { slug, name } = fold + const user = useUser() + const onClick = isFollowButton + ? async () => { + await followFold(fold.id, user.id) + } + : undefined + return (
- - - + @@ -173,4 +154,31 @@ const Home = (props: { ) } +const FastFoldFollowing = () => { + return ( + <> + + + + + ) +} + export default Home