From 2f816c5e8652ef8fe4779b5cb6fb0062563e9aae Mon Sep 17 00:00:00 2001 From: Peter Hozak Date: Sat, 17 Aug 2024 08:59:40 +0200 Subject: [PATCH] use list table in section and subsections, but not articles #755 --- app/components/Article/KeepGoing/index.tsx | 45 ++++++++++++---------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/app/components/Article/KeepGoing/index.tsx b/app/components/Article/KeepGoing/index.tsx index 54f4bb53..e7d2e80f 100644 --- a/app/components/Article/KeepGoing/index.tsx +++ b/app/components/Article/KeepGoing/index.tsx @@ -8,7 +8,7 @@ import type {Question, RelatedQuestion} from '~/server-utils/stampy' import {questionUrl} from '~/routesMapper' import styles from './keepGoing.module.css' -const nonContinueSections = ['8TJV'] +const sectionsWithListTable = ['8TJV'] type NextArticleProps = { section?: TOCItem @@ -43,7 +43,12 @@ export const KeepGoing = ({pageid, relatedQuestions}: Question) => { const section = findSection(location?.state?.section || pageid) const next = getNext(pageid, section?.pageid) const hasRelated = relatedQuestions && relatedQuestions.length > 0 - const skipNext = nonContinueSections.includes(section?.pageid || '') + const showListTable = + // used on section and sub-sections, but not on leaf articles + sectionsWithListTable.includes(pageid) || + (section && + sectionsWithListTable.includes(section.pageid) && + section.children?.some((c) => c.pageid == pageid)) const formatRelated = (hasIcon: boolean) => (related: RelatedQuestion) => { const relatedSection = findSection(related.pageid) @@ -54,25 +59,23 @@ export const KeepGoing = ({pageid, relatedQuestions}: Question) => { return (
- {!skipNext && ( - - )} - - {next && hasRelated && !skipNext && ( -
Or jump to a related question
- )} - {hasRelated && !skipNext && ( -
- -
- )} - {skipNext && ( -
- -
+ {showListTable ? ( + + ) : ( + <> + + {next && hasRelated && ( +
Or jump to a related question
+ )} + {hasRelated && ( +
+ +
+ )} + )}
)