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
Group ViGet by language and by build system
- Commit
16b47e37e2d00b5f9bf0c83c1c03cc6a0991f1c4- Author
- Leitwolf11 ·
- Parents
1fb84ac424dc
Changes
README.md | 6 +- apps/web/app/page.tsx | 2 +- apps/web/app/sitemap.ts | 7 +- apps/web/app/viget.css | 24 ++++ apps/web/app/viget/dslplugins/{ => tazel}/page.tsx | 28 ++-- apps/web/app/viget/langs/tala/page.tsx | 79 +++++++++++ apps/web/app/viget/page.tsx | 82 +++++------- apps/web/components/Footer.tsx | 2 +- apps/web/components/ViGetCatalogSection.tsx | 71 ++++++++++ apps/web/components/ViGetFooter.tsx | 6 +- apps/web/components/ViGetHeader.tsx | 6 +- apps/web/lib/localization.ts | 8 +- apps/web/lib/viget-catalogs.ts | 145 +++++++++++++++++++++ apps/web/proxy.ts | 22 +++- apps/web/tests/viget-catalogs.test.mjs | 92 +++++++++++++ 15 files changed, 501 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index 99e56d9..fa646cd 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,10 @@ the ASP.NET Core API. - `account.progmasoft.com/login` signs an existing account in. - `account.progmasoft.com/register` creates a new account after server-side validation. - `account.progmasoft.com/<Account>/dashboard` serves the authenticated account dashboard. -- `viget.progmasoft.com` serves the public Tala package catalog. -- `viget.progmasoft.com/dslplugins/` serves the separate Kotlin DSL plugin catalog. +- `viget.progmasoft.com` shows the state of the registry first, then two groups: LANGUAGES and BUILD SYSTEM DSL PLUGINS. + An open catalog links to its page; a catalog that is not offered yet (C++, Gradle) is a gray, disabled button. +- `viget.progmasoft.com/langs/tala` serves the catalog of Tala packages (`.vipkg`); `/langs` leads there. +- `viget.progmasoft.com/dslplugins/tazel` serves the catalog of Kotlin DSL plugins for Tazel; `/dslplugins` leads there. Account names preserve their original display case but reserve names case-insensitively, preventing visually confusing duplicates. Email uniqueness is also evaluated case-insensitively by the API. diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index 2aabe5a..ade7da8 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -20,7 +20,7 @@ export async function generateMetadata(): Promise<Metadata> { const productLinks = [ { - href: "https://xsharp-lang.xyz/", + href: "https://tala.run/", accent: "violet", }, { diff --git a/apps/web/app/sitemap.ts b/apps/web/app/sitemap.ts index 855323a..2c0b47c 100644 --- a/apps/web/app/sitemap.ts +++ b/apps/web/app/sitemap.ts @@ -21,7 +21,12 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> { priority: 1, }, { - url: "https://viget.progmasoft.com/dslplugins/", + url: "https://viget.progmasoft.com/langs/tala", + changeFrequency: "weekly", + priority: 0.8, + }, + { + url: "https://viget.progmasoft.com/dslplugins/tazel", changeFrequency: "weekly", priority: 0.8, }, diff --git a/apps/web/app/viget.css b/apps/web/app/viget.css index 5578115..9d6b68f 100644 --- a/apps/web/app/viget.css +++ b/apps/web/app/viget.css @@ -335,3 +335,27 @@ a.viget-catalog-card:hover { padding: 24px; } } + +/* The two catalog groups of the home page are named in capitals, as the registry names them. */ +.viget-catalog-heading { + margin: 0; + font-size: clamp(22px, 2.6vw, 30px); + letter-spacing: 0.08em; +} + +/* A catalog that is not offered yet: gray, flat and not pressable. */ +.viget-catalog-disabled { + font: inherit; + text-align: start; + border-color: var(--line); + background: var(--surface-muted, var(--surface)); + color: var(--ink-500); + box-shadow: none; + cursor: not-allowed; + opacity: 0.62; +} + +.viget-catalog-disabled h3, +.viget-catalog-disabled small { + color: var(--ink-500); +} diff --git a/apps/web/app/viget/dslplugins/page.tsx b/apps/web/app/viget/dslplugins/tazel/page.tsx similarity index 73% rename from apps/web/app/viget/dslplugins/page.tsx rename to apps/web/app/viget/dslplugins/tazel/page.tsx index 75f54f8..5195170 100644 --- a/apps/web/app/viget/dslplugins/page.tsx +++ b/apps/web/app/viget/dslplugins/tazel/page.tsx @@ -6,22 +6,25 @@ import { ViGetFooter } from "@/components/ViGetFooter"; import { ViGetHeader } from "@/components/ViGetHeader"; import { getLocale } from "@/lib/locale.server"; import { forwardArrow, getMessages } from "@/lib/localization"; +import { catalogText } from "@/lib/viget-catalogs"; export async function generateMetadata(): Promise<Metadata> { - const { metadata } = getMessages(await getLocale()); + const locale = await getLocale(); + const { metadata } = getMessages(locale); return { - title: metadata.dslPluginsTitle, + title: `${catalogText(locale).tazelTitle} · ViGet`, description: metadata.dslPluginsDescription, alternates: { - canonical: "https://viget.progmasoft.com/dslplugins/", + canonical: "https://viget.progmasoft.com/dslplugins/tazel", }, robots: { index: true, follow: true }, }; } -export default async function DslPluginsPage() { +export default async function TazelPluginsPage() { const locale = await getLocale(); const { viget } = getMessages(locale); + const catalogs = catalogText(locale); return ( <div className="viget-surface"> <ViGetHeader locale={locale} /> @@ -29,21 +32,18 @@ export default async function DslPluginsPage() { <section className="viget-plugin-hero"> <div className="shell viget-plugin-grid"> <div className="viget-hero-copy"> - <p className="eyebrow">{viget.pluginEyebrow}</p> - <h1>{viget.pluginTitle}</h1> - <p>{viget.pluginDescription}</p> + <p className="eyebrow">ViGet · BUILD SYSTEM DSL PLUGINS</p> + <h1>{catalogs.tazelTitle}</h1> + <p>{catalogs.tazelDescription}</p> <div className="hero-actions"> <a className="button button-secondary" href="https://viget.progmasoft.com/" > - {viget.backToPackages} + {catalogs.backToRegistry} </a> - <a - className="viget-text-link" - href="https://github.com/Progmasoft/tala" - > - {viget.followDevelopment} {forwardArrow(locale)} + <a className="viget-text-link" href="https://tazel.tala.run/"> + Tazel {forwardArrow(locale)} </a> </div> </div> @@ -57,7 +57,7 @@ export default async function DslPluginsPage() { </div> <h2 id="plugin-availability-title">{viget.pluginEmptyTitle}</h2> <p>{viget.pluginEmptyDescription}</p> - <code>/dslplugins/<Publisher>/<Name>/</code> + <code>/dslplugins/tazel/<Publisher>/<Name>/</code> </aside> </div> </section> diff --git a/apps/web/app/viget/langs/tala/page.tsx b/apps/web/app/viget/langs/tala/page.tsx new file mode 100644 index 0000000..e5aeafb --- /dev/null +++ b/apps/web/app/viget/langs/tala/page.tsx @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 + +import type { Metadata } from "next"; +import { ViGetFooter } from "@/components/ViGetFooter"; +import { ViGetHeader } from "@/components/ViGetHeader"; +import { getLocale } from "@/lib/locale.server"; +import { forwardArrow, getMessages } from "@/lib/localization"; +import { catalogText } from "@/lib/viget-catalogs"; + +export async function generateMetadata(): Promise<Metadata> { + const catalogs = catalogText(await getLocale()); + return { + title: `${catalogs.talaTitle} · ViGet`, + description: catalogs.talaDescription, + alternates: { canonical: "https://viget.progmasoft.com/langs/tala" }, + robots: { index: true, follow: true }, + }; +} + +export default async function TalaPackagesPage() { + const locale = await getLocale(); + const { viget } = getMessages(locale); + const catalogs = catalogText(locale); + return ( + <div className="viget-surface"> + <ViGetHeader locale={locale} /> + <main> + <section className="viget-plugin-hero"> + <div className="shell viget-plugin-grid"> + <div className="viget-hero-copy"> + <p className="eyebrow">ViGet · LANGUAGES</p> + <h1>{catalogs.talaTitle}</h1> + <p>{catalogs.talaDescription}</p> + <div className="hero-actions"> + <a + className="button button-secondary" + href="https://viget.progmasoft.com/" + > + {catalogs.backToRegistry} + </a> + <a className="viget-text-link" href="https://tala.run/"> + Tala {forwardArrow(locale)} + </a> + </div> + </div> + <aside + className="viget-availability" + aria-labelledby="package-availability-title" + > + <div className="viget-status"> + <span aria-hidden="true" /> + {viget.available} + </div> + <h2 id="package-availability-title">{catalogs.talaEmptyTitle}</h2> + <p>{catalogs.talaEmptyDescription}</p> + <dl> + <div> + <dt>{viget.packageFormat}</dt> + <dd>.vipkg</dd> + </div> + <div> + <dt>{viget.publisherIdentity}</dt> + <dd>Progmasoft Account</dd> + </div> + <div> + <dt>{viget.publishing}</dt> + <dd>{viget.publishingClosed}</dd> + </div> + </dl> + <code>/langs/tala/<Publisher>/<Name>/</code> + </aside> + </div> + </section> + </main> + <ViGetFooter locale={locale} /> + </div> + ); +} diff --git a/apps/web/app/viget/page.tsx b/apps/web/app/viget/page.tsx index 536fe65..65c7f81 100644 --- a/apps/web/app/viget/page.tsx +++ b/apps/web/app/viget/page.tsx @@ -2,10 +2,18 @@ // SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 import type { Metadata } from "next"; +import { ViGetCatalogSection } from "@/components/ViGetCatalogSection"; import { ViGetFooter } from "@/components/ViGetFooter"; import { ViGetHeader } from "@/components/ViGetHeader"; import { getLocale } from "@/lib/locale.server"; -import { forwardArrow, getMessages } from "@/lib/localization"; +import { getMessages } from "@/lib/localization"; +import { + buildSystemCatalogs, + buildSystemsHeading, + catalogText, + languageCatalogs, + languagesHeading, +} from "@/lib/viget-catalogs"; export async function generateMetadata(): Promise<Metadata> { const { metadata } = getMessages(await getLocale()); @@ -20,14 +28,16 @@ export async function generateMetadata(): Promise<Metadata> { export default async function ViGetPage() { const locale = await getLocale(); const { viget } = getMessages(locale); + const catalogs = catalogText(locale); return ( <div className="viget-surface"> <ViGetHeader locale={locale} /> <main> - <section className="viget-hero"> + {/* The state of the registry comes first: what it holds today and what is open. */} + <section className="viget-hero" aria-labelledby="viget-status-title"> <div className="shell viget-hero-grid"> <div className="viget-hero-copy"> - <p className="eyebrow">{viget.homeEyebrow}</p> + <p className="eyebrow">{catalogs.statusEyebrow}</p> <h1>{viget.homeTitle}</h1> <p>{viget.homeDescription}</p> <div className="hero-actions"> @@ -37,23 +47,17 @@ export default async function ViGetPage() { > {viget.createAccount} </a> - <a - className="button button-secondary" - href="https://xsharp-lang.xyz/" - > + <a className="button button-secondary" href="https://tala.run/"> {viget.exploreTala} </a> </div> </div> - <aside - className="viget-availability" - aria-labelledby="viget-availability-title" - > + <aside className="viget-availability"> <div className="viget-status"> <span aria-hidden="true" /> {viget.available} </div> - <h2 id="viget-availability-title">{viget.emptyTitle}</h2> + <h2 id="viget-status-title">{viget.emptyTitle}</h2> <p>{viget.emptyDescription}</p> <dl> <div> @@ -73,45 +77,23 @@ export default async function ViGetPage() { </div> </section> - <section className="section section-muted"> - <div className="shell"> - <div className="section-heading"> - <div> - <p className="eyebrow">{viget.catalogsEyebrow}</p> - <h2>{viget.catalogsTitle}</h2> - </div> - <p>{viget.catalogsDescription}</p> - </div> - <div className="viget-catalog-grid"> - <article className="viget-catalog-card viget-catalog-primary"> - <span>01</span> - <p>{viget.talaPackages}</p> - <h3>{viget.vipkgCatalog}</h3> - <code> - viget.progmasoft.com/<Publisher>/<Name>/ - </code> - <small>{viget.vipkgDescription}</small> - </article> - <a - className="viget-catalog-card" - href="https://viget.progmasoft.com/dslplugins/" - > - <span>02</span> - <p>{viget.projectExtensions}</p> - <h3>{viget.kotlinPlugins}</h3> - <code> - viget.progmasoft.com/dslplugins/<Publisher>/<Name>/ - </code> - <small>{viget.kotlinDescription}</small> - <strong> - {viget.openCatalog} {forwardArrow(locale)} - </strong> - </a> - </div> - </div> - </section> + <ViGetCatalogSection + id="languages" + heading={languagesHeading} + description={catalogs.languagesDescription} + catalogs={languageCatalogs} + locale={locale} + muted + /> + <ViGetCatalogSection + id="build-systems" + heading={buildSystemsHeading} + description={catalogs.buildSystemsDescription} + catalogs={buildSystemCatalogs} + locale={locale} + /> - <section className="section viget-contract"> + <section className="section section-muted viget-contract"> <div className="shell viget-contract-grid"> <div> <p className="eyebrow">{viget.contractEyebrow}</p> diff --git a/apps/web/components/Footer.tsx b/apps/web/components/Footer.tsx index 5faacd1..1551fae 100644 --- a/apps/web/components/Footer.tsx +++ b/apps/web/components/Footer.tsx @@ -15,7 +15,7 @@ export function Footer({ locale }: { locale: Locale }) { </div> <div> <strong>{footer.products}</strong> - <a href="https://xsharp-lang.xyz/">Tala</a> + <a href="https://tala.run/">Tala</a> <a href="https://viget.progmasoft.com/">ViGet</a> <a href="https://github.com/Progmasoft">{footer.openSource}</a> </div> diff --git a/apps/web/components/ViGetCatalogSection.tsx b/apps/web/components/ViGetCatalogSection.tsx new file mode 100644 index 0000000..522fd31 --- /dev/null +++ b/apps/web/components/ViGetCatalogSection.tsx @@ -0,0 +1,71 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 + +import { forwardArrow, type Locale } from "@/lib/localization"; +import { catalogText, type Catalog } from "@/lib/viget-catalogs"; + +/** + * One group of catalogs on the ViGet home page. An open catalog is a link to its page; a catalog + * that is not offered yet is a disabled button: gray, not pressable and leading nowhere. + */ +export function ViGetCatalogSection({ + id, + heading, + description, + catalogs, + locale, + muted = false, +}: { + id: string; + heading: string; + description: string; + catalogs: readonly Catalog[]; + locale: Locale; + muted?: boolean; +}) { + const text = catalogText(locale); + return ( + <section + className={muted ? "section section-muted" : "section"} + aria-labelledby={`${id}-title`} + > + <div className="shell"> + <div className="section-heading"> + <div> + <h2 id={`${id}-title`} className="viget-catalog-heading"> + {heading} + </h2> + </div> + <p>{description}</p> + </div> + <div className="viget-catalog-grid"> + {catalogs.map((catalog) => + catalog.path ? ( + <a + key={catalog.name} + className="viget-catalog-card viget-catalog-primary" + href={`https://viget.progmasoft.com${catalog.path}`} + > + <h3>{catalog.name}</h3> + <small>{text.holds[catalog.name]}</small> + <strong> + {text.open} {forwardArrow(locale)} + </strong> + </a> + ) : ( + <button + key={catalog.name} + className="viget-catalog-card viget-catalog-disabled" + type="button" + disabled + > + <h3>{catalog.name}</h3> + <small>{text.notAvailable}</small> + </button> + ), + )} + </div> + </div> + </section> + ); +} diff --git a/apps/web/components/ViGetFooter.tsx b/apps/web/components/ViGetFooter.tsx index 2b1f60f..d3d2858 100644 --- a/apps/web/components/ViGetFooter.tsx +++ b/apps/web/components/ViGetFooter.tsx @@ -15,11 +15,11 @@ export function ViGetFooter({ locale }: { locale: Locale }) { </div> <div> <strong>{viget.registry}</strong> - <a href="https://viget.progmasoft.com/">{viget.packages}</a> - <a href="https://viget.progmasoft.com/dslplugins/"> + <a href="https://viget.progmasoft.com/langs/tala">{viget.packages}</a> + <a href="https://viget.progmasoft.com/dslplugins/tazel"> {viget.dslPlugins} </a> - <a href="https://xsharp-lang.xyz/">Tala</a> + <a href="https://tala.run/">Tala</a> </div> <div> <strong>Progmasoft</strong> diff --git a/apps/web/components/ViGetHeader.tsx b/apps/web/components/ViGetHeader.tsx index fd888fe..1e22793 100644 --- a/apps/web/components/ViGetHeader.tsx +++ b/apps/web/components/ViGetHeader.tsx @@ -16,8 +16,10 @@ export function ViGetHeader({ locale }: { locale: Locale }) { <span>ViGet</span> </div> <nav className="primary-nav" aria-label={viget.navigationLabel}> - <Link href="https://viget.progmasoft.com/">{viget.packages}</Link> - <Link href="https://viget.progmasoft.com/dslplugins/"> + <Link href="https://viget.progmasoft.com/langs/tala"> + {viget.packages} + </Link> + <Link href="https://viget.progmasoft.com/dslplugins/tazel"> {viget.dslPlugins} </Link> <Link href="https://account.progmasoft.com/login">{viget.login}</Link> diff --git a/apps/web/lib/localization.ts b/apps/web/lib/localization.ts index 8a54a45..59b7282 100644 --- a/apps/web/lib/localization.ts +++ b/apps/web/lib/localization.ts @@ -441,7 +441,7 @@ export const messages = { [ "Location", "Dedicated catalog", - "Plugin coordinates always begin with /dslplugins.", + "Plugin coordinates always begin with /dslplugins/tazel.", ], [ "Availability", @@ -775,7 +775,7 @@ export const messages = { [ "Ort", "Eigener Katalog", - "Plugin-Koordinaten beginnen immer mit /dslplugins.", + "Plugin-Koordinaten beginnen immer mit /dslplugins/tazel.", ], [ "Verfügbarkeit", @@ -1109,7 +1109,7 @@ export const messages = { [ "Расположение", "Отдельный каталог", - "Координаты плагинов всегда начинаются с /dslplugins.", + "Координаты плагинов всегда начинаются с /dslplugins/tazel.", ], [ "Доступность", @@ -1412,7 +1412,7 @@ export const messages = { [ "מיקום", "קטלוג ייעודי", - "קואורדינטות של תוסף מתחילות תמיד ב-/dslplugins.", + "קואורדינטות של תוסף מתחילות תמיד ב-/dslplugins/tazel.", ], [ "זמינות", diff --git a/apps/web/lib/viget-catalogs.ts b/apps/web/lib/viget-catalogs.ts new file mode 100644 index 0000000..9231c0c --- /dev/null +++ b/apps/web/lib/viget-catalogs.ts @@ -0,0 +1,145 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 + +import type { Locale } from "./localization"; + +/** + * A catalog ViGet lists. A catalog with a path is open and links to its page; one without is not + * offered yet and is shown disabled. + */ +export type Catalog = { + readonly name: string; + readonly path?: string; +}; + +/** The languages whose packages ViGet hosts, in the order the page lists them. */ +export const languageCatalogs: readonly Catalog[] = [ + { name: "Tala", path: "/langs/tala" }, + { name: "C++" }, +]; + +/** The build systems whose DSL plugins ViGet hosts, in the order the page lists them. */ +export const buildSystemCatalogs: readonly Catalog[] = [ + { name: "Tazel", path: "/dslplugins/tazel" }, + { name: "Gradle" }, +]; + +// The two section names are the ones the registry uses everywhere; they are +// not translated, like the product names below them. +export const languagesHeading = "LANGUAGES"; +export const buildSystemsHeading = "BUILD SYSTEM DSL PLUGINS"; + +type CatalogText = { + statusEyebrow: string; + languagesDescription: string; + buildSystemsDescription: string; + /** What each open catalog holds, by catalog name. */ + holds: Record<string, string>; + notAvailable: string; + open: string; + talaTitle: string; + talaDescription: string; + talaEmptyTitle: string; + talaEmptyDescription: string; + tazelTitle: string; + tazelDescription: string; + backToRegistry: string; +}; + +const text: Record<Locale, CatalogText> = { + "en-US": { + statusEyebrow: "ViGet status", + languagesDescription: + "Packages written in a language, as .vipkg artifacts.", + buildSystemsDescription: + "Plugins that extend the project file of a build system.", + holds: { + Tala: "Libraries and applications written in Tala.", + Tazel: "Kotlin JAR plugins for the BUILD.kts of Tazel.", + }, + notAvailable: "Not available yet", + open: "Open catalog", + talaTitle: "Tala packages", + talaDescription: + "Libraries and applications written in Tala, distributed as .vipkg artifacts and published under a Progmasoft Account.", + talaEmptyTitle: "No Tala packages yet.", + talaEmptyDescription: + "The catalog is ready and intentionally contains no placeholder packages. Publishing opens with the ViGet client of Tazel.", + tazelTitle: "Tazel DSL plugins", + tazelDescription: + "Kotlin JAR plugins that extend the project file of Tazel, the build system of Tala. They are separate from .vipkg packages.", + backToRegistry: "Back to ViGet", + }, + "de-DE": { + statusEyebrow: "ViGet-Status", + languagesDescription: + "Pakete, die in einer Sprache geschrieben sind, als .vipkg-Artefakte.", + buildSystemsDescription: + "Plugins, die die Projektdatei eines Build-Systems erweitern.", + holds: { + Tala: "Bibliotheken und Anwendungen, geschrieben in Tala.", + Tazel: "Kotlin-JAR-Plugins für die BUILD.kts von Tazel.", + }, + notAvailable: "Noch nicht verfügbar", + open: "Katalog öffnen", + talaTitle: "Tala-Pakete", + talaDescription: + "Bibliotheken und Anwendungen in Tala, verteilt als .vipkg-Artefakte und veröffentlicht unter einem Progmasoft-Konto.", + talaEmptyTitle: "Noch keine Tala-Pakete.", + talaEmptyDescription: + "Der Katalog ist bereit und enthält bewusst keine Platzhalterpakete. Die Veröffentlichung öffnet mit dem ViGet-Client von Tazel.", + tazelTitle: "Tazel-DSL-Plugins", + tazelDescription: + "Kotlin-JAR-Plugins, die die Projektdatei von Tazel, dem Build-System von Tala, erweitern. Sie sind von .vipkg-Paketen getrennt.", + backToRegistry: "Zurück zu ViGet", + }, + "ru-RU": { + statusEyebrow: "Состояние ViGet", + languagesDescription: + "Пакеты, написанные на языке, в виде артефактов .vipkg.", + buildSystemsDescription: + "Плагины, расширяющие файл проекта системы сборки.", + holds: { + Tala: "Библиотеки и приложения, написанные на Tala.", + Tazel: "Плагины Kotlin JAR для BUILD.kts системы Tazel.", + }, + notAvailable: "Пока недоступно", + open: "Открыть каталог", + talaTitle: "Пакеты Tala", + talaDescription: + "Библиотеки и приложения на Tala, распространяемые как артефакты .vipkg и публикуемые от имени учётной записи Progmasoft.", + talaEmptyTitle: "Пакетов Tala пока нет.", + talaEmptyDescription: + "Каталог готов и намеренно не содержит пакетов-заглушек. Публикация откроется вместе с клиентом ViGet в Tazel.", + tazelTitle: "DSL-плагины Tazel", + tazelDescription: + "Плагины Kotlin JAR, расширяющие файл проекта Tazel, системы сборки Tala. Они отделены от пакетов .vipkg.", + backToRegistry: "Назад к ViGet", + }, + "he-IL": { + statusEyebrow: "מצב ViGet", + languagesDescription: "חבילות שנכתבו בשפה, כתוצרי .vipkg.", + buildSystemsDescription: "תוספים שמרחיבים את קובץ הפרויקט של מערכת בנייה.", + holds: { + Tala: "ספריות ויישומים שנכתבו ב-Tala.", + Tazel: "תוספי Kotlin JAR עבור BUILD.kts של Tazel.", + }, + notAvailable: "עוד לא זמין", + open: "פתיחת הקטלוג", + talaTitle: "חבילות Tala", + talaDescription: + "ספריות ויישומים ב-Tala, שמופצים כתוצרי .vipkg ומתפרסמים תחת חשבון Progmasoft.", + talaEmptyTitle: "עוד אין חבילות Tala.", + talaEmptyDescription: + "הקטלוג מוכן, ובכוונה אין בו חבילות ממלאות מקום. הפרסום ייפתח יחד עם לקוח ה-ViGet של Tazel.", + tazelTitle: "תוספי DSL של Tazel", + tazelDescription: + "תוספי Kotlin JAR שמרחיבים את קובץ הפרויקט של Tazel, מערכת הבנייה של Tala. הם נפרדים מחבילות .vipkg.", + backToRegistry: "חזרה ל-ViGet", + }, +}; + +/** The text of the ViGet catalogs in [locale]. */ +export function catalogText(locale: Locale): CatalogText { + return text[locale]; +} diff --git a/apps/web/proxy.ts b/apps/web/proxy.ts index 3eb5e60..a9ee327 100644 --- a/apps/web/proxy.ts +++ b/apps/web/proxy.ts @@ -65,8 +65,28 @@ export function proxy(request: NextRequest) { if (pathname === "/") { return NextResponse.rewrite(internalRoute(request, "/viget")); } + // Packages are grouped by the language they are written in and DSL + // plugins by the build system they extend. A group without a catalog of + // its own leads to the one catalog there is. + if (pathname === "/langs/tala" || pathname === "/langs/tala/") { + return NextResponse.rewrite(internalRoute(request, "/viget/langs/tala")); + } + if (pathname === "/dslplugins/tazel" || pathname === "/dslplugins/tazel/") { + return NextResponse.rewrite( + internalRoute(request, "/viget/dslplugins/tazel"), + ); + } + if (pathname === "/langs" || pathname === "/langs/") { + return NextResponse.redirect( + new URL("https://viget.progmasoft.com/langs/tala"), + 308, + ); + } if (pathname === "/dslplugins" || pathname === "/dslplugins/") { - return NextResponse.rewrite(internalRoute(request, "/viget/dslplugins")); + return NextResponse.redirect( + new URL("https://viget.progmasoft.com/dslplugins/tazel"), + 308, + ); } if (pathname === "/login" || pathname === "/login/") { return NextResponse.redirect( diff --git a/apps/web/tests/viget-catalogs.test.mjs b/apps/web/tests/viget-catalogs.test.mjs new file mode 100644 index 0000000..2238998 --- /dev/null +++ b/apps/web/tests/viget-catalogs.test.mjs @@ -0,0 +1,92 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 + +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { test } from "node:test"; +import { + buildSystemCatalogs, + buildSystemsHeading, + catalogText, + languageCatalogs, + languagesHeading, +} from "../lib/viget-catalogs.ts"; + +const locales = ["en-US", "de-DE", "ru-RU", "he-IL"]; + +test("the registry lists Tala and C++, then Tazel and Gradle, under their own headings", () => { + assert.equal(languagesHeading, "LANGUAGES"); + assert.equal(buildSystemsHeading, "BUILD SYSTEM DSL PLUGINS"); + assert.deepEqual(languageCatalogs, [ + { name: "Tala", path: "/langs/tala" }, + { name: "C++" }, + ]); + assert.deepEqual(buildSystemCatalogs, [ + { name: "Tazel", path: "/dslplugins/tazel" }, + { name: "Gradle" }, + ]); +}); + +test("every open catalog says what it holds in every language", () => { + for (const locale of locales) { + const text = catalogText(locale); + for (const catalog of [...languageCatalogs, ...buildSystemCatalogs]) { + if (catalog.path) + assert.ok( + text.holds[catalog.name]?.length > 0, + `${locale} ${catalog.name}`, + ); + } + for (const [key, value] of Object.entries(text)) { + if (typeof value === "string") + assert.ok(value.trim().length > 0, `${locale} ${key}`); + } + } + assert.notEqual( + catalogText("de-DE").talaTitle, + catalogText("en-US").talaTitle, + ); +}); + +test("a catalog that is not offered yet is a disabled button and links nowhere", () => { + const section = readFileSync( + new URL("../components/ViGetCatalogSection.tsx", import.meta.url), + "utf8", + ); + assert.match(section, /type="button"\s+disabled/); + assert.match( + section, + /href=\{`https:\/\/viget\.progmasoft\.com\$\{catalog\.path\}`\}/, + ); + const styles = readFileSync( + new URL("../app/viget.css", import.meta.url), + "utf8", + ); + assert.match(styles, /\.viget-catalog-disabled \{[^}]*cursor: not-allowed;/s); +}); + +test("the ViGet host serves both catalogs and leads the bare groups to them", () => { + const proxy = readFileSync(new URL("../proxy.ts", import.meta.url), "utf8"); + assert.match(proxy, /internalRoute\(request, "\/viget\/langs\/tala"\)/); + assert.match(proxy, /internalRoute\(request, "\/viget\/dslplugins\/tazel"\)/); + assert.match( + proxy, + /"https:\/\/viget\.progmasoft\.com\/langs\/tala"\),\s*308/, + ); + assert.match( + proxy, + /"https:\/\/viget\.progmasoft\.com\/dslplugins\/tazel"\),\s*308/, + ); + const home = readFileSync( + new URL("../app/viget/page.tsx", import.meta.url), + "utf8", + ); + const status = home.indexOf("viget-status-title"); + assert.ok( + status >= 0 && status < home.indexOf("<ViGetCatalogSection"), + "the status comes first", + ); + assert.ok( + home.indexOf("languagesHeading}") < home.indexOf("buildSystemsHeading}"), + ); +});