Просмотр исходного кода

feat(whatsnew): link the website changelog

gnacho 1 неделя назад
Родитель
Сommit
c23b2f291b
3 измененных файлов с 20 добавлено и 14 удалено
  1. 12 7
      app/src/pages/WhatsNew.tsx
  2. 1 1
      docs/releases/2.54.0.md
  3. 7 6
      docs/releases/README.md

+ 12 - 7
app/src/pages/WhatsNew.tsx

@@ -20,12 +20,17 @@ import { markWhatsNewSeen } from '@/whatsnew/useWhatsNewSeen'
 const OWN_AUTHOR = 'gnacho'
 
 /**
- * Changelog completo de la app. Hoy vive en el repositorio, y cuando la web
- * tenga su página de cambios multilingüe este es el ÚNICO sitio que cambia:
- * pasará a una función de `i18n.language` que devuelva la ruta del idioma en
- * netpulse.cloudless.club (es en la raíz, el resto en /<lang>/changelog/).
+ * Changelog completo, en la web. La página existe en los idiomas de la app
+ * (español en la raíz, el resto en /<lang>/changelog/) y el resto de idiomas
+ * cae al inglés, que es el idioma en que se escriben las notas.
  */
-const CHANGELOG_URL = 'https://github.com/gnacho/netpulse/blob/main/CHANGELOG.md'
+const CHANGELOG_LANGS = ['es', 'en', 'zh', 'ru']
+function changelogUrl(lang: string): string {
+  const base = String(lang ?? 'en').split('-')[0]?.toLowerCase() ?? 'en'
+  if (base === 'es') return 'https://netpulse.cloudless.club/changelog'
+  if (CHANGELOG_LANGS.includes(base)) return `https://netpulse.cloudless.club/${base}/changelog/`
+  return 'https://netpulse.cloudless.club/en/changelog/'
+}
 
 function Card({ card }: { card: WhatsNewCard }) {
   const { t } = useTranslation()
@@ -71,7 +76,7 @@ function Card({ card }: { card: WhatsNewCard }) {
 }
 
 export function WhatsNew() {
-  const { t } = useTranslation()
+  const { t, i18n } = useTranslation()
   const version = useServerVersion()
 
   useEffect(() => {
@@ -105,7 +110,7 @@ export function WhatsNew() {
       <p className="pt-2 text-[11px] text-text-muted">{t('whatsnew.footnote')}</p>
       {/* Todavía en GitHub: la web tendrá su propia página de cambios. */}
       <a
-        href={CHANGELOG_URL}
+        href={changelogUrl(i18n.language)}
         target="_blank"
         rel="noreferrer"
         className="inline-flex items-center gap-1 text-caption font-medium text-accent transition-colors hover:text-accent/80"

+ 1 - 1
docs/releases/2.54.0.md

@@ -63,4 +63,4 @@ The whole interface in Chinese and in Russian, catalogs complete and reviewed. D
 - **@fsolak47** for the presence reports in #2063 that put the stale neighbour recheck on the map.
 - **@Korenchkin** for #2114, which caught the Docker instructions before anyone else did.
 
-Every change, including the ones without a card, is in the [changelog](https://github.com/gnacho/netpulse/blob/main/CHANGELOG.md).
+Every change, including the ones without a card, is in the [changelog](https://netpulse.cloudless.club/changelog).

+ 7 - 6
docs/releases/README.md

@@ -94,12 +94,13 @@ twice", the notes say what the operator was seeing.
 
 ## Where the changelog link goes
 
-The notes and the What's new page end with a link to the complete changelog.
-Today it points at `CHANGELOG.md` in the repository. When the site has its own
-changelog page, translated like the rest of `netpulse.cloudless.club`, only the
-href changes: in the app it is `CHANGELOG_URL` in `app/src/pages/WhatsNew.tsx`,
-and this file says where that should point (Spanish at the root, the other
-languages under `/<lang>/changelog/`).
+The notes and the What's new page end with a link to the complete changelog,
+which lives at `netpulse.cloudless.club/changelog` (Spanish at the root, the
+other app languages under `/<lang>/changelog/`, everything else falls back to
+English). The page is generated from this directory by
+`web/build-changelog.mjs`, so adding a release file and running that script is
+all it takes. In the app the URL is built by `changelogUrl()` in
+`app/src/pages/WhatsNew.tsx`.
 
 ## Checklist