progmaweb
The site and account service of Progmasoft: a Next.js frontend and an ASP.NET Core API.
Clonegit clone https://git.progmasoft.com/progmaweb
Answer the Codacy findings of the new pages in code
- Commit
55f483706402cbdf6fb527e6f46babb8af942a25- Author
- Leitwolf11 ·
- Parents
c99ecf77320d
Changes
apps/web/app/globals.css | 160 +++++++++++++-------------- apps/web/app/news/[slug]/page.tsx | 23 ++-- apps/web/app/news/news.css | 7 +- apps/web/app/news/page.tsx | 29 ++--- apps/web/app/page.tsx | 45 ++++---- apps/web/app/site.css | 65 ++++++----- apps/web/components/site/FeatureCarousel.tsx | 23 ++-- apps/web/components/site/Flow.tsx | 25 +++-- apps/web/components/site/Reveal.tsx | 4 +- apps/web/lib/brand-colours.ts | 52 ++++++--- apps/web/lib/home-messages.ts | 5 + apps/web/lib/news.ts | 16 ++- apps/web/lib/products.ts | 5 + apps/web/tests/news.test.mjs | 4 +- 14 files changed, 263 insertions(+), 200 deletions(-) diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css index 1ee672a..46f14cb 100644 --- a/apps/web/app/globals.css +++ b/apps/web/app/globals.css @@ -2,25 +2,25 @@ /* SPDX-License-Identifier: AGPL-3.0-or-later */ :root { - --blue-700: #13505f; - --blue-600: #1d6a80; - --blue-500: #2a7f96; - --blue-100: #dbe8e8; - --violet-600: #6750a4; - --green-600: #16825d; - --ink-950: #141413; - --ink-800: #2b2a27; - --ink-650: #5e5d59; - --ink-500: #6d6b64; - --line: #dcd8cc; - --line-strong: #c2bdb0; - --surface: #f0eee6; - --surface-muted: #e8e6dc; - --surface-blue: #e4e9e4; + --blue-700: rgb(19 80 95); + --blue-600: rgb(29 106 128); + --blue-500: rgb(42 127 150); + --blue-100: rgb(219 232 232); + --violet-600: rgb(103 80 164); + --green-600: rgb(22 130 93); + --ink-950: rgb(20 20 19); + --ink-800: rgb(43 42 39); + --ink-650: rgb(94 93 89); + --ink-500: rgb(109 107 100); + --line: rgb(220 216 204); + --line-strong: rgb(194 189 176); + --surface: rgb(240 238 230); + --surface-muted: rgb(232 230 220); + --surface-blue: rgb(228 233 228); --header-surface: rgb(240 238 230 / 86%); - --hero-background: #f0eee6; - --account-background: #e8e6dc; - --danger: #b42318; + --hero-background: rgb(240 238 230); + --account-background: rgb(232 230 220); + --danger: rgb(180 35 24); --shadow-sm: 0 2px 8px rgb(20 20 19 / 6%); --shadow-md: 0 16px 44px rgb(20 20 19 / 10%); --radius-sm: 8px; @@ -33,25 +33,25 @@ /* Light is deliberately the product default. Dark mode is an explicit, persistent preference so operating-system changes do not surprise users. */ :root[data-theme="dark"] { - --blue-700: #a5d4de; - --blue-600: #7fb8c4; - --blue-500: #5fa3b2; - --blue-100: #1d3338; - --violet-600: #a88eff; - --green-600: #5bd5aa; - --ink-950: #f0eee6; - --ink-800: #dedbd2; - --ink-650: #b0aea5; - --ink-500: #8f8d86; - --line: #34332f; - --line-strong: #4a4843; - --surface: #1a1a18; - --surface-muted: #262624; - --surface-blue: #1f2a2b; + --blue-700: rgb(165 212 222); + --blue-600: rgb(127 184 196); + --blue-500: rgb(95 163 178); + --blue-100: rgb(29 51 56); + --violet-600: rgb(168 142 255); + --green-600: rgb(91 213 170); + --ink-950: rgb(240 238 230); + --ink-800: rgb(222 219 210); + --ink-650: rgb(176 174 165); + --ink-500: rgb(143 141 134); + --line: rgb(52 51 47); + --line-strong: rgb(74 72 67); + --surface: rgb(26 26 24); + --surface-muted: rgb(38 38 36); + --surface-blue: rgb(31 42 43); --header-surface: rgb(26 26 24 / 86%); - --hero-background: #1a1a18; - --account-background: #222220; - --danger: #ff8f86; + --hero-background: rgb(26 26 24); + --account-background: rgb(34 34 32); + --danger: rgb(255 143 134); --shadow-sm: 0 2px 8px rgb(0 0 0 / 28%); --shadow-md: 0 16px 44px rgb(0 0 0 / 42%); color-scheme: dark; @@ -101,7 +101,7 @@ a { } :focus-visible { - outline: 3px solid #ffbf47; + outline: 3px solid rgb(255 191 71); outline-offset: 3px; } @@ -153,23 +153,23 @@ a { } .brand-tile-slate { - background: #3b4658; + background: rgb(59 70 88); } .brand-tile-teal { - background: #1e7188; + background: rgb(30 113 136); } .brand-tile-violet { - background: #7655fa; + background: rgb(118 85 250); } .brand-tile-orange { - background: #dc7644; + background: rgb(220 118 68); } .brand-name { - color: #8e0000; + color: rgb(142 0 0); font-size: 20px; font-weight: 650; letter-spacing: -0.02em; @@ -177,7 +177,7 @@ a { } :root[data-theme="dark"] .brand-name { - color: #f23636; + color: rgb(242 54 54); } .brand-product { @@ -260,7 +260,7 @@ a { display: none; } -@media (max-width: 980px) { +@media (width <= 980px) { .header-inner { gap: 12px; } @@ -383,7 +383,7 @@ a { /* A brand with a product name leaves no room for the word on a narrow phone: the button keeps its icon and its accessible name. */ -@media (max-width: 420px) { +@media (width <= 420px) { .menu-toggle { width: 44px; justify-content: center; @@ -468,7 +468,7 @@ a { .button-light:hover { border-color: white; - background: #eef7ff; + background: rgb(238 247 255); color: var(--blue-700); } @@ -547,7 +547,7 @@ a { .system-window { overflow: hidden; - border: 1px solid #c6d1dd; + border: 1px solid rgb(198 209 221); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-md); @@ -568,7 +568,7 @@ a { width: 9px; height: 9px; border-radius: 50%; - background: #a9b2bc; + background: rgb(169 178 188); } .window-bar code { @@ -765,26 +765,26 @@ a { gap: 44px; border-radius: var(--radius-lg); padding: 52px 58px; - background: linear-gradient(125deg, #004e8c, #0078d4); + background: linear-gradient(125deg, rgb(0 78 140), rgb(0 120 212)); color: white; box-shadow: var(--shadow-md); } .callout .eyebrow { - color: #d8eeff; + color: rgb(216 238 255); } .callout p:last-child { max-width: 650px; margin: 16px 0 0; - color: #e9f5ff; + color: rgb(233 245 255); font-size: 17px; } .site-footer { - border-top: 1px solid #343a40; - background: #20252a; - color: #d8dde2; + border-top: 1px solid rgb(52 58 64); + background: rgb(32 37 42); + color: rgb(216 221 226); } .site-footer .brand { @@ -808,11 +808,11 @@ a { .footer-grid p { max-width: 430px; margin: 12px 0 0; - color: #aeb6bf; + color: rgb(174 182 191); } .footer-grid a { - color: #d8dde2; + color: rgb(216 221 226); } .footer-grid strong { @@ -824,14 +824,14 @@ a { display: flex; justify-content: space-between; gap: 20px; - border-top: 1px solid #3a4148; + border-top: 1px solid rgb(58 65 72); padding-block: 22px; - color: #aeb6bf; + color: rgb(174 182 191); font-size: 13px; } .footer-bottom a { - color: #d8dde2; + color: rgb(216 221 226); } .account-landing { @@ -976,7 +976,7 @@ a { display: grid; place-items: center; border-radius: 50%; - background: #dff6ed; + background: rgb(223 246 237); color: var(--green-600); content: "✓"; font-size: 11px; @@ -1014,8 +1014,8 @@ a { } .form-message-error { - border: 1px solid #f1aaa4; - background: #fff2f0; + border: 1px solid rgb(241 170 164); + background: rgb(255 242 240); color: var(--danger); } @@ -1033,7 +1033,7 @@ a { .field-group input { width: 100%; height: 44px; - border: 1px solid #89939e; + border: 1px solid rgb(137 147 158); border-radius: var(--radius-sm); padding: 8px 11px; background: var(--surface); @@ -1339,26 +1339,26 @@ a { } .status-planned { - background: #fff4ce; - color: #6a4b00; + background: rgb(255 244 206); + color: rgb(106 75 0); } :root[data-theme="dark"] .form-message-error { - border-color: #7a3936; - background: #321b1d; + border-color: rgb(122 57 54); + background: rgb(50 27 29); } :root[data-theme="dark"] .account-trust span::before { - background: #15392e; + background: rgb(21 57 46); } :root[data-theme="dark"] .status-planned { - background: #493a11; - color: #ffe58b; + background: rgb(73 58 17); + color: rgb(255 229 139); } :root[data-theme="dark"] .button-light { - color: #004e8c; + color: rgb(0 78 140); } .dashboard-state { @@ -1385,7 +1385,7 @@ a { color: var(--danger); } -@media (max-width: 920px) { +@media (width <= 920px) { .hero-grid, .account-landing-grid, .account-main, @@ -1435,7 +1435,7 @@ a { } } -@media (max-width: 680px) { +@media (width <= 680px) { .shell, .account-main { width: min(calc(100% - 28px), var(--shell)); @@ -1665,7 +1665,7 @@ textarea { color: var(--ink-950); } -@media (max-width: 980px) { +@media (width <= 980px) { .header-menu .primary-nav { border-bottom-color: var(--line); background: var(--surface); @@ -1675,8 +1675,8 @@ textarea { .site-footer { border-top: 1px solid rgb(240 238 230 / 12%); - background: #141413; - color: #b0aea5; + background: rgb(20 20 19); + color: rgb(176 174 165); } .footer-grid { @@ -1684,24 +1684,24 @@ textarea { } .footer-grid strong { - color: #f0eee6; + color: rgb(240 238 230); font-weight: 500; } .footer-grid a, .footer-bottom a { - color: #b0aea5; + color: rgb(176 174 165); font-size: 15px; transition: color 200ms ease; } .footer-grid a:hover, .footer-bottom a:hover { - color: #f0eee6; + color: rgb(240 238 230); text-decoration: none; } .footer-bottom { border-top-color: rgb(240 238 230 / 12%); - color: #8a8880; + color: rgb(138 136 128); } diff --git a/apps/web/app/news/[slug]/page.tsx b/apps/web/app/news/[slug]/page.tsx index bee024e..c40416d 100644 --- a/apps/web/app/news/[slug]/page.tsx +++ b/apps/web/app/news/[slug]/page.tsx @@ -8,15 +8,16 @@ import { JsonLd } from "@/components/JsonLd"; import { formatDay } from "@/components/ProductCatalog"; import { SiteHeader } from "@/components/SiteHeader"; import { Flow } from "@/components/site/Flow"; -import { accentColours, accentFields } from "@/lib/brand-colours"; +import { accentColour, accentField } from "@/lib/brand-colours"; import { getLocale } from "@/lib/locale.server"; import { articleUrl, findArticle, - newsMessages, + getNewsMessages, releaseNotes, + articleText, } from "@/lib/news"; -import { products } from "@/lib/products"; +import { productFacts } from "@/lib/products"; interface ArticlePageProps { params: Promise<{ slug: string }>; @@ -29,7 +30,7 @@ export async function generateMetadata({ if (!article) { return {}; } - const text = article.text[await getLocale()]; + const text = articleText(article, await getLocale()); return { title: text.title, description: text.summary, @@ -51,9 +52,9 @@ export default async function ArticlePage({ params }: ArticlePageProps) { notFound(); } const locale = await getLocale(); - const news = newsMessages[locale]; - const text = article.text[locale]; - const product = products[article.product]; + const news = getNewsMessages(locale); + const text = articleText(article, locale); + const product = productFacts(article.product); const notes = releaseNotes(article); return ( <div className="pm-page pm-home pm-news-site"> @@ -87,7 +88,7 @@ export default async function ArticlePage({ params }: ArticlePageProps) { <p className="pm-news-meta"> <span className="pm-chip" - style={{ background: accentColours[product.accent] }} + style={{ background: accentColour(product.accent) }} aria-hidden="true" /> <a href={`https://product.progmasoft.com/${article.product}`}> @@ -102,7 +103,7 @@ export default async function ArticlePage({ params }: ArticlePageProps) { </header> <div className="pm-shell"> <Flow - colours={accentFields[product.accent]} + colours={accentField(product.accent)} seed={7.1} speed={0.5} className="pm-article-field" @@ -110,7 +111,9 @@ export default async function ArticlePage({ params }: ArticlePageProps) { </div> <div className="pm-shell pm-article-body"> {text.body.map((paragraph) => ( - <p key={paragraph.slice(0, 32)}>{paragraph}</p> + <p className="pm-article-paragraph" key={paragraph.slice(0, 32)}> + {paragraph} + </p> ))} <p className="pm-pills pm-article-links"> {notes ? ( diff --git a/apps/web/app/news/news.css b/apps/web/app/news/news.css index 876528c..8c129eb 100644 --- a/apps/web/app/news/news.css +++ b/apps/web/app/news/news.css @@ -1,4 +1,5 @@ /* SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> */ + /* SPDX-License-Identifier: AGPL-3.0-or-later */ /* news.progmasoft.com: the language of the home page, with a large lead @@ -28,7 +29,7 @@ min-height: clamp(360px, 44vw, 520px); overflow: hidden; border-radius: 16px; - color: #fff; + color: rgb(255 255 255); align-items: end; text-decoration: none; } @@ -152,7 +153,7 @@ padding-block: clamp(40px, 5vw, 64px) clamp(72px, 9vw, 120px); } -.pm-article-body p:not(.pm-pills, .pm-article-back) { +.pm-article-paragraph { margin: 0 0 1.2em; font-size: 19px; line-height: 1.7; @@ -171,7 +172,7 @@ color: var(--home-soft); } -@media (max-width: 760px) { +@media (width <= 760px) { .pm-news-list ul { grid-template-columns: 1fr; } diff --git a/apps/web/app/news/page.tsx b/apps/web/app/news/page.tsx index 6b62801..331a604 100644 --- a/apps/web/app/news/page.tsx +++ b/apps/web/app/news/page.tsx @@ -7,13 +7,13 @@ import { formatDay } from "@/components/ProductCatalog"; import { SiteHeader } from "@/components/SiteHeader"; import { Flow } from "@/components/site/Flow"; import { Reveal } from "@/components/site/Reveal"; -import { accentColours, accentFields } from "@/lib/brand-colours"; +import { accentColour, accentField } from "@/lib/brand-colours"; import { getLocale } from "@/lib/locale.server"; -import { articles, articleUrl, newsMessages } from "@/lib/news"; -import { products } from "@/lib/products"; +import { articles, articleUrl, getNewsMessages, articleText } from "@/lib/news"; +import { productFacts } from "@/lib/products"; export async function generateMetadata(): Promise<Metadata> { - const news = newsMessages[await getLocale()]; + const news = getNewsMessages(await getLocale()); return { title: news.title, description: news.description, @@ -27,7 +27,7 @@ export async function generateMetadata(): Promise<Metadata> { */ export default async function NewsPage() { const locale = await getLocale(); - const news = newsMessages[locale]; + const news = getNewsMessages(locale); const [first, ...rest] = articles; return ( <div className="pm-page pm-home pm-news-site"> @@ -43,7 +43,7 @@ export default async function NewsPage() { <section className="pm-shell"> <a className="pm-news-lead" href={articleUrl(first)}> <Flow - colours={accentFields[products[first.product].accent]} + colours={accentField(productFacts(first.product).accent)} seed={4.2} speed={0.6} className="pm-news-lead-field" @@ -52,8 +52,10 @@ export default async function NewsPage() { <time dateTime={first.date}> {formatDay(locale, first.date)} </time> - <strong className="pm-serif">{first.text[locale].title}</strong> - <span>{first.text[locale].summary}</span> + <strong className="pm-serif"> + {articleText(first, locale).title} + </strong> + <span>{articleText(first, locale).summary}</span> </span> </a> </section> @@ -72,21 +74,22 @@ export default async function NewsPage() { <span className="pm-chip" style={{ - background: - accentColours[products[article.product].accent], + background: accentColour( + productFacts(article.product).accent, + ), }} aria-hidden="true" /> - <span>{products[article.product].name}</span> + <span>{productFacts(article.product).name}</span> <time dateTime={article.date}> {formatDay(locale, article.date)} </time> </span> <strong className="pm-serif"> - {article.text[locale].title} + {articleText(article, locale).title} </strong> <span className="pm-news-text"> - {article.text[locale].summary} + {articleText(article, locale).summary} </span> </a> </li> diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index 012665d..2e913dc 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -13,13 +13,13 @@ import { } from "@/components/site/FeatureCarousel"; import { Flow, type FlowColours } from "@/components/site/Flow"; import { Reveal } from "@/components/site/Reveal"; -import { accentColours, accentFields } from "@/lib/brand-colours"; -import { getHomeMessages } from "@/lib/home-messages"; +import { accentColour, accentField } from "@/lib/brand-colours"; +import { getHomeMessages, productLine } from "@/lib/home-messages"; import { getLocale } from "@/lib/locale.server"; import { getMessages } from "@/lib/localization"; -import { articles, articleUrl, releaseNotes } from "@/lib/news"; +import { articles, articleUrl, releaseNotes, articleText } from "@/lib/news"; import { policyUrls } from "@/lib/policies"; -import { products, productSlugs } from "@/lib/products"; +import { productFacts, productSlugs } from "@/lib/products"; import { organizationData, websiteData } from "@/lib/structured-data"; import "./site.css"; @@ -55,7 +55,11 @@ const placements = [ const step = (index: number) => ({ "--i": index }) as CSSProperties; const fill = (text: string, values: Record<string, string>) => - text.replace(/\{(\w+)\}/g, (_, key: string) => values[key] ?? ""); + text.replace( + /\{(\w+)\}/g, + (_, key: string) => + Object.entries(values).find(([name]) => name === key)?.[1] ?? "", + ); /** * progmasoft.com: a statement of what Progmasoft is, every product in turn over @@ -66,17 +70,17 @@ export default async function Homepage() { const home = getHomeMessages(locale); const news = articles.slice(0, 3); const made = [ - ...productSlugs.filter((slug) => products[slug].status === "released"), - ...productSlugs.filter((slug) => products[slug].status !== "released"), + ...productSlugs.filter((slug) => productFacts(slug).status === "released"), + ...productSlugs.filter((slug) => productFacts(slug).status !== "released"), ]; const feature: FeatureItem[] = made.map((slug) => { - const product = products[slug]; + const product = productFacts(slug); const release = product.latestRelease; return { slug, name: product.name, - line: home.lines[slug], - colours: accentFields[product.accent], + line: productLine(locale, slug), + colours: accentField(product.accent), more: { label: home.feature.readMore, href: `https://product.progmasoft.com/${slug}`, @@ -131,7 +135,7 @@ export default async function Homepage() { </div> <ul className="pm-news-cards"> {news.map((article, index) => { - const text = article.text[locale]; + const text = articleText(article, locale); const notes = releaseNotes(article); return ( <li @@ -144,8 +148,9 @@ export default async function Homepage() { <span className="pm-chip" style={{ - background: - accentColours[products[article.product].accent], + background: accentColour( + productFacts(article.product).accent, + ), }} aria-hidden="true" /> @@ -165,7 +170,7 @@ export default async function Homepage() { <a href={`https://product.progmasoft.com/${article.product}`} > - {products[article.product].name} → + {productFacts(article.product).name} → </a> </dd> </div> @@ -203,14 +208,14 @@ export default async function Homepage() { data-reveal style={ { - "--colour": accentColours[products[slug].accent], + "--colour": accentColour(productFacts(slug).accent), } as CSSProperties } > <h3 className="pm-scatter-name pm-serif"> - {products[slug].name} + {productFacts(slug).name} </h3> - <p className="pm-scatter-line">{home.lines[slug]}</p> + <p className="pm-scatter-line">{productLine(locale, slug)}</p> <p className="pm-more"> <a href={`https://product.progmasoft.com/${slug}`}> {home.showcase.learnMore} → @@ -230,8 +235,8 @@ export default async function Homepage() { <li key={title} data-reveal style={step(index)}> <Flow colours={ - principleFields[index % principleFields.length] ?? - accentFields.slate + principleFields.at(index % principleFields.length) ?? + accentField("slate") } seed={index * 3.7 + 1} speed={0.35} @@ -260,7 +265,7 @@ export default async function Homepage() { <p>{text}</p> <a className="pm-pill pm-pill-outline" - href={contactLinks[index]} + href={contactLinks.at(index)} > {action} ↗ </a> diff --git a/apps/web/app/site.css b/apps/web/app/site.css index 5654b1e..ff7b7e4 100644 --- a/apps/web/app/site.css +++ b/apps/web/app/site.css @@ -5,17 +5,17 @@ surfaces, rules and type: no gradients, glows, shadows or icon tiles. */ .pm-page { - --pm-violet: #6d4fe0; - --pm-teal: #0f9e94; - --pm-orange: #e46c2f; + --pm-violet: rgb(109 79 224); + --pm-teal: rgb(15 158 148); + --pm-orange: rgb(228 108 47); --pm-glow: rgb(0 120 212 / 14%); background: var(--surface); } :root[data-theme="dark"] .pm-page { - --pm-violet: #a98bff; - --pm-teal: #4fd1c5; - --pm-orange: #ff9a62; + --pm-violet: rgb(169 139 255); + --pm-teal: rgb(79 209 197); + --pm-orange: rgb(255 154 98); --pm-glow: rgb(54 159 232 / 18%); } @@ -76,6 +76,7 @@ --home-soft: var(--ink-650); --home-rule: var(--line); --ease: cubic-bezier(0.2, 0.7, 0.2, 1); + background: var(--home-paper); } @@ -146,8 +147,8 @@ min-height: clamp(420px, 52vw, 640px); overflow: hidden; border-radius: 16px; - background: #1e5f78; - color: #fff; + background: rgb(30 95 120); + color: rgb(255 255 255); place-items: center; animation: pm-fade 1100ms var(--ease) 200ms both; } @@ -200,11 +201,11 @@ text-shadow: 0 1px 12px rgb(0 0 0 / 30%); } -.pm-feature-names button[aria-current="true"] { - color: #fff; +.pm-feature-names [aria-current="true"] { + color: rgb(255 255 255); } -.pm-feature-names button[aria-current="true"]::after, +.pm-feature-names [aria-current="true"]::after, .pm-feature-timer { position: absolute; right: 0; @@ -214,13 +215,13 @@ content: ""; } -.pm-feature-names button[aria-current="true"]::after { +.pm-feature-names [aria-current="true"]::after { background: rgb(255 255 255 / 35%); } .pm-feature-timer { z-index: 1; - background: #fff; + background: rgb(255 255 255); transform-origin: left; animation: pm-timer 7000ms linear both; } @@ -234,7 +235,7 @@ border: 1px solid rgb(255 255 255 / 45%); border-radius: 50%; background: rgb(0 0 0 / 18%); - color: #fff; + color: rgb(255 255 255); font-size: 12px; cursor: pointer; backdrop-filter: blur(6px); @@ -274,7 +275,7 @@ line-height: 1.02; } -.pm-feature-copy p:not(.pm-pills) { +.pm-feature-line { margin: 20px auto 0; max-width: 420px; font-size: 18px; @@ -307,13 +308,13 @@ } .pm-pill-light { - background: #fff; - color: #141413; + background: rgb(255 255 255); + color: rgb(20 20 19); } .pm-pill-dark { - background: #141413; - color: #fff; + background: rgb(20 20 19); + color: rgb(255 255 255); } .pm-pill-outline { @@ -461,22 +462,27 @@ .pm-scatter-left { justify-self: start; } + .pm-scatter-right { justify-self: end; margin-top: 40px; } + .pm-scatter-centre { justify-self: start; margin-left: 22%; } + .pm-scatter-far-right { justify-self: end; } + .pm-scatter-left-low { justify-self: start; margin-left: 8%; margin-top: 56px; } + .pm-scatter-right-high { justify-self: end; margin-right: 14%; @@ -564,8 +570,8 @@ .pm-contact { padding-block: clamp(72px, 9vw, 120px); - background: #141413; - color: #f0eee6; + background: rgb(20 20 19); + color: rgb(240 238 230); } .pm-contact-cards { @@ -600,7 +606,7 @@ .pm-contact-cards p { margin: 12px 0 24px; - color: #b0aea5; + color: rgb(176 174 165); font-size: 16px; line-height: 1.5; } @@ -629,6 +635,7 @@ from { transform: scaleX(0); } + to { transform: scaleX(1); } @@ -769,7 +776,7 @@ } .pm-accent-slate { - background: #59606b; + background: rgb(89 96 107); } .pm-detail { @@ -811,7 +818,7 @@ .pm-code-light { border-color: var(--line); - background: #111722; + background: rgb(17 23 34); font-size: 13px; } @@ -825,7 +832,7 @@ content: "→"; } -@media (max-width: 960px) { +@media (width <= 960px) { .pm-detail { grid-template-columns: 1fr; } @@ -843,13 +850,13 @@ grid-template-columns: repeat(2, minmax(0, 1fr)); } - .pm-scatter-item { - justify-self: stretch !important; - margin: 0 !important; + .pm-scatter > .pm-scatter-item { + justify-self: stretch; + margin: 0; } } -@media (max-width: 520px) { +@media (width <= 520px) { .pm-feature-names { flex-wrap: nowrap; min-width: 0; diff --git a/apps/web/components/site/FeatureCarousel.tsx b/apps/web/components/site/FeatureCarousel.tsx index a6c7f16..06444c8 100644 --- a/apps/web/components/site/FeatureCarousel.tsx +++ b/apps/web/components/site/FeatureCarousel.tsx @@ -29,7 +29,9 @@ const stillQuery = "(prefers-reduced-motion: reduce)"; function subscribeMotion(onChange: () => void) { const query = window.matchMedia(stillQuery); query.addEventListener("change", onChange); - return () => query.removeEventListener("change", onChange); + return () => { + query.removeEventListener("change", onChange); + }; } function prefersStill() { @@ -61,14 +63,15 @@ export function FeatureCarousel({ return; } - const timer = window.setTimeout( - () => setCurrent((index) => (index + 1) % items.length), - interval, - ); - return () => window.clearTimeout(timer); + const timer = window.setTimeout(() => { + setCurrent((index) => (index + 1) % items.length); + }, interval); + return () => { + window.clearTimeout(timer); + }; }, [current, turning, items.length]); - const item = items[current]; + const item = items.at(current); if (!item) { return null; } @@ -92,7 +95,7 @@ export function FeatureCarousel({ aria-live={turning ? "off" : "polite"} > <h2 className="pm-serif">{item.name}</h2> - <p>{item.line}</p> + <p className="pm-feature-line">{item.line}</p> <p className="pm-pills"> <a className="pm-pill pm-pill-light" href={item.more.href}> {item.more.label} @@ -126,7 +129,9 @@ export function FeatureCarousel({ type="button" className="pm-flow-toggle" aria-label={paused ? play : pause} - onClick={() => setPaused(!paused)} + onClick={() => { + setPaused(!paused); + }} > {paused ? "▶" : "❚❚"} </button> diff --git a/apps/web/components/site/Flow.tsx b/apps/web/components/site/Flow.tsx index 27fe90c..dfd4912 100644 --- a/apps/web/components/site/Flow.tsx +++ b/apps/web/components/site/Flow.tsx @@ -126,7 +126,7 @@ export function Flow({ const still = window.matchMedia("(prefers-reduced-motion: reduce)").matches || speed === 0; - const current = target.current.map((colour) => [...colour]); + let current = target.current.map((colour) => [...colour]); let visible = true; let frame = 0; let clock = seed * 10; @@ -140,19 +140,20 @@ export function Flow({ gl.uniform2f(size, element.width, element.height); }; const draw = () => { - current.forEach((colour, index) => - gl.uniform3fv(slots[index] ?? null, colour), - ); + current.forEach((colour, index) => { + gl.uniform3fv(slots.at(index) ?? null, colour); + }); gl.uniform1f(time, clock); gl.drawArrays(gl.TRIANGLES, 0, 3); }; + /** Moves every colour the given share of the way to its target. */ const blend = (amount: number) => { - current.forEach((colour, index) => { - const goal = target.current[index] ?? colour; - for (let channel = 0; channel < 3; channel += 1) { - const now = colour[channel] ?? 0; - colour[channel] = now + ((goal[channel] ?? 0) - now) * amount; - } + current = current.map((colour, index) => { + const goal = target.current.at(index) ?? colour; + return colour.map( + (value, channel) => + value + ((goal.at(channel) ?? value) - value) * amount, + ); }); }; const tick = (now: number) => { @@ -180,8 +181,8 @@ export function Flow({ draw(); }); resizer.observe(element); - const watcher = new IntersectionObserver(([entry]) => { - visible = entry?.isIntersecting ?? true; + const watcher = new IntersectionObserver((entries) => { + visible = entries.some((entry) => entry.isIntersecting); }); watcher.observe(element); if (!still) frame = requestAnimationFrame(tick); diff --git a/apps/web/components/site/Reveal.tsx b/apps/web/components/site/Reveal.tsx index 6971d59..f2192ec 100644 --- a/apps/web/components/site/Reveal.tsx +++ b/apps/web/components/site/Reveal.tsx @@ -35,7 +35,9 @@ export function Reveal() { }, { rootMargin: "0px 0px -12% 0px", threshold: 0.12 }, ); - elements.forEach((element) => observer.observe(element)); + elements.forEach((element) => { + observer.observe(element); + }); return () => { observer.disconnect(); root.classList.remove("pm-motion"); diff --git a/apps/web/lib/brand-colours.ts b/apps/web/lib/brand-colours.ts index 07af37d..e5f8ac9 100644 --- a/apps/web/lib/brand-colours.ts +++ b/apps/web/lib/brand-colours.ts @@ -8,22 +8,38 @@ type Accent = ProductFacts["accent"]; /** Four colours of a moving field, from the deepest to the lightest. */ export type FieldColours = [string, string, string, string]; -/** The colour of each accent of the catalog. */ -export const accentColours: Record<Accent, string> = { - violet: "#7655fa", - blue: "#0066b8", - green: "#1f8a5b", - orange: "#dc7644", - teal: "#1e7188", - slate: "#3b4658", -}; +/** The colour of an accent of the catalog. */ +export function accentColour(accent: Accent): string { + switch (accent) { + case "violet": + return "#7655fa"; + case "blue": + return "#0066b8"; + case "green": + return "#1f8a5b"; + case "orange": + return "#dc7644"; + case "teal": + return "#1e7188"; + case "slate": + return "#3b4658"; + } +} -/** The moving field of each accent: its colour, deep to light. */ -export const accentFields: Record<Accent, FieldColours> = { - orange: ["#3a1a0c", "#b4572a", "#e8a070", "#f3e3cf"], - green: ["#0d2a1e", "#1f8a5b", "#8fd1ad", "#eef0e2"], - slate: ["#14233a", "#3b4658", "#9aa7bd", "#e9e4d8"], - violet: ["#1d1446", "#7655fa", "#c4b6ff", "#f1ece2"], - blue: ["#0a1f3d", "#0066b8", "#8cc0ec", "#eef1ee"], - teal: ["#0f3440", "#1e7188", "#7fb8c4", "#efe9dc"], -}; +/** The moving field of an accent: its colour, deep to light. */ +export function accentField(accent: Accent): FieldColours { + switch (accent) { + case "orange": + return ["#3a1a0c", "#b4572a", "#e8a070", "#f3e3cf"]; + case "green": + return ["#0d2a1e", "#1f8a5b", "#8fd1ad", "#eef0e2"]; + case "slate": + return ["#14233a", "#3b4658", "#9aa7bd", "#e9e4d8"]; + case "violet": + return ["#1d1446", "#7655fa", "#c4b6ff", "#f1ece2"]; + case "blue": + return ["#0a1f3d", "#0066b8", "#8cc0ec", "#eef1ee"]; + case "teal": + return ["#0f3440", "#1e7188", "#7fb8c4", "#efe9dc"]; + } +} diff --git a/apps/web/lib/home-messages.ts b/apps/web/lib/home-messages.ts index 219c0b0..f0a38bb 100644 --- a/apps/web/lib/home-messages.ts +++ b/apps/web/lib/home-messages.ts @@ -363,3 +363,8 @@ export const homeMessages: Record<Locale, HomeMessages> = { export function getHomeMessages(locale: Locale): HomeMessages { return homeMessages[locale]; } + +/** The headline-length line of one product, in one language. */ +export function productLine(locale: Locale, slug: ProductSlug): string { + return homeMessages[locale].lines[slug]; +} diff --git a/apps/web/lib/news.ts b/apps/web/lib/news.ts index 3cf5892..a78ac8f 100644 --- a/apps/web/lib/news.ts +++ b/apps/web/lib/news.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-or-later import type { Locale } from "./localization"; -import { products, type ProductSlug } from "./products.ts"; +import { productFacts, type ProductSlug } from "./products.ts"; /** The words of one article in one language. */ interface ArticleText { @@ -195,7 +195,7 @@ export function articleUrl(article: Article): string { /** The release notes an article points to, from the catalog. */ export function releaseNotes(article: Article): string | undefined { - const release = products[article.product].latestRelease; + const release = productFacts(article.product).latestRelease; return release && release.version === article.release ? release.url : undefined; @@ -211,7 +211,7 @@ interface NewsMessages { read: string; } -export const newsMessages: Record<Locale, NewsMessages> = { +const newsMessages: Record<Locale, NewsMessages> = { "en-US": { title: "News", description: "Releases and announcements from Progmasoft.", @@ -265,3 +265,13 @@ export function newsRoute(pathname: string): string | null { const slug = /^\/([a-z0-9]+(?:-[a-z0-9]+)*)$/.exec(path)?.[1]; return slug && findArticle(slug) ? `/news/${slug}` : null; } + +/** The words of news.progmasoft.com in one language. */ +export function getNewsMessages(locale: Locale): NewsMessages { + return newsMessages[locale]; +} + +/** An article in one language. */ +export function articleText(article: Article, locale: Locale): ArticleText { + return article.text[locale]; +} diff --git a/apps/web/lib/products.ts b/apps/web/lib/products.ts index ec3aaa4..2c66202 100644 --- a/apps/web/lib/products.ts +++ b/apps/web/lib/products.ts @@ -245,3 +245,8 @@ export function releases(): { slug: ProductSlug; release: ProductRelease }[] { }) .sort((a, b) => b.release.date.localeCompare(a.release.date)); } + +/** The facts of one project of the catalog. */ +export function productFacts(slug: ProductSlug): ProductFacts { + return products[slug]; +} diff --git a/apps/web/tests/news.test.mjs b/apps/web/tests/news.test.mjs index f7f721c..03a7791 100644 --- a/apps/web/tests/news.test.mjs +++ b/apps/web/tests/news.test.mjs @@ -8,7 +8,7 @@ import { articles, articleUrl, findArticle, - newsMessages, + getNewsMessages, newsRoute, releaseNotes, slugOf, @@ -53,7 +53,7 @@ test("every article is written in every language", () => { } } for (const locale of supportedLocales) { - assert.ok(newsMessages[locale].title, locale); + assert.ok(getNewsMessages(locale).title, locale); } });