diff --git a/public/projects/builder-mp.png b/public/projects/builder-mp.png new file mode 100644 index 00000000..6204f81a Binary files /dev/null and b/public/projects/builder-mp.png differ diff --git a/public/projects/canada-spends.png b/public/projects/canada-spends.png new file mode 100644 index 00000000..d46067d4 Binary files /dev/null and b/public/projects/canada-spends.png differ diff --git a/public/projects/exit-tax-calculator.png b/public/projects/exit-tax-calculator.png new file mode 100644 index 00000000..993056a9 Binary files /dev/null and b/public/projects/exit-tax-calculator.png differ diff --git a/public/projects/great-canadian-builders.png b/public/projects/great-canadian-builders.png new file mode 100644 index 00000000..03a1dcfa Binary files /dev/null and b/public/projects/great-canadian-builders.png differ diff --git a/public/projects/outcomes-tracker.png b/public/projects/outcomes-tracker.png new file mode 100644 index 00000000..d1611689 Binary files /dev/null and b/public/projects/outcomes-tracker.png differ diff --git a/public/projects/state-of-the-nation.png b/public/projects/state-of-the-nation.png new file mode 100644 index 00000000..c8d2fcba Binary files /dev/null and b/public/projects/state-of-the-nation.png differ diff --git a/public/projects/tax-visualizer.png b/public/projects/tax-visualizer.png new file mode 100644 index 00000000..e06bca35 Binary files /dev/null and b/public/projects/tax-visualizer.png differ diff --git a/public/projects/trade-barriers-tracker.png b/public/projects/trade-barriers-tracker.png new file mode 100644 index 00000000..729092a2 Binary files /dev/null and b/public/projects/trade-barriers-tracker.png differ diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts index e3ab732f..1649e4fd 100644 --- a/src/app/sitemap.ts +++ b/src/app/sitemap.ts @@ -1,5 +1,6 @@ import type { MetadataRoute } from "next"; -import { fetchBuilders, fetchFeedItems, fetchMemos, fetchPosts, fetchTools } from "@/lib/api"; +import { fetchBuilders, fetchFeedItems, fetchMemos, fetchPosts } from "@/lib/api"; +import { PROJECTS } from "@/constants/projects"; import { fetchApi } from "@/lib/tracker-api"; import type { CommitmentsResponse, @@ -41,10 +42,9 @@ export default async function sitemap(): Promise { { url: `${baseUrl}/privacy-notice`, lastModified: new Date(), changeFrequency: "yearly", priority: 0.3 }, ]; - const tools = await fetchTools(); const staticUrls = new Set(staticPages.map((p) => p.url)); const redirectedPaths = new Set(["/great-canadian-builders", "/toronto"]); - const projectPages: MetadataRoute.Sitemap = tools + const projectPages: MetadataRoute.Sitemap = PROJECTS .map((t) => { if (!t.externalUrl) return null; let path: string | null = null; diff --git a/src/components/ProjectsGrid.tsx b/src/components/ProjectsGrid.tsx index c1a91db9..23544237 100644 --- a/src/components/ProjectsGrid.tsx +++ b/src/components/ProjectsGrid.tsx @@ -1,8 +1,8 @@ -import { fetchTools } from "@/lib/api"; +import { PROJECTS } from "@/constants/projects"; import WidgetCard from "./widgets/WidgetCard"; import { ProjectData } from "./widgets/types"; -export default async function ProjectsGrid({ +export default function ProjectsGrid({ featured, maxItems, filter, @@ -17,9 +17,9 @@ export default async function ProjectsGrid({ includeSlugs?: string[]; columns?: 1 | 2; }) { - const raw = await fetchTools(featured ? { featured: true } : undefined); - - let projects: ProjectData[] = raw; + let projects: ProjectData[] = featured + ? PROJECTS.filter((p) => p.featured) + : PROJECTS; if (includeSlugs?.length) { projects = includeSlugs diff --git a/src/constants/projects.ts b/src/constants/projects.ts new file mode 100644 index 00000000..614b35f5 --- /dev/null +++ b/src/constants/projects.ts @@ -0,0 +1,105 @@ +import type { ProjectData } from "@/components/widgets/types"; + +export const PROJECTS: ProjectData[] = [ + { + id: "outcomes-tracker", + slug: "outcomes-tracker", + title: "Outcomes Tracker", + description: + "Tracking progress of key government commitments and their impact", + externalUrl: "/tracker", + size: "small", + featured: true, + order: 0, + accentColor: null, + imageUrl: "/projects/outcomes-tracker.png", + }, + { + id: "canada-spends", + slug: "canada-spends", + title: "Canada Spends", + description: + "Breaking down government finances to understand how your money is being spent", + externalUrl: "https://canadaspends.com", + size: "small", + featured: false, + order: 1, + accentColor: null, + imageUrl: "/projects/canada-spends.png", + }, + { + id: "builder-mp", + slug: "builder-mp", + title: "Builder MP", + description: "What would a Builder think of these parliament bills?", + externalUrl: "https://buildcanada.com/bills", + size: "small", + featured: false, + order: 2, + accentColor: null, + imageUrl: "/projects/builder-mp.png", + }, + { + id: "great-canadian-builders", + slug: "great-canadian-builders", + title: "Great Canadian Builders", + description: "Stories of Canadians who have transformed our world", + externalUrl: "/great-canadian-builders", + size: "small", + featured: false, + order: 3, + accentColor: null, + imageUrl: "/projects/great-canadian-builders.png", + }, + { + id: "state-of-the-nation", + slug: "state-of-the-nation", + title: "State of the Nation", + description: "Visualize and track key indicators in Canada.", + externalUrl: "/state-of-the-nation", + size: "small", + featured: false, + order: 4, + accentColor: null, + imageUrl: "/projects/state-of-the-nation.png", + }, + { + id: "trade-barriers-tracker", + slug: "trade-barriers-tracker", + title: "Trade Barriers Tracker", + description: + "Tracking progress of interprovincial trade agreements across Canada", + externalUrl: "https://buildcanada.com/trade-barriers", + size: "small", + featured: false, + order: 5, + accentColor: null, + imageUrl: "/projects/trade-barriers-tracker.png", + }, + { + id: "tax-visualizer", + slug: "tax-visualizer", + title: "Where Your Tax Dollars Go", + description: + "A personalized breakdown of how much you contribute to different government services", + externalUrl: "https://canadaspends.com/tax-visualizer", + size: "small", + featured: false, + order: 6, + accentColor: null, + imageUrl: "/projects/tax-visualizer.png", + }, + { + id: "exit-tax-calculator", + slug: "exit-tax-calculator", + title: "Exit Tax Calculator", + description: + "Compare exit scenarios for founders and investors in Canada vs. US", + externalUrl: "https://buildcanada.com/exit-tax-calculator", + size: "small", + featured: false, + order: 7, + accentColor: null, + imageUrl: "/projects/exit-tax-calculator.png", + }, +]; diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 30859b96..7c16037e 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -8,5 +8,4 @@ export { fetchPost, fetchPosts } from "./posts"; export type { PostDetail } from "./posts"; export { fetchTeamMembers } from "./team"; export { fetchTestimonials } from "./testimonials"; -export { fetchTools } from "./tools"; export type { SiteConfigData } from "./config"; diff --git a/src/lib/api/tools.ts b/src/lib/api/tools.ts deleted file mode 100644 index c1b6bec6..00000000 --- a/src/lib/api/tools.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { apiFetch } from "./client"; -import type { YFTool, YFListResponse } from "./types"; -import type { ProjectData } from "@/components/widgets/types"; - -function stripHtml(html: string | null): string | null { - if (!html) return null; - return html.replace(/<[^>]*>/g, "").trim(); -} - -function mapTool(t: YFTool): ProjectData { - return { - id: String(t.id), - slug: t.slug, - title: t.title, - description: stripHtml(t.description), - externalUrl: t.url, - size: t.size, - featured: t.featured, - order: t.position, - accentColor: t.accent_color, - imageUrl: t.image_url, - }; -} - -export async function fetchTools(params?: { - featured?: boolean; -}): Promise { - const queryParams: Record = {}; - if (params?.featured) queryParams.featured = "true"; - - const res = await apiFetch>("/tools", { - params: queryParams, - revalidate: 3600, - }); - return res.data.map(mapTool); -} diff --git a/src/lib/api/types.ts b/src/lib/api/types.ts index c8dcc5e1..bf243ac2 100644 --- a/src/lib/api/types.ts +++ b/src/lib/api/types.ts @@ -56,19 +56,6 @@ export interface YFTeamMember { profile_photo_url: string | null; } -export interface YFTool { - id: number; - slug: string; - title: string; - description: string | null; - url: string; - featured: boolean; - position: number; - accent_color: string | null; - size: "small" | "big"; - image_url: string | null; -} - export interface YFTestimonial { id: number; name: string;