()
+ const { status, results } = useInstantSearch()
+
+ const isLoading = status === "loading" || status === "stalled" || !results._state
+
+ if (isLoading && hits.length === 0) {
+ return (
+
+
+ {t("loading", { defaultValue: "Loading testimony..." })}
+
+ )
+ }
+
+ if (hits.length === 0) {
+ return (
+
+ {t("noOtherTestimony", {
+ defaultValue: "No testimony found for this legislator's bills."
+ })}
+
+ )
+ }
+
+ return (
+
+ {hits.map(hit => {
+ const publishedDate = hit.publishedAt
+ ? DateTime.fromMillis(hit.publishedAt).toLocaleString(
+ DateTime.DATE_MED
+ )
+ : null
+
+ return (
+
+
+
+ {formatBillId(hit.billId)}
+
+ {hit.position && (
+
+ {hit.position}
+
+ )}
+
+
+ {hit.authorDisplayName || "Anonymous"}
+
+ {hit.content && (
+
+
+ {truncateText(hit.content, 120)}
+
+
+ )}
+ {publishedDate && {publishedDate}}
+
+ )
+ })}
+
+ )
+}
+
+export function OtherTestimony({
+ court,
+ sponsoredBills = []
+}: {
+ court?: number
+ sponsoredBills?: string[]
+}) {
const { t } = useTranslation("legislators")
+ const billIds = useMemo(() => {
+ return Array.from(new Set(sponsoredBills))
+ }, [sponsoredBills])
+
+ const searchClient = useMemo(
+ () =>
+ new TypesenseInstantSearchAdapter({
+ server: getServerConfig(),
+ additionalSearchParameters: testimonySearchParams
+ }).searchClient,
+ []
+ )
+
+ const courtNumber = court ?? 193
+
return (
- {t("otherTestimony")}
- Content To Be Added
+ {t("otherTestimony")}
+ {billIds.length === 0 ? (
+
+ {t("noOtherTestimony", {
+ defaultValue: "No testimony found for this legislator's bills."
+ })}
+
+ ) : (
+
+
+
+
+ )}
)
}