diff --git a/astro/package-lock.json b/astro/package-lock.json index b5eab149..e865175c 100644 --- a/astro/package-lock.json +++ b/astro/package-lock.json @@ -31,7 +31,9 @@ }, "devDependencies": { "@astrojs/check": "^0.9.9", + "@types/bootstrap": "^5.2.11", "@types/lodash-es": "^4.17.12", + "@types/sanitize-html": "^2.16.1", "prettier": "^3.2.5", "prettier-plugin-astro": "^0.14.0" } @@ -4209,6 +4211,16 @@ "acorn": "^8.9.0" } }, + "node_modules/@types/bootstrap": { + "version": "5.2.11", + "resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.2.11.tgz", + "integrity": "sha512-69ykbLiNzQxi6Q/y/aYJLrlzI5QkLQjhIYW2U+cxujBxAmaBtmXKtxnFes59Ttfpt936as6xJU0dYnmVpcwIwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@popperjs/core": "^2.9.2" + } + }, "node_modules/@types/debug": { "version": "4.1.13", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", @@ -4310,6 +4322,16 @@ "integrity": "sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==", "license": "MIT" }, + "node_modules/@types/sanitize-html": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/@types/sanitize-html/-/sanitize-html-2.16.1.tgz", + "integrity": "sha512-n9wjs8bCOTyN/ynwD8s/nTcTreIHB1vf31vhLMGqUPNHaweKC4/fAl4Dj+hUlCTKYgm4P3k83fmiFfzkZ6sgMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "htmlparser2": "^10.1" + } + }, "node_modules/@types/sax": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/@types/sax/-/sax-1.2.7.tgz", diff --git a/astro/package.json b/astro/package.json index 63c7cd01..f8b8e979 100644 --- a/astro/package.json +++ b/astro/package.json @@ -21,6 +21,7 @@ "@iconify-json/cib": "1.1.8", "@iconify-json/simple-icons": "1.2.67", "@plausible-analytics/tracker": "0.4.4", + "@popperjs/core": "^2.11.8", "astro": "^6.3.8", "astro-icon": "1.1.5", "astro-lazy-youtube-embed": "0.5.5", @@ -28,13 +29,14 @@ "astro-robots-txt": "1.0.0", "bootstrap": "5.3.8", "lodash-es": "^4.18.1", - "@popperjs/core": "^2.11.8", "sanitize-html": "2.13.0", "sass": "1.77.5" }, "devDependencies": { "@astrojs/check": "^0.9.9", + "@types/bootstrap": "^5.2.11", "@types/lodash-es": "^4.17.12", + "@types/sanitize-html": "^2.16.1", "prettier": "^3.2.5", "prettier-plugin-astro": "^0.14.0" } diff --git a/astro/src/components/ExternalLink.astro b/astro/src/components/ExternalLink.astro index a70f1c7c..8ed4fd9c 100644 --- a/astro/src/components/ExternalLink.astro +++ b/astro/src/components/ExternalLink.astro @@ -8,6 +8,8 @@ interface Props { gaps?: boolean; // Whether to force the link to be completely inline with surrounding text. Defaults to false. inline?: boolean; + // Defines the custom relationship between the linked resource and the current document. Defaults to . + rel ?: string; } const { @@ -16,6 +18,7 @@ const { title = undefined, gaps = false, inline = false, + rel = "noopener noreferrer", } = Astro.props; import { Icon } from "astro-icon/components"; @@ -43,11 +46,11 @@ import { Icon } from "astro-icon/components"; } { /* prettier-ignore */ gaps ? diff --git a/astro/src/components/Hero.astro b/astro/src/components/Hero.astro index 57d80d54..348b0ea2 100644 --- a/astro/src/components/Hero.astro +++ b/astro/src/components/Hero.astro @@ -8,7 +8,7 @@ interface Props { theme?: string; columns?: string; actionBreakpoint?: string; - actionBarItems?: number; + actionBarItems?: 1 | 2 | 3 | 4 | 5 | 6 | `${1 | 2 | 3 | 4 | 5 | 6}`; } const { diff --git a/astro/src/components/HeroWithBreadcrumbs.astro b/astro/src/components/HeroWithBreadcrumbs.astro index a4be8bd4..2229dcc7 100644 --- a/astro/src/components/HeroWithBreadcrumbs.astro +++ b/astro/src/components/HeroWithBreadcrumbs.astro @@ -1,6 +1,5 @@ --- import { getImage } from "astro:assets"; -import { isEmpty } from "lodash-es"; import type { ImageMetadata } from "astro"; import type { Breadcrumbs } from "@lib/types"; diff --git a/astro/src/components/SocialLinks.astro b/astro/src/components/SocialLinks.astro index cef140ad..94aa133a 100644 --- a/astro/src/components/SocialLinks.astro +++ b/astro/src/components/SocialLinks.astro @@ -4,11 +4,11 @@ import { Icon } from "astro-icon/components"; // TODO: Not specific enough as a type export interface SocialLinkDictionary { - [index: string]: URL | undefined; + [index: string]: URL | string | undefined; } interface LinkConfig { - href: URL; + href: URL | string; icon: string; service: string; description: string; @@ -23,7 +23,7 @@ interface Props { } const { links, label = "", iconSize = "2em", gap = 2 } = Astro.props; -const brandingThemes = { +const brandingThemes : Record = { email: "primary", }; @@ -36,9 +36,9 @@ const socialLinks: Array = toPairs(links).map(([type, url]) => { else return `cib:${kebabCase(type)}`; })(); - const href = type == "email" ? `mailto:${url}` : url; - const service = type == "linkedin" ? "LinkedIn" : startCase(type); - const description = type == "email" ? "address" : "profile"; + const href = (type === "email" ? `mailto:${url}` : url) ?? "#"; + const service = type === "linkedin" ? "LinkedIn" : startCase(type); + const description = type === "email" ? "address" : "profile"; const theme = brandingThemes[type] ?? type; return { diff --git a/astro/src/components/StaffList.astro b/astro/src/components/StaffList.astro index 281e4422..d17df633 100644 --- a/astro/src/components/StaffList.astro +++ b/astro/src/components/StaffList.astro @@ -2,8 +2,10 @@ import { getCollection, type CollectionEntry } from 'astro:content'; import { sortBy } from "lodash-es"; +type Roles = keyof CollectionEntry<"staff">["data"]["roles"]; + interface Props { - team: string; // TODO: declare enum; + team: Roles; size?: string; } diff --git a/astro/src/components/TeamMemberBio.astro b/astro/src/components/TeamMemberBio.astro index 8c4689bc..e06f3962 100644 --- a/astro/src/components/TeamMemberBio.astro +++ b/astro/src/components/TeamMemberBio.astro @@ -7,9 +7,12 @@ import type { CollectionEntry } from "astro:content"; import { components } from "../lib/mdx"; import { render } from "astro:content"; + +type Roles = keyof CollectionEntry<"staff">["data"]["roles"]; + interface Props { member: CollectionEntry<"staff">; - role: string | boolean; + role: Roles | boolean; } const { member, role = "default" } = Astro.props; diff --git a/astro/src/components/ThemedColumn.astro b/astro/src/components/ThemedColumn.astro index da7a3eef..969c247f 100644 --- a/astro/src/components/ThemedColumn.astro +++ b/astro/src/components/ThemedColumn.astro @@ -4,7 +4,7 @@ import type { Props as ThemedBoxProps } from "@components/ThemedBox.astro"; import Column from "@components/Column.astro"; -interface Props extends ColumnProps, ThemedBoxProps {} +interface Props extends Omit, ThemedBoxProps {} const { theme = undefined, diff --git a/astro/src/components/TipLicense.astro b/astro/src/components/TipLicense.astro index a66fccb2..f27a00f6 100644 --- a/astro/src/components/TipLicense.astro +++ b/astro/src/components/TipLicense.astro @@ -10,7 +10,10 @@ const { class: extraClasses = "" } = Astro.props; ---
+ {/* TODO: Adjust astro to allow custom namespacing on tags

+ */} +

This work is licensed under { import.meta.env.PROD && ( - ) } diff --git a/astro/src/layouts/EscapeRoomLayout.astro b/astro/src/layouts/EscapeRoomLayout.astro index 9d4ab8aa..f711e718 100644 --- a/astro/src/layouts/EscapeRoomLayout.astro +++ b/astro/src/layouts/EscapeRoomLayout.astro @@ -5,7 +5,6 @@ import { getEntry } from "astro:content"; import Metadata from "../components/Metadata.astro"; import Branding from "../components/Branding.astro"; import Column from "../components/Column.astro"; -import FooterLinkList from "../components/navigation/FooterLinkList.astro"; import HeaderER from "../components/HeaderER.astro"; import { Icon } from "astro-icon/components"; import Row from "../components/Row.astro"; @@ -139,12 +138,13 @@ const Socials = socialEntry?.data.groups[0]; { import.meta.env.PROD && ( - ) } diff --git a/astro/src/lib/blog.ts b/astro/src/lib/blog.ts index 51c5d820..d02ca84b 100644 --- a/astro/src/lib/blog.ts +++ b/astro/src/lib/blog.ts @@ -1,6 +1,11 @@ -import { getCollection, getEntries, type CollectionEntry } from "astro:content"; +import type { CollectionEntry, ReferenceDataEntry } from "astro:content"; + +import { getCollection, getEntries, } from "astro:content"; import { isEmpty, isNil, reverse, sortBy, uniqBy } from "lodash-es"; +type Blog = CollectionEntry<"blogs">; +type Blogs = Array; + export function formatAuthorName(author: CollectionEntry<"staff">): string { const { name, cited } = author.data; const { first, middle, last } = cited || name; @@ -8,13 +13,13 @@ export function formatAuthorName(author: CollectionEntry<"staff">): string { } export async function getBlogAuthors( - blogs?, + blogs?: Blogs, ): Promise>> { blogs = isNil(blogs) ? await getCollection("blogs") : blogs; if (isEmpty(blogs)) return []; // Id uniqueness is key. const authorIDs = [...new Set(blogs.map((b) => b.data.author.id).flat())]; - const authorRefs = authorIDs.map((id) => ({ + const authorRefs: Array> = authorIDs.map((id) => ({ id, collection: "staff", })); @@ -22,7 +27,7 @@ export async function getBlogAuthors( return sortBy(authors, ["data.name.first"]); } -export async function getBlogTopics(blogs?) { +export async function getBlogTopics(blogs?: Blogs) { blogs = isNil(blogs) ? await getCollection("blogs") : blogs; if (isEmpty(blogs)) return []; const topics = [...new Set(blogs.map((blog) => blog.data.tags).flat())]; @@ -30,13 +35,13 @@ export async function getBlogTopics(blogs?) { return topics; } -export async function getBlogDates(blogs?) { +export async function getBlogDates(blogs?: Blogs) { blogs = isNil(blogs) ? await getCollection("blogs") : blogs; if (isEmpty(blogs)) return []; const dates = blogs.map((blog) => ({ date: blog.data.published, - sort: `${blog.data.published.getYear()}.${blog.data.published.getMonth().toLocaleString( + sort: `${blog.data.published.getFullYear()}.${blog.data.published.getMonth().toLocaleString( 'en-US', { minimumIntegerDigits: 2, useGrouping: false @@ -56,7 +61,7 @@ export async function getBlogDates(blogs?) { ); } -export async function orderByRecent(blogs?) { +export async function orderByRecent(blogs?: Blogs) { blogs = isNil(blogs) ? await getCollection("blogs") : blogs; if (isEmpty(blogs)) return []; @@ -68,20 +73,20 @@ export async function orderByRecent(blogs?) { return sortedBlogs; } -export async function getMostRecent(blogs?) { +export async function getMostRecent(blogs?: Blogs) { const sortedBlogs = await orderByRecent(blogs); return sortedBlogs[0]; } export interface BlogCatalog { - blogs: Array>; + blogs: Blogs; authors: Array>; topics: Array; dates: Array; - recent: CollectionEntry<"blogs">; + recent: Blog; } -export async function getBlogCatalog(blogs?): Promise { +export async function getBlogCatalog(blogs?: Blogs): Promise { blogs = isNil(blogs) ? await orderByRecent(blogs) : blogs; const topics = await getBlogTopics(blogs); const authors = await getBlogAuthors(blogs); diff --git a/astro/src/lib/tips.ts b/astro/src/lib/tips.ts index 093a775b..3880d9c2 100644 --- a/astro/src/lib/tips.ts +++ b/astro/src/lib/tips.ts @@ -1,4 +1,6 @@ -import { getCollection, type CollectionEntry } from "astro:content"; +import type { CollectionEntry } from "astro:content"; + +import { getCollection } from "astro:content"; import { compact, intersection, @@ -8,48 +10,51 @@ import { sortBy, } from "lodash-es"; -export async function getTipCategories(tips?) { +type Tip = CollectionEntry<"atotw">; +type Tips = Array; + +export async function getTipCategories(tips?: Tips) { tips = isNil(tips) ? await getCollection("atotw") : tips; if (isEmpty(tips)) return []; const topics = compact([ - ...new Set(tips.map((blog) => blog.data.tags).flat()), + ...new Set(tips!.map((t) => t.data.tags).flat()), ]); topics.sort(); return topics; } -export async function getRelatedTips(tip) { - const relatedTips = await getCollection("atotw", ({ id, data }) => { +export async function getRelatedTips(tip: Tip) { + const relatedTips: Tips = await getCollection("atotw", ({ id, data }) => { return id != tip.id && !isEmpty(intersection(tip.data.tags, data.tags)); }); const orderedTips = await orderByRecent(relatedTips); return orderedTips; } -export async function orderByRecent(tips?) { +export async function orderByRecent(tips?: Tips) { tips = isNil(tips) ? await getCollection("atotw") : tips; if (isEmpty(tips)) return []; - const sortedBlogs = sortBy(tips, [ + const sortedTips = sortBy(tips, [ (b) => b.data.published.getTime(), (b) => b.data.title, ]); - reverse(sortedBlogs); - return sortedBlogs; + reverse(sortedTips); + return sortedTips; } -export async function getMostRecent(tips?): Promise> { - const sortedBlogs = await orderByRecent(tips); - return sortedBlogs[0]; +export async function getMostRecent(tips?: Tips): Promise> { + const sortedTips = await orderByRecent(tips); + return sortedTips[0]; } export interface TipCatalog { - tips: Array>; + tips: Tips; categories: Array; - recent: CollectionEntry<"atotw">; + recent: Tip; } -export async function getTipCatalog(tips?): Promise { +export async function getTipCatalog(tips?: Tips): Promise { tips = isNil(tips) ? await orderByRecent(tips) : tips; const categories = await getTipCategories(tips); const recent = await getMostRecent(tips); diff --git a/astro/src/pages/blog/[slug].astro b/astro/src/pages/blog/[slug].astro index a8005ae3..b28ff6af 100644 --- a/astro/src/pages/blog/[slug].astro +++ b/astro/src/pages/blog/[slug].astro @@ -1,5 +1,8 @@ --- -import { getBlogCatalog } from "../../lib/blog"; +import type { Breadcrumbs } from "@lib/types"; +import type { CollectionEntry } from "astro:content"; + +import { getBlogCatalog, type BlogCatalog } from "../../lib/blog"; export async function getStaticPaths() { const catalog = await getBlogCatalog(); @@ -21,9 +24,9 @@ export async function getStaticPaths() { } interface Props { - blog: object; // TODO: Get object type definition from content. - catalog: object; // TODO: Define object in blog library - crumbs: Array; + blog: CollectionEntry<"blogs">; + catalog: BlogCatalog; // TODO: Define object in blog library + crumbs: Breadcrumbs; } const { blog, catalog, crumbs } = Astro.props; diff --git a/astro/src/pages/blog/rss.xml.ts b/astro/src/pages/blog/rss.xml.ts index d7bad436..e6fc7aa5 100644 --- a/astro/src/pages/blog/rss.xml.ts +++ b/astro/src/pages/blog/rss.xml.ts @@ -1,3 +1,5 @@ +import type { APIRoute } from "astro"; + import rss from "@astrojs/rss"; import sanitizeHtml from "sanitize-html"; @@ -13,7 +15,7 @@ import { sanitizeOptions } from "../../lib/mdx"; const renderers = await loadRenderers([mdxRenderer()]); const container = await AstroContainer.create({ renderers }); -export async function GET(context) { +export const GET = (async (context) => { const blogs: Array> = await orderByRecent(); return rss({ @@ -38,4 +40,4 @@ export async function GET(context) { ), customData: `en-us`, }); -} +}) satisfies APIRoute; diff --git a/astro/src/pages/donate.astro b/astro/src/pages/donate.astro index fafcb76c..f9c1b3bc 100644 --- a/astro/src/pages/donate.astro +++ b/astro/src/pages/donate.astro @@ -4,7 +4,6 @@ import { getOpenGraphImageData } from "@lib/og-image"; import components from "@lib/mdx"; import { getEntry, render } from "astro:content"; -import Branding from "@components/Branding.astro"; import Column from "../components/Column.astro"; import Hero from "../components/Hero.astro"; import { Icon } from "astro-icon/components"; diff --git a/astro/src/pages/escape-room/themes/[id].astro b/astro/src/pages/escape-room/themes/[id].astro index 737d7db5..3f3fd238 100644 --- a/astro/src/pages/escape-room/themes/[id].astro +++ b/astro/src/pages/escape-room/themes/[id].astro @@ -43,7 +43,7 @@ const { room, crumbs, metadata } = Astro.props; const { about, title, page } = room.data; const { theme, image } = page; const { Content } = await render(room); -const themeVar = `var(--bs-${theme})`; +// const themeVar = `var(--bs-${theme})`; const textVar = `var(--bs-${theme}-text-emphasis)`; import Column from "@components/Column.astro"; diff --git a/astro/src/pages/globa11y/index.astro b/astro/src/pages/globa11y/index.astro index e98b08ce..abce090d 100644 --- a/astro/src/pages/globa11y/index.astro +++ b/astro/src/pages/globa11y/index.astro @@ -1,6 +1,6 @@ --- import { getOpenGraphImageData } from "@lib/og-image"; -import type { Breadcrumbs, PageMetadata } from "@lib/types"; +import type { PageMetadata } from "@lib/types"; const title = "globa11y"; const metadata: PageMetadata = { diff --git a/astro/src/pages/join-us/index.astro b/astro/src/pages/join-us/index.astro index ce6f70f7..de1cb9e2 100644 --- a/astro/src/pages/join-us/index.astro +++ b/astro/src/pages/join-us/index.astro @@ -1,6 +1,5 @@ --- import Branding from "../../components/Branding.astro"; -import ExternalLink from "../../components/ExternalLink.astro"; import FlexColumn from "../../components/FlexColumn.astro"; import Hero from "../../components/Hero.astro"; import { Icon } from "astro-icon/components"; @@ -10,7 +9,7 @@ import ThemedColumn from "../../components/ThemedColumn.astro"; import ThemedSection from "../../components/ThemedSection.astro"; import heroBg from "../../images/colored-hero/hands-together.png"; -import type { Breadcrumbs, PageMetadata } from "@lib/types"; +import type { PageMetadata } from "@lib/types"; const title = "Join Us"; const metadata: PageMetadata = { diff --git a/astro/src/pages/mutua11y/_index.astro b/astro/src/pages/mutua11y/_index.astro index 42f0bcd2..bf24ee2e 100644 --- a/astro/src/pages/mutua11y/_index.astro +++ b/astro/src/pages/mutua11y/_index.astro @@ -1,6 +1,6 @@ --- import { getOpenGraphImageData } from "@lib/og-image"; -import type { Breadcrumbs, PageMetadata } from "@lib/types"; +import type { PageMetadata } from "@lib/types"; const title = "mutua11y"; const metadata: PageMetadata = { diff --git a/astro/src/pages/mutua11y/index.astro b/astro/src/pages/mutua11y/index.astro index 52d1f803..8befd59c 100644 --- a/astro/src/pages/mutua11y/index.astro +++ b/astro/src/pages/mutua11y/index.astro @@ -1,5 +1,5 @@ --- -import type { Breadcrumbs, PageMetadata } from "@lib/types"; +import type { PageMetadata } from "@lib/types"; import { getCollection } from "astro:content"; import { getOpenGraphImageData } from "@lib/og-image"; diff --git a/astro/src/pages/mutua11y/mentor-registration.astro b/astro/src/pages/mutua11y/mentor-registration.astro index ee5cabe0..e790d7db 100644 --- a/astro/src/pages/mutua11y/mentor-registration.astro +++ b/astro/src/pages/mutua11y/mentor-registration.astro @@ -6,8 +6,6 @@ import { countries, experienceLevels, accessibilityAreas, - training, - topics, partnerOrgs, } from "@lib/mutua11y"; diff --git a/astro/src/pages/team/[tag].astro b/astro/src/pages/team/[tag].astro index ce864e85..3b38769e 100644 --- a/astro/src/pages/team/[tag].astro +++ b/astro/src/pages/team/[tag].astro @@ -1,15 +1,16 @@ --- -import { getCollection } from "astro:content"; +import type { Breadcrumbs, PageMetadata } from "@lib/types"; +import { getCollection, type CollectionEntry } from "astro:content"; import { sortBy } from "lodash-es"; -import type { Breadcrumbs, PageMetadata } from "@lib/types"; +type TeamName = keyof CollectionEntry<"staff">["data"]["roles"]; export async function getStaticPaths() { const team = await getCollection("staff"); return [ { - params: { tag: "board" }, + params: { tag: "board" as TeamName }, props: { team, title: "Board Members", @@ -18,7 +19,7 @@ export async function getStaticPaths() { }, }, { - params: { tag: "leadership" }, + params: { tag: "leadership" as TeamName }, props: { team, title: "Leadership Team", diff --git a/astro/src/pages/team/_alumni.astro b/astro/src/pages/team/_alumni.astro index a52a3450..7ced69b1 100644 --- a/astro/src/pages/team/_alumni.astro +++ b/astro/src/pages/team/_alumni.astro @@ -9,6 +9,8 @@ import ThemedSection from "../../components/ThemedSection.astro"; import { isEmpty, sortBy } from "lodash-es"; +type TeamName = keyof CollectionEntry<"staff">["data"]["roles"]; + const alumni = await getCollection("staff", ({ data }) => !data.current); function getTeamMembers(tag: string) { @@ -30,7 +32,7 @@ const teamEntries = await getCollection( ); const teams = teamEntries.map((entry) => ({ name: entry.data.name, - team: entry.id, + team: entry.id as TeamName, members: getTeamMembers(entry.id), })); diff --git a/astro/src/pages/team/previous.astro b/astro/src/pages/team/previous.astro index cbdda870..cc157776 100644 --- a/astro/src/pages/team/previous.astro +++ b/astro/src/pages/team/previous.astro @@ -41,8 +41,8 @@ function getFullName({first, middle, last}: CollectionEntry<"staff">["data"]["na type Roles = CollectionEntry<"staff">["data"]["roles"]; type RoleKey = keyof Roles; -interface TeamMembers { - [index: RoleKey]: TeamOverview; +type TeamMembers = { + [key in RoleKey]: TeamOverview; } interface TeamOverview { name: string; @@ -59,7 +59,7 @@ const teamMembers: TeamMembers = teams.reduce( accum[id] = overview; return accum; }, - {}, + {} as TeamMembers, ); staff.reduce((members: TeamMembers, current: CollectionEntry<"staff">) => { const roles: Roles = current.data.roles || {}; diff --git a/astro/src/pages/team/staff.astro b/astro/src/pages/team/staff.astro index 7823f0ab..a24b312f 100644 --- a/astro/src/pages/team/staff.astro +++ b/astro/src/pages/team/staff.astro @@ -9,8 +9,13 @@ import { sortBy } from "lodash-es"; import type { Breadcrumbs, PageMetadata } from "@lib/types"; import { getCollection, render } from "astro:content"; import { components } from "@lib/mdx"; +import type { AstroComponentFactory } from "astro/runtime/server/index.js"; +import type { CollectionEntry } from "astro:content"; -const staff = await getCollection("staff"); +type StaffList = Array>; +type TeamName = keyof CollectionEntry<"staff">["data"]["roles"]; + +const staff: StaffList = await getCollection("staff"); function getTeamMembers(tag: string) { return sortBy( @@ -26,6 +31,14 @@ function getTeamMembers(tag: string) { ); } +type Teams = { + name: string; + branded: boolean; + team: TeamName; + members: StaffList; + Content: AstroComponentFactory; +} + const teamEntries = sortBy( await getCollection( "teams", @@ -33,14 +46,14 @@ const teamEntries = sortBy( ), ["id"] ); -const teams = await Promise.all( +const teams: Teams[] = await Promise.all( teamEntries.map(async (entry) => { const { Content } = await render(entry); return { name: entry.data.name, branded: entry.data.branded, - team: entry.id, + team: entry.id as TeamName, members: getTeamMembers(entry.id), Content, }; diff --git a/astro/src/pages/tips/index.astro b/astro/src/pages/tips/index.astro index 7fc2e4a9..6f43b354 100644 --- a/astro/src/pages/tips/index.astro +++ b/astro/src/pages/tips/index.astro @@ -10,12 +10,11 @@ import TipLicense from "@components/TipLicense.astro"; import TipOfTheWeek from "@components/TipOfTheWeek.astro"; import TipRegistration from "@components/TipRegistration.astro"; -import { getTipCatalog } from "@lib/tips"; import { getOpenGraphImageData } from "@lib/og-image"; -import { startCase } from "lodash-es"; import type { Breadcrumbs, PageMetadata } from "@lib/types"; -const { categories, tips } = await getTipCatalog(); +// Unneeded due to hiding the Tip of the Week. +// const { categories, tips } = await getTipCatalog(); const title = "Tip of the Week"; const description = diff --git a/astro/src/pages/tips/rss.xml.ts b/astro/src/pages/tips/rss.xml.ts index e92764f6..dce8f187 100644 --- a/astro/src/pages/tips/rss.xml.ts +++ b/astro/src/pages/tips/rss.xml.ts @@ -1,3 +1,5 @@ +import type { APIRoute } from "astro"; + import rss from "@astrojs/rss"; import sanitizeHtml from "sanitize-html"; @@ -14,7 +16,7 @@ import { sanitizeOptions } from "src/lib/mdx"; const renderers = await loadRenderers([mdxRenderer()]); const container = await AstroContainer.create({ renderers }); -export async function GET(context) { +export const GET = (async (context) => { const tips: Array> = await orderByRecent(); return rss({ @@ -40,4 +42,4 @@ export async function GET(context) { ), customData: `en-us`, }); -} +}) satisfies APIRoute;