From a5b6765cf68169c91837a0b04d91561c87cf77f0 Mon Sep 17 00:00:00 2001 From: ttang Date: Thu, 12 Oct 2023 11:24:39 +0800 Subject: [PATCH] feat: channel tag filter --- apps/u3/src/components/social/AddPostForm.tsx | 26 ++++---- .../src/components/social/ChannelSelect.tsx | 66 ++++++++++++------- .../src/components/social/SocialPageNav.tsx | 4 +- apps/u3/src/utils/social/getChannel.ts | 2 +- 4 files changed, 62 insertions(+), 36 deletions(-) diff --git a/apps/u3/src/components/social/AddPostForm.tsx b/apps/u3/src/components/social/AddPostForm.tsx index 6564ecec..72250361 100644 --- a/apps/u3/src/components/social/AddPostForm.tsx +++ b/apps/u3/src/components/social/AddPostForm.tsx @@ -44,6 +44,7 @@ import useLogin from '../../hooks/useLogin'; import getAvatar from '../../utils/lens/getAvatar'; import { Channel } from '../../services/types/farcaster'; import ChannelSelect from './ChannelSelect'; +import { getChannelFromName } from '../../utils/social/getChannel'; export default function AddPostForm({ onSuccess, @@ -141,6 +142,11 @@ export default function AddPostForm({ const handleSubmitToFarcaster = useCallback(async () => { if (!text || !encryptedSigner) return; const currFid = getCurrFid(); + let parentUrl; + if (channelValue !== 'Home') { + const ch = getChannelFromName(channelValue); + parentUrl = ch?.parent_url; + } try { const uploadedLinks = await uploadSelectedImages(); // eslint-disable-next-line no-underscore-dangle @@ -152,8 +158,7 @@ export default function AddPostForm({ embedsDeprecated: [], mentions: [], mentionsPositions: [], - parentUrl: - channelValue === 'Home' ? undefined : channel?.parent_url, + parentUrl, }, { fid: currFid, network: FARCASTER_NETWORK }, encryptedSigner @@ -330,15 +335,14 @@ export default function AddPostForm({ - {channel && ( - { - setChannelValue(v); - }} - /> - )} + + { + setChannelValue(v); + }} + />