From 68f1b23d7ac9aac1f6579f717b79820091b8e59b Mon Sep 17 00:00:00 2001 From: cyrbuzz Date: Thu, 12 Mar 2026 13:42:18 +0800 Subject: [PATCH] feat: replace to forum card --- .../components/ForumCard/ForumCard.tsx | 122 +++++++++--------- 1 file changed, 59 insertions(+), 63 deletions(-) diff --git a/src/pages/dashboard/components/ForumCard/ForumCard.tsx b/src/pages/dashboard/components/ForumCard/ForumCard.tsx index d2709d07f..b1ddc3472 100644 --- a/src/pages/dashboard/components/ForumCard/ForumCard.tsx +++ b/src/pages/dashboard/components/ForumCard/ForumCard.tsx @@ -1,74 +1,70 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: Apache-2.0 -import { useEffect, useState } from 'react'; import { BsChatLeftDots } from 'react-icons/bs'; -import { IGetLatestTopics, useForumApis } from '@hooks/useForumApis'; import { SubqlCard, Typography } from '@subql/components'; -import { renderAsync } from '@subql/react-hooks'; -import { parseError } from '@utils'; -import { Skeleton } from 'antd'; import Link from 'antd/es/typography/Link'; -import dayjs from 'dayjs'; -export const ForumCard = () => { - const forumApis = useForumApis(); - const [topics, setTopics] = useState([]); - - const getTopics = async () => { - const res = await forumApis.getLatestApi(); - - setTopics(res.slice(0, 5)); - }; +const DISCORD_CHANNELS = [ + { + id: '1479054492501672007', + title: 'General', + url: 'https://discord.com/channels/796198414798028831/1479054492501672007', + }, + { + id: '1479055557817008149', + title: 'Subquery-foundation', + url: 'https://discord.com/channels/796198414798028831/1479055557817008149', + }, + { + id: '1479308156365701191', + title: 'Technical-support', + url: 'https://discord.com/channels/796198414798028831/1479308156365701191', + }, + { + id: '1479308193426444348', + title: 'Questions-feedback', + url: 'https://discord.com/channels/796198414798028831/1479308193426444348', + }, + { + id: '1479308237944651888', + title: 'Mainnet-discussions', + url: 'https://discord.com/channels/796198414798028831/1479308237944651888', + }, +]; - useEffect(() => { - getTopics(); - }, []); - - return renderAsync( - { - loading: !!!topics.length, - data: !topics.length ? undefined : topics, - }, - { - loading: () => , - error: (e) => <>{parseError(e)}, - data: (topics) => { - return ( - - Forum - +export const ForumCard = () => { + return ( + + Discord + + + } + width={302} + > +
+ {DISCORD_CHANNELS.map((channel) => { + return ( + + + #{channel.title} - } - width={302} - > -
- {topics.map((topic) => { - return ( - - - {topic.title} - - - {dayjs(topic.last_posted_at || topic.created_at) - .utc(true) - .fromNow()} - - - ); - })} - View Forum -
- - ); - }, - }, + + ); + })} + + Join Discord + +
+
); };