feat(ear-acupuncture): display book icon for catalog index cards
This commit is contained in:
parent
d3e4037051
commit
06f438b0e0
|
|
@ -33,6 +33,9 @@ export function EarAcupunctureCatalogCardRenderer({
|
|||
|
||||
const contentCount = asNumber(attributes.content_count);
|
||||
const contentLabel = asString(attributes.content_label).trim();
|
||||
const isCatalog =
|
||||
contentCount !== null ||
|
||||
(attributes.link as Record<string, unknown> | undefined)?.type === "template_ref";
|
||||
|
||||
return (
|
||||
<StandardIndexCard
|
||||
|
|
@ -40,6 +43,8 @@ export function EarAcupunctureCatalogCardRenderer({
|
|||
subtitle={item.summary || null}
|
||||
count={contentCount}
|
||||
countLabel={contentLabel || null}
|
||||
icon={isCatalog ? "book" : "dot"}
|
||||
tone={isCatalog ? "green" : undefined}
|
||||
onPress={onPress}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ export interface StandardIndexCardProps {
|
|||
count?: number | null;
|
||||
countLabel?: string | null;
|
||||
tone?: StandardIndexCardTone;
|
||||
icon?: "dot" | "book";
|
||||
onPress: () => void;
|
||||
}
|
||||
|
||||
|
|
@ -30,12 +31,13 @@ export function StandardIndexCard({
|
|||
count,
|
||||
countLabel,
|
||||
tone,
|
||||
icon = "dot",
|
||||
onPress,
|
||||
}: StandardIndexCardProps) {
|
||||
const { tone: contextTone } = usePageTone();
|
||||
const normalizedTitle = title.trim();
|
||||
const normalizedSubtitle = subtitle?.trim() || null;
|
||||
const effectiveTone = tone || contextTone || "purple";
|
||||
const effectiveTone = tone || (icon === "book" ? "green" : contextTone) || "purple";
|
||||
const currentTone = cardTones[effectiveTone] || cardTones.purple;
|
||||
|
||||
return (
|
||||
|
|
@ -46,7 +48,11 @@ export function StandardIndexCard({
|
|||
style={({ pressed }) => [styles.row, pressed && styles.pressed]}
|
||||
>
|
||||
<View style={[styles.accent, { backgroundColor: currentTone.soft }]}>
|
||||
<View style={[styles.accentDot, { backgroundColor: currentTone.accent }]} />
|
||||
{icon === "book" ? (
|
||||
<Ionicons name="book-outline" size={19} color={currentTone.accent} />
|
||||
) : (
|
||||
<View style={[styles.accentDot, { backgroundColor: currentTone.accent }]} />
|
||||
)}
|
||||
</View>
|
||||
|
||||
<View style={styles.titleBlock}>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { Ionicons } from "@expo/vector-icons";
|
|||
import { router } from "expo-router";
|
||||
|
||||
import { Colors } from "@/theme";
|
||||
import { PageToneProvider } from "../context/PageToneContext";
|
||||
import { type PageTone, PageToneProvider } from "../context/PageToneContext";
|
||||
import { ContentPageHeader } from "../components/layout/ContentPageHeader";
|
||||
import { ScreenError } from "../components/ContentScreenState";
|
||||
import { ContractSortModal } from "../components/search/ContractSortModal";
|
||||
|
|
@ -131,8 +131,15 @@ export function CollectionTemplateScreen({
|
|||
</View>
|
||||
);
|
||||
|
||||
const isCatalog =
|
||||
collectionRendererCode === "module_catalog_collection" ||
|
||||
itemRendererCode === "module_catalog_card" ||
|
||||
templateCode === "m0001_ct0001" ||
|
||||
templateCode === "m0002_ct0001";
|
||||
const pageTone: PageTone = isCatalog ? "green" : "purple";
|
||||
|
||||
return (
|
||||
<PageToneProvider tone="purple">
|
||||
<PageToneProvider tone={pageTone}>
|
||||
<SafeAreaView style={styles.screen} edges={["top", "left", "right"]}>
|
||||
<ContentPageHeader
|
||||
title={moduleDisplay.name}
|
||||
|
|
|
|||
Loading…
Reference in New Issue