diff --git a/src/features/content/renderers/collections/EightPrinciplesRenderers.tsx b/src/features/content/renderers/collections/EightPrinciplesRenderers.tsx index 2df4882..9206290 100644 --- a/src/features/content/renderers/collections/EightPrinciplesRenderers.tsx +++ b/src/features/content/renderers/collections/EightPrinciplesRenderers.tsx @@ -6,6 +6,7 @@ import { moderateScale, verticalScale } from "react-native-size-matters"; import { Colors } from "@/theme"; import { asNumber, asString } from "../helpers/value"; import { CollectionScaffold } from "../shared/CollectionScaffold"; +import { OverviewCard } from "../shared/OverviewCard"; import type { CollectionItemRendererProps, CollectionRendererProps, @@ -24,24 +25,15 @@ export function EightPrinciplesCollectionRenderer( const header = ( - - - - Overview - - - The eight principles include exterior, interior, cold, heat, deficiency, excess, yin and yang. Syndrome differentiation (pattern identification) of the eight principles is an essential paradigm in the Chinese medicine system. - - - Pattern identification of the eight principles aims to tell about the disease location, the pathogenic nature and the strength between antipathogenic qi and pathogenic factors, thus generalizing the condition into eight categories. - - - The eight principles can be divided into four pairs: interior/exterior for the depth of pathogens; cold/heat for the disease nature; deficiency/excess for the strength between antipathogenic qi and pathogenic factors; and yin/yang for the preponderance of yin and yang. However, yin and yang can also generalize the other six principles: exterior, heat and excess are ascribed to yang, and interior, cold and deficiency to yin. - - - Two or more principles may occur concurrently, such as an exterior cold syndrome and an interior deficiency cold syndrome. A combined deficiency and excess may also be present. The principles may transform into each other as well, such as cold transforming into heat, or the exterior entering the interior. Additionally, a true cold may sometimes manifest as a false heat or vice versa. - - + Eight Principles ); @@ -111,35 +103,8 @@ const styles = StyleSheet.create({ marginBottom: verticalScale(14), }, overviewCard: { - backgroundColor: "#FFFFFF", - borderRadius: moderateScale(16), - borderWidth: 1, - borderColor: "#E2EAE5", - padding: moderateScale(16), marginBottom: verticalScale(14), }, - overviewHeader: { - flexDirection: "row", - alignItems: "center", - marginBottom: verticalScale(8), - gap: moderateScale(8), - }, - overviewTitle: { - fontSize: moderateScale(16), - fontWeight: "700", - color: Colors.textPrimary, - }, - overviewText: { - fontSize: moderateScale(13), - lineHeight: verticalScale(19), - color: Colors.textSecondary, - }, - overviewParagraph: { - fontSize: moderateScale(13), - lineHeight: verticalScale(19), - color: Colors.textSecondary, - marginTop: verticalScale(10), - }, sectionHeading: { fontSize: moderateScale(15), fontWeight: "700", diff --git a/src/features/content/renderers/collections/FiveElementsRenderers.tsx b/src/features/content/renderers/collections/FiveElementsRenderers.tsx index 7830396..8f05805 100644 --- a/src/features/content/renderers/collections/FiveElementsRenderers.tsx +++ b/src/features/content/renderers/collections/FiveElementsRenderers.tsx @@ -7,6 +7,7 @@ import { Colors } from "@/theme"; import { asNumber, asString } from "../helpers/value"; import { CollectionScaffold } from "../shared/CollectionScaffold"; import { ContentCountBadge } from "../shared/ContentCountBadge"; +import { OverviewCard } from "../shared/OverviewCard"; import type { CollectionItemRendererProps, CollectionRendererProps, @@ -15,21 +16,14 @@ import type { export function FiveElementsCollectionRenderer(props: CollectionRendererProps) { const header = ( - - - - Overview - - - The identification of patterns according to the Five Elements is based on the pathological changes occurring in dysfunctions of the Generating, Overacting and Insulting sequences of the Five Elements. - - - These patterns describe clinical conditions which are often expressed by the Internal Organ patterns, but in certain cases, Five-Element patterns describe conditions falling outside their scope (such as Deficient Qi of Wood manifesting with timidity and indecision). - - - The sequences below detail the Generating, Overacting, and Insulting relationships and their specific clinical presentations. - - + Sequences ); @@ -51,11 +45,10 @@ export function FiveElementsCardRenderer({ }: CollectionItemRendererProps) { const attributes = item.attributes; const title = asString(attributes.title) || asString(attributes.name) || item.title; - const label = - asString(attributes.content_label) || + const subtitle = + asString(attributes.sub_title) || asString(attributes.description) || - item.summary || - "Open sequence"; + (item.summary && item.summary !== "Open sequence" ? item.summary : null); const sortOrder = asNumber(attributes.sort_order); const sequenceNumber = typeof sortOrder === "number" ? sortOrder + 1 : undefined; @@ -72,9 +65,11 @@ export function FiveElementsCardRenderer({ {title} - - {label} - + {subtitle ? ( + + {subtitle} + + ) : null} - - - - Overview - - - The Four Levels of Diagnosis in Traditional Chinese Medicine (TCM) is a framework mainly used in Warm Disease Theory (Wen Bing), which deals with febrile (heat) diseases caused by external pathogens, especially warm pathogens like viruses or bacteria. It helps practitioners understand the progression of the disease and guide treatment. - - - The interpretation of clinical manifestations of Warm Diseases according to the Four Levels was formulated by Ye Tian Shi. This is a brilliant theory that provides the most clinically useful tool to diagnose, interpret and treat diseases caused by external Wind-Heat and their consequences, whether they are Warm Diseases or not. - - - The theory of the Four Levels is clinically more relevant than that of the Six Stages. For example, one of the most common consequences of an invasion of Wind-Heat is the transformation of external Wind-Heat into interior Phlegm-Heat in the Lungs, causing a chest infection: this situation is contemplated in the Four Levels (corresponding to Lung-Heat, Qi level), while it is not contemplated in the Six Stages. - - - The Qi level contemplates the pattern of Damp-Heat in Stomach and Spleen as a consequence of an invasion of Wind-Heat: this is a very common clinical situation and yet it is one that is not contemplated in the Six Stages. - - - The Blood level includes patterns which are characterized by convulsions from the development of internal Wind: these are typical complications of children’s diseases such as meningitis but they are not contemplated in the Six Stages. - - - The Four Levels are the Defensive Qi, Qi, Nutritive Qi and Blood levels (Wei, Qi, Ying, Xue): the first level is the only exterior one characterized by the presence of the external Wind-Heat on the energetic surface of the body. The other three levels are all interior and all characterized by interior Heat; however, the brilliance of this theory lies in its identification of three different depths of penetration of interior pathogenic Heat. Each level has its own distinctive pathology and treatment. - - + Levels ); @@ -60,11 +48,10 @@ export function FourLevelsCardRenderer({ }: CollectionItemRendererProps) { const attributes = item.attributes; const title = asString(attributes.title) || asString(attributes.name) || item.title; - const label = - asString(attributes.content_label) || + const subtitle = + asString(attributes.sub_title) || asString(attributes.description) || - item.summary || - "Open content"; + (item.summary && item.summary !== "Open content" ? item.summary : null); const sortOrder = asNumber(attributes.sort_order); const levelNumber = typeof sortOrder === "number" ? sortOrder + 1 : undefined; @@ -81,9 +68,11 @@ export function FourLevelsCardRenderer({ {title} - - {label} - + {subtitle ? ( + + {subtitle} + + ) : null} {paragraphs.length > 0 ? ( - - - - Overview - - {paragraphs.map((para, index) => ( - - {para} - - ))} - + ) : null} ); @@ -578,34 +569,4 @@ const styles = StyleSheet.create({ overviewContainer: { marginBottom: verticalScale(14), }, - overviewCard: { - backgroundColor: "#FFFFFF", - borderRadius: moderateScale(16), - borderWidth: 1, - borderColor: "#D7E9DE", - padding: moderateScale(16), - marginTop: verticalScale(12), - }, - overviewHeader: { - flexDirection: "row", - alignItems: "center", - gap: moderateScale(8), - marginBottom: verticalScale(10), - }, - overviewTitle: { - fontSize: moderateScale(15), - fontWeight: "700", - color: Colors.primaryDark, - }, - overviewText: { - fontSize: moderateScale(13), - lineHeight: moderateScale(20), - color: "#374151", - }, - overviewParagraph: { - fontSize: moderateScale(13), - lineHeight: moderateScale(20), - color: "#374151", - marginTop: verticalScale(8), - }, }); diff --git a/src/features/content/renderers/collections/PathogenicFactorsRenderers.tsx b/src/features/content/renderers/collections/PathogenicFactorsRenderers.tsx index 8f202c4..e052083 100644 --- a/src/features/content/renderers/collections/PathogenicFactorsRenderers.tsx +++ b/src/features/content/renderers/collections/PathogenicFactorsRenderers.tsx @@ -6,6 +6,7 @@ import { moderateScale, verticalScale } from "react-native-size-matters"; import { Colors } from "@/theme"; import { asNumber, asString } from "../helpers/value"; import { CollectionScaffold } from "../shared/CollectionScaffold"; +import { OverviewCard } from "../shared/OverviewCard"; import type { CollectionItemRendererProps, CollectionRendererProps, @@ -16,24 +17,15 @@ export function PathogenicFactorsCollectionRenderer( ) { const header = ( - - - - Overview - - - This method of pattern identification is based on the pathological changes occurring when the body is invaded by pathogenic factors such as Wind, Cold, Summer-Heat, Dampness, Dryness and Fire. Each of these pathogenic factors may be exterior or interior. - - - They always correspond to a Full pattern according to the Eight Principles. Indeed, from the Eight-Principle point of view, a Full condition is defined as one characterized by the presence of a pathogenic factor while the body’s Qi is still relatively intact. - - - The pathogenic factor is frequently associated with a Deficiency, in which case the condition is a combined Full–Empty condition. With regard to pathogenic factors, a combined Full-Empty condition can arise in one of two ways: a pathogenic factor can give rise to a Deficiency (e.g. Fire weakens Yin) or a Deficiency can give rise to a pathogenic factor (e.g. Spleen-Qi deficiency gives rise to Dampness). - - - Generally speaking, pathogenic factors are more relevant as patterns of disharmony than as causes of disease. The diagnosis of a pathogenic factor is made not on the basis of the patient’s history, but on the basis of the pattern of symptoms and signs presented. - - + Pathogenic Factors ); @@ -105,35 +97,8 @@ const styles = StyleSheet.create({ marginBottom: verticalScale(14), }, overviewCard: { - backgroundColor: "#FFFFFF", - borderRadius: moderateScale(16), - borderWidth: 1, - borderColor: "#E2EAE5", - padding: moderateScale(16), marginBottom: verticalScale(14), }, - overviewHeader: { - flexDirection: "row", - alignItems: "center", - marginBottom: verticalScale(8), - gap: moderateScale(8), - }, - overviewTitle: { - fontSize: moderateScale(16), - fontWeight: "700", - color: Colors.textPrimary, - }, - overviewText: { - fontSize: moderateScale(13), - lineHeight: verticalScale(19), - color: Colors.textSecondary, - }, - overviewParagraph: { - fontSize: moderateScale(13), - lineHeight: verticalScale(19), - color: Colors.textSecondary, - marginTop: verticalScale(10), - }, sectionHeading: { fontSize: moderateScale(15), fontWeight: "700", diff --git a/src/features/content/renderers/collections/QiBloodRenderers.tsx b/src/features/content/renderers/collections/QiBloodRenderers.tsx index 77b78b4..64b4e0d 100644 --- a/src/features/content/renderers/collections/QiBloodRenderers.tsx +++ b/src/features/content/renderers/collections/QiBloodRenderers.tsx @@ -6,6 +6,7 @@ import { moderateScale, verticalScale } from "react-native-size-matters"; import { Colors } from "@/theme"; import { asNumber, asString } from "../helpers/value"; import { CollectionScaffold } from "../shared/CollectionScaffold"; +import { OverviewCard } from "../shared/OverviewCard"; import { useSingleTemplateContentQuery } from "../../hooks/use-single-template-content-query"; import type { CollectionItemRendererProps, @@ -69,15 +70,7 @@ export function QiBloodCollectionRenderer(props: CollectionRendererProps) { const header = ( - {overviewText ? ( - - - - Overview - - {overviewText} - - ) : null} + {overviewText ? : null} Categories @@ -134,29 +127,6 @@ const styles = StyleSheet.create({ paddingBottom: verticalScale(8), gap: verticalScale(14), }, - overviewCard: { - backgroundColor: "#FFFFFF", - borderRadius: moderateScale(16), - borderWidth: 1, - borderColor: "#E2EAE5", - padding: moderateScale(18), - }, - overviewHeader: { - flexDirection: "row", - alignItems: "center", - marginBottom: verticalScale(10), - gap: moderateScale(8), - }, - overviewTitle: { - fontSize: moderateScale(16), - fontWeight: "700", - color: Colors.textPrimary, - }, - overviewText: { - fontSize: moderateScale(14), - lineHeight: moderateScale(22), - color: Colors.textSecondary, - }, sectionHeading: { fontSize: moderateScale(16), fontWeight: "700", diff --git a/src/features/content/renderers/collections/SixStagesRenderers.tsx b/src/features/content/renderers/collections/SixStagesRenderers.tsx index c316664..d759010 100644 --- a/src/features/content/renderers/collections/SixStagesRenderers.tsx +++ b/src/features/content/renderers/collections/SixStagesRenderers.tsx @@ -6,7 +6,7 @@ import { moderateScale, verticalScale } from "react-native-size-matters"; import { Colors } from "@/theme"; import { asNumber, asString, humanizeKey } from "../helpers/value"; import { CollectionScaffold } from "../shared/CollectionScaffold"; -import { SectionCard } from "../shared/SectionCard"; +import { OverviewCard } from "../shared/OverviewCard"; import type { CollectionItemRendererProps, CollectionRendererProps, @@ -17,9 +17,7 @@ export function SixStagesCollectionRenderer(props: CollectionRendererProps) { const header = overviewText ? ( - - {overviewText} - + ) : null; @@ -93,11 +91,6 @@ const styles = StyleSheet.create({ overviewContainer: { marginBottom: verticalScale(14), }, - overviewText: { - fontSize: moderateScale(14), - lineHeight: moderateScale(22), - color: "#374151", - }, row: { minHeight: moderateScale(68), flexDirection: "row", diff --git a/src/features/content/renderers/details/FiveElementsDetailRenderer.tsx b/src/features/content/renderers/details/FiveElementsDetailRenderer.tsx index f331079..4da5f38 100644 --- a/src/features/content/renderers/details/FiveElementsDetailRenderer.tsx +++ b/src/features/content/renderers/details/FiveElementsDetailRenderer.tsx @@ -8,6 +8,7 @@ import { Colors } from "@/theme"; import type { DetailRendererProps } from "../../types/renderer.types"; import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections"; import { Hero } from "../shared/Hero"; +import { OverviewCard } from "../shared/OverviewCard"; import { Paragraphs } from "../shared/Paragraphs"; import { SectionCard } from "../shared/SectionCard"; import { asRecordArray, asString, asStringArray } from "../helpers/value"; @@ -96,20 +97,7 @@ export function FiveElementsDetailRenderer({ {/* Overview Card (rendered only when overview/content exists in data) */} {overviewParagraphs.length > 0 ? ( - - - - Overview - - {overviewParagraphs.map((para, idx) => ( - 0 && styles.paragraphSpacing]} - > - {para} - - ))} - + ) : null} {/* Dynamic Sequences List from data.sections */} @@ -181,20 +169,7 @@ export function FiveElementsDetailRenderer({ {/* Overview Card (rendered only when overview/content exists in data) */} {overviewParagraphs.length > 0 ? ( - - - - Overview - - {overviewParagraphs.map((para, idx) => ( - 0 && styles.paragraphSpacing]} - > - {para} - - ))} - + ) : null} {/* Collapsible Pattern Cards from data.sections */} @@ -230,32 +205,6 @@ const styles = StyleSheet.create({ paddingBottom: verticalScale(40), gap: verticalScale(14), }, - overviewCard: { - backgroundColor: "#FFFFFF", - borderRadius: moderateScale(16), - borderWidth: 1, - borderColor: "#E2EAE5", - padding: moderateScale(16), - }, - overviewHeader: { - flexDirection: "row", - alignItems: "center", - marginBottom: verticalScale(8), - gap: moderateScale(8), - }, - overviewTitle: { - fontSize: moderateScale(16), - fontWeight: "700", - color: Colors.textPrimary, - }, - overviewText: { - fontSize: moderateScale(13), - lineHeight: verticalScale(19), - color: Colors.textSecondary, - }, - paragraphSpacing: { - marginTop: verticalScale(10), - }, sequencesContainer: { gap: verticalScale(10), }, diff --git a/src/features/content/renderers/details/FourLevelsDetailRenderer.tsx b/src/features/content/renderers/details/FourLevelsDetailRenderer.tsx index 9b704a9..736885b 100644 --- a/src/features/content/renderers/details/FourLevelsDetailRenderer.tsx +++ b/src/features/content/renderers/details/FourLevelsDetailRenderer.tsx @@ -15,6 +15,7 @@ import { BulletList } from "../shared/BulletList"; import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections"; import { ContentValue } from "../shared/ContentValue"; import { Hero } from "../shared/Hero"; +import { OverviewCard } from "../shared/OverviewCard"; import { Paragraphs } from "../shared/Paragraphs"; import { SectionCard } from "../shared/SectionCard"; @@ -115,15 +116,7 @@ export function FourLevelsDetailRenderer({ {/* Direct Overview Card matching Four Levels 1st page */} - {overview ? ( - - - - Overview - - {overview} - - ) : null} + {overview ? : null} {/* Patterns List with numbered cards matching 1st page */} @@ -288,29 +281,6 @@ const styles = StyleSheet.create({ paddingBottom: verticalScale(40), gap: verticalScale(14), }, - overviewCard: { - backgroundColor: "#FFFFFF", - borderRadius: moderateScale(16), - borderWidth: 1, - borderColor: "#E2EAE5", - padding: moderateScale(16), - }, - overviewHeader: { - flexDirection: "row", - alignItems: "center", - marginBottom: verticalScale(8), - gap: moderateScale(8), - }, - overviewTitle: { - fontSize: moderateScale(16), - fontWeight: "700", - color: Colors.textPrimary, - }, - overviewText: { - fontSize: moderateScale(13), - lineHeight: verticalScale(19), - color: Colors.textSecondary, - }, patternsSection: { gap: verticalScale(10), }, diff --git a/src/features/content/renderers/details/QiBloodDetailRenderer.tsx b/src/features/content/renderers/details/QiBloodDetailRenderer.tsx index 61dcec1..1eeb250 100644 --- a/src/features/content/renderers/details/QiBloodDetailRenderer.tsx +++ b/src/features/content/renderers/details/QiBloodDetailRenderer.tsx @@ -8,6 +8,7 @@ import type { DetailRendererProps } from "../../types/renderer.types"; import { BackActionContext } from "../../context/BackActionContext"; import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections"; import { Hero } from "../shared/Hero"; +import { OverviewCard } from "../shared/OverviewCard"; import { SectionCard } from "../shared/SectionCard"; import { BulletList } from "../shared/BulletList"; import { Paragraphs } from "../shared/Paragraphs"; @@ -338,15 +339,7 @@ export function QiBloodDetailRenderer({ {/* Category Overview Card */} - {categoryOverview ? ( - - - - Overview - - {categoryOverview} - - ) : null} + {categoryOverview ? : null} {/* Numbered Patterns List */} {rootPatterns.length > 0 ? ( @@ -390,29 +383,6 @@ const styles = StyleSheet.create({ paddingBottom: verticalScale(40), gap: verticalScale(14), }, - overviewCard: { - backgroundColor: "#FFFFFF", - borderRadius: moderateScale(16), - borderWidth: 1, - borderColor: "#E2EAE5", - padding: moderateScale(18), - }, - overviewHeader: { - flexDirection: "row", - alignItems: "center", - marginBottom: verticalScale(10), - gap: moderateScale(8), - }, - overviewTitle: { - fontSize: moderateScale(16), - fontWeight: "700", - color: Colors.textPrimary, - }, - overviewText: { - fontSize: moderateScale(14), - lineHeight: moderateScale(22), - color: Colors.textSecondary, - }, patternsContainer: { gap: verticalScale(10), }, diff --git a/src/features/content/renderers/details/ThreeBurnersDetailRenderer.tsx b/src/features/content/renderers/details/ThreeBurnersDetailRenderer.tsx index 1c901ee..aeab482 100644 --- a/src/features/content/renderers/details/ThreeBurnersDetailRenderer.tsx +++ b/src/features/content/renderers/details/ThreeBurnersDetailRenderer.tsx @@ -7,6 +7,7 @@ import { Colors } from "@/theme"; import type { DetailRendererProps } from "../../types/renderer.types"; import { BackActionContext } from "../../context/BackActionContext"; import { Hero } from "../shared/Hero"; +import { OverviewCard } from "../shared/OverviewCard"; import { SectionCard } from "../shared/SectionCard"; import { Paragraphs } from "../shared/Paragraphs"; import { BulletList } from "../shared/BulletList"; @@ -457,15 +458,7 @@ export function ThreeBurnersDetailRenderer({ {/* Overview Card */} - {overviewText ? ( - - - - Overview - - {overviewText} - - ) : null} + {overviewText ? : null} {/* Burner Categories (1. Upper Burner, 2. Middle Burner, 3. Lower Burner) */} @@ -505,29 +498,6 @@ const styles = StyleSheet.create({ paddingBottom: verticalScale(40), gap: verticalScale(14), }, - overviewCard: { - backgroundColor: "#FFFFFF", - borderRadius: moderateScale(16), - borderWidth: 1, - borderColor: "#E2EAE5", - padding: moderateScale(16), - }, - overviewHeader: { - flexDirection: "row", - alignItems: "center", - marginBottom: verticalScale(8), - gap: moderateScale(8), - }, - overviewTitle: { - fontSize: moderateScale(16), - fontWeight: "700", - color: Colors.textPrimary, - }, - overviewText: { - fontSize: moderateScale(13), - lineHeight: verticalScale(20), - color: Colors.textSecondary, - }, patternsContainer: { gap: verticalScale(10), }, diff --git a/src/features/content/renderers/details/TwelveChannelsDetailRenderer.tsx b/src/features/content/renderers/details/TwelveChannelsDetailRenderer.tsx index f192a18..b6cce47 100644 --- a/src/features/content/renderers/details/TwelveChannelsDetailRenderer.tsx +++ b/src/features/content/renderers/details/TwelveChannelsDetailRenderer.tsx @@ -7,6 +7,7 @@ import { Colors } from "@/theme"; import type { DetailRendererProps } from "../../types/renderer.types"; import { BackActionContext } from "../../context/BackActionContext"; import { Hero } from "../shared/Hero"; +import { OverviewCard } from "../shared/OverviewCard"; import { SectionCard } from "../shared/SectionCard"; import { Paragraphs } from "../shared/Paragraphs"; import { BulletList } from "../shared/BulletList"; @@ -613,15 +614,7 @@ export function TwelveChannelsDetailRenderer({ {/* 1. Overview Card */} - {overviewText ? ( - - - - Overview - - {overviewText} - - ) : null} + {overviewText ? : null} {/* 2. Organ vs Channel Card */} {organVsChannelText ? ( @@ -756,29 +749,6 @@ const styles = StyleSheet.create({ paddingBottom: verticalScale(40), gap: verticalScale(14), }, - overviewCard: { - backgroundColor: "#F0FDF4", - borderRadius: moderateScale(14), - borderWidth: 1, - borderColor: "#DCFCE7", - padding: moderateScale(16), - }, - overviewHeader: { - flexDirection: "row", - alignItems: "center", - marginBottom: moderateScale(8), - gap: moderateScale(6), - }, - overviewTitle: { - fontSize: moderateScale(15), - fontWeight: "700", - color: Colors.primaryDark, - }, - overviewText: { - fontSize: moderateScale(14), - color: Colors.textSecondary, - lineHeight: moderateScale(21), - }, infoCard: { backgroundColor: "#FFFFFF", borderRadius: moderateScale(14), diff --git a/src/features/content/renderers/shared/AccordionSection.tsx b/src/features/content/renderers/shared/AccordionSection.tsx index e0308db..e3972e9 100644 --- a/src/features/content/renderers/shared/AccordionSection.tsx +++ b/src/features/content/renderers/shared/AccordionSection.tsx @@ -20,11 +20,15 @@ if (Platform.OS === "android" && UIManager.setLayoutAnimationEnabledExperimental export interface AccordionSectionProps { title: string; defaultExpanded?: boolean; + icon?: keyof typeof Ionicons.glyphMap; + iconColor?: string; } export function AccordionSection({ title, defaultExpanded = true, + icon, + iconColor, children, }: PropsWithChildren) { const [expanded, setExpanded] = useState(defaultExpanded); @@ -53,6 +57,13 @@ export function AccordionSection({ ]} > + {icon ? ( + + ) : null} {title} ; + children?: React.ReactNode; + style?: StyleProp; + titleStyle?: StyleProp; + textStyle?: StyleProp; +} + +export function OverviewCard({ + title = "Overview", + icon = "information-circle", + iconColor = Colors.primary, + iconSize = moderateScale(20), + text, + paragraphs, + children, + style, + titleStyle, + textStyle, +}: OverviewCardProps) { + const filteredParagraphs = paragraphs?.filter( + (p): p is string => typeof p === "string" && p.trim().length > 0, + ); + + const hasText = typeof text === "string" && text.trim().length > 0; + const hasParagraphs = + Array.isArray(filteredParagraphs) && filteredParagraphs.length > 0; + + if (!hasText && !hasParagraphs && !children) { + return null; + } + + return ( + + + {icon ? ( + + ) : null} + {title} + + + {hasText ? ( + {text} + ) : null} + + {hasParagraphs + ? filteredParagraphs.map((para, index) => ( + + {para} + + )) + : null} + + {children} + + ); +} + +const styles = StyleSheet.create({ + card: { + backgroundColor: Colors.surface, + borderRadius: moderateScale(12), + padding: moderateScale(14), + borderWidth: 1, + borderColor: Colors.border, + }, + header: { + flexDirection: "row", + alignItems: "center", + gap: moderateScale(8), + marginBottom: verticalScale(8), + }, + title: { + fontSize: moderateScale(16), + fontWeight: "700", + color: Colors.textPrimary, + }, + text: { + fontSize: moderateScale(13), + lineHeight: moderateScale(20), + color: Colors.textSecondary, + }, + paragraph: { + fontSize: moderateScale(13), + lineHeight: moderateScale(20), + color: Colors.textSecondary, + marginTop: verticalScale(8), + }, +}); + diff --git a/src/features/content/renderers/shared/SectionCard.tsx b/src/features/content/renderers/shared/SectionCard.tsx index 3e6259f..72b9846 100644 --- a/src/features/content/renderers/shared/SectionCard.tsx +++ b/src/features/content/renderers/shared/SectionCard.tsx @@ -1,4 +1,5 @@ import React, { type PropsWithChildren, isValidElement } from "react"; +import { Ionicons } from "@expo/vector-icons"; import { isEmptyValue } from "../../utils/attribute-presentation"; import { AccordionSection } from "./AccordionSection"; @@ -7,6 +8,8 @@ import { useSettingsStore } from "@/store/settings.store"; export interface SectionCardProps { title: string; defaultExpanded?: boolean; + icon?: keyof typeof Ionicons.glyphMap; + iconColor?: string; } function hasRenderableContent(node: React.ReactNode): boolean { @@ -37,6 +40,8 @@ function hasRenderableContent(node: React.ReactNode): boolean { export function SectionCard({ title, defaultExpanded, + icon, + iconColor, children, }: PropsWithChildren) { if (!hasRenderableContent(children)) return null; @@ -48,8 +53,19 @@ export function SectionCard({ const isExpanded = defaultExpanded !== undefined ? defaultExpanded : accordionDefaultExpanded; + const resolvedIcon = + icon ?? + (title.trim().toLowerCase() === "overview" + ? ("information-circle" as const) + : undefined); + return ( - + {children} );