diff --git a/src/views/CampaignDetail/ArticleFeeds/MainFeed/gql.ts b/src/views/CampaignDetail/ArticleFeeds/MainFeed/gql.ts index 7a6508b378..0b87aa36af 100644 --- a/src/views/CampaignDetail/ArticleFeeds/MainFeed/gql.ts +++ b/src/views/CampaignDetail/ArticleFeeds/MainFeed/gql.ts @@ -21,6 +21,7 @@ export const CAMPAIGN_ARTICLES_PUBLIC = gql` edges { cursor featured + announcement node { id campaigns { diff --git a/src/views/CampaignDetail/ArticleFeeds/MainFeed/index.tsx b/src/views/CampaignDetail/ArticleFeeds/MainFeed/index.tsx index 148a6de4f2..30185f0b7e 100644 --- a/src/views/CampaignDetail/ArticleFeeds/MainFeed/index.tsx +++ b/src/views/CampaignDetail/ArticleFeeds/MainFeed/index.tsx @@ -49,17 +49,21 @@ const getArticleStage = (article: CampaignArticlesPublicQueryArticle) => { return stage } -const getArticleStageName = ( +const getLabel = ( article: CampaignArticlesPublicQueryArticle, - lang: string + lang: string, + announcement: boolean ) => { const stage = getArticleStage(article) - // announcement if nullish - if (!stage) { + if (announcement) { return } + if (!stage) { + return '' + } + return stage[ `name${lang === 'en' ? 'En' : lang === 'zh-Hans' ? 'ZhHans' : 'ZhHant'}` ] @@ -218,20 +222,22 @@ const MainFeed = ({ feedType, camapign }: MainFeedProps) => { return ( - {edges.map(({ node, featured }, i) => ( + {edges.map(({ node, featured, announcement }, i) => ( - {(isAll || isFeatured) && ( + {(isAll || + isFeatured || + getLabel(node, lang, announcement)) && ( - {getArticleStageName(node, lang)} + {getLabel(node, lang, announcement)} )} {!isFeatured && featured && }