40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import React from "react";
|
|
import { asString } from "../helpers/value";
|
|
import { CollectionScaffold } from "../shared/CollectionScaffold";
|
|
import { StandardIndexCard } from "../shared/StandardIndexCard";
|
|
import type { CollectionItemRendererProps, CollectionRendererProps } from "../../types/renderer.types";
|
|
|
|
export function AcuPointIndexCollectionRenderer(props: CollectionRendererProps) {
|
|
return <CollectionScaffold {...props} />;
|
|
}
|
|
export function AcuPointCollectionRenderer(props: CollectionRendererProps) {
|
|
return <CollectionScaffold {...props} />;
|
|
}
|
|
export function AcuPointIndexCardRenderer({ item, onPress }: CollectionItemRendererProps) {
|
|
const a = item.attributes;
|
|
const altNames = [asString(a.alt_name_1), asString(a.alt_name_2)].filter(Boolean).join(" · ");
|
|
return (
|
|
<StandardIndexCard
|
|
title={asString(a.point_name) || asString(a.name) || item.title}
|
|
subtitle={altNames || null}
|
|
onPress={onPress}
|
|
/>
|
|
);
|
|
}
|
|
export function AcuPointCardRenderer({ item, onPress }: CollectionItemRendererProps) {
|
|
const a = item.attributes;
|
|
const altNames = [asString(a.alt_name_1), asString(a.alt_name_2)].filter(Boolean).join(" · ");
|
|
const subtitle =
|
|
altNames ||
|
|
asString(a.pt_meaning) ||
|
|
asString(a.channel);
|
|
|
|
return (
|
|
<StandardIndexCard
|
|
title={asString(a.point_name) || asString(a.name) || item.title}
|
|
subtitle={subtitle || null}
|
|
onPress={onPress}
|
|
/>
|
|
);
|
|
}
|