{post.summary}
+diff --git a/public/trade-barriers/buildcanada-logo.svg b/public/trade-barriers/buildcanada-logo.svg new file mode 100644 index 0000000..5145156 --- /dev/null +++ b/public/trade-barriers/buildcanada-logo.svg @@ -0,0 +1,15 @@ + diff --git a/public/trade-barriers/og.png b/public/trade-barriers/og.png new file mode 100644 index 0000000..f03b6e7 Binary files /dev/null and b/public/trade-barriers/og.png differ diff --git a/src/app/memos/MemoResultsList.tsx b/src/app/memos/MemoResultsList.tsx index db5d1dd..a7770e0 100644 --- a/src/app/memos/MemoResultsList.tsx +++ b/src/app/memos/MemoResultsList.tsx @@ -8,37 +8,49 @@ import { useMemosFilter } from "./store"; import { MemoItem, formatDate, shortenName } from "./types"; function MemoGridRow({ memo, basePath }: { memo: MemoItem; basePath: string }) { + const author = memo.author; + const hasMedia = Boolean(author?.photo); return ( -
- {memo.author.name} - - {shortenName(memo.author.name)} - -
- · + {author && ( + <> ++ {author.name} + {shortenName(author.name)} +
+ · + > + )}{formatDate(memo.publishedAt, memo.createdAt)}
@@ -69,9 +81,11 @@ function MemoGridRow({ memo, basePath }: { memo: MemoItem; basePath: string }) { export default function MemoResultsList({ memos, basePath = "/memos", + resultsLabel = "Memos", }: { memos: MemoItem[]; basePath?: string; + resultsLabel?: string; }) { const search = useMemosFilter((s) => s.search); const activeCategory = useMemosFilter((s) => s.activeCategory); @@ -87,7 +101,7 @@ export default function MemoResultsList({ list = list.filter( (m) => m.title.toLowerCase().includes(q) || - m.author.name.toLowerCase().includes(q) || + m.author?.name.toLowerCase().includes(q) || m.keyMessage1?.toLowerCase().includes(q) ); } @@ -95,20 +109,22 @@ export default function MemoResultsList({ return list; }, [memos, search, activeCategory]); + const lowerLabel = resultsLabel.toLowerCase(); + return ({memos.length === 0 - ? "No memos yet." - : "No memos match your filters."} + ? `No ${lowerLabel} yet.` + : `No ${lowerLabel} match your filters.`}
)}{date}
+{post.summary}
+{agreement.summary}
+{agreement.description}
+| + Jurisdiction + | ++ Status + | ++ Notes + | +
|---|---|---|
| {j.name} | ++ + {JURISDICTION_STATUS_LABEL[j.status]} + + | +
+ {j.notes}
+ {j.history && j.history.length > 0 && (
+
+
+ )}
+ Recent:
+ {j.history.slice(0, 1).map((h, idx) => (
+
+
+ {JURISDICTION_STATUS_LABEL[h.status]}
+ •
+ {formatDate(h.date_entered)}
+
+ ))}
+ |
+
+ Tracking progress of interprovincial trade agreements across Canada. +
++ Showing {filteredAgreements.length} of {initialAgreements.length} agreements +
+ )} +- {memo.author.name} -
+ {author && ( ++ {author.name} +
+ )}
- {memo.author.name} -
+ {author && ( ++ {author.name} +
+ )}{formatCategory(memo.category)}
diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index ca8e293..30859b9 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -4,6 +4,8 @@ export { getSiteConfig } from "./config"; export { fetchFaqs } from "./faqs"; export { fetchFeedItem, fetchFeedItems, fetchFeedItemsSimple, fetchFeedPicks } from "./feed"; export { fetchMemo, fetchMemos } from "./memos"; +export { fetchPost, fetchPosts } from "./posts"; +export type { PostDetail } from "./posts"; export { fetchTeamMembers } from "./team"; export { fetchTestimonials } from "./testimonials"; export { fetchTools } from "./tools"; diff --git a/src/lib/api/posts.ts b/src/lib/api/posts.ts new file mode 100644 index 0000000..9e69af8 --- /dev/null +++ b/src/lib/api/posts.ts @@ -0,0 +1,65 @@ +import { apiFetch } from "./client"; +import type { YFPaginatedResponse, YFPost, YFPostDetail } from "./types"; +import type { MemoItem } from "@/app/memos/types"; + +export interface PostDetail { + id: string; + title: string; + slug: string; + summary: string | null; + body: string | null; + seoImage: string | null; + publishedAt: string | null; + createdAt: string; + updatedAt: string; +} + +function mapPost(p: YFPost): MemoItem { + return { + id: String(p.id), + title: p.title, + slug: p.slug, + author: null, + keyMessage1: p.summary, + keyMessage2: null, + keyMessage3: null, + splashImage: null, + seoImage: p.seo_image_url, + category: "post", + featured: false, + publishedAt: p.published_at, + createdAt: p.published_at ?? new Date().toISOString(), + }; +} + +export async function fetchPosts(): Promise