فهرست منبع

feat(ui): link the new version banner to What's new

Nacho 2 هفته پیش
والد
کامیت
e49fb3f2a6

+ 1 - 1
CHANGELOG.md

@@ -13,7 +13,7 @@ y este proyecto se adhiere a [Versionado Semántico](https://semver.org/lang/es/
 - Units that route now sweep their subnets every five minutes to find hosts that leave no neighbour entry (#2110). The agent sends a UDP datagram, which makes the kernel resolve the neighbour by ARP, so no raw sockets and nothing to install. Units polled only over SSH use `ping`. It runs only when IPv4 forwarding is on and the unit has more than one subnet of its own. `NETPULSE_PRESENCE_SCAN=on|off` forces it or turns it off. One /24 per subnet at most, 32 addresses at a time.
 - A host that only has IPv6 and has gone quiet is confirmed through the NDP table, the same way the ARP recheck works (#2109). The unit sends an echo, with `-I` when the address is link-local, and re-reads `ip -6 neigh` to confirm the address and the MAC together.
 - A Wi-Fi client with no IP is marked as such in the list (#2111). After two minutes associated without an address it also leaves one info entry in the activity log, one per MAC, never urgent, and the unknown-device counter is untouched. The association already proves the device is there. What was missing was saying so.
-- The app has a What's new page (#2116): one section per release and one card per change, each with an animation of the real interaction, in all four languages. The version stamp in the sidebar shows a dot until you open it. How to add a release: `docs/whatsnew.md`.
+- The app has a What's new page (#2116): one section per release and one card per change, each with an animation of the real interaction, in all four languages. The version stamp in the sidebar shows a dot until you open it, and a banner under the header says which version is running and links to the page, so a dot is not the only clue that something changed. How to add a release: `docs/whatsnew.md`.
 - The device icon picker is searchable and grouped in ten categories, with 60 smart-home icons and their name translated (#2107, by @Bann-DEV).
 - Optional Docker image of the server, with the UI and the agents inside, published to GHCR on every tag for amd64 and arm64 (#2101, #2105, by @sers88).
 - Per-device DNS activity from the AdGuard query log: the domains a client resolves, how often, and what was blocked, in 1 hour and 24 hour windows (#2081).

+ 5 - 0
app/public/locales/en/translation.json

@@ -3287,6 +3287,11 @@
     }
   },
   "whatsnew": {
+    "banner": {
+      "text": "You are on {{version}}. See what changed.",
+      "action": "What's new",
+      "dismiss": "Dismiss"
+    },
       "title": "What's new",
       "subtitle": "Each release, explained with the interaction it changes.",
       "helpHint": "See what changed in the version you are running.",

+ 5 - 0
app/public/locales/es/translation.json

@@ -3287,6 +3287,11 @@
     }
   },
   "whatsnew": {
+    "banner": {
+      "text": "Estás en {{version}}. Mira qué ha cambiado.",
+      "action": "Novedades",
+      "dismiss": "Descartar"
+    },
       "title": "Novedades",
       "subtitle": "Cada release, contada con la interacción que cambia.",
       "helpHint": "Mira qué cambió en la versión que estás ejecutando.",

+ 5 - 0
app/public/locales/ru/translation.json

@@ -3315,6 +3315,11 @@
     "staleNothing": "Чистить нечего"
   },
   "whatsnew": {
+    "banner": {
+      "text": "У вас {{version}}. Посмотрите, что изменилось.",
+      "action": "Что нового",
+      "dismiss": "Скрыть"
+    },
       "title": "Что нового",
       "subtitle": "Каждый выпуск, показанный через то взаимодействие, которое он меняет.",
       "helpHint": "Посмотрите, что изменилось в версии, которая у вас работает.",

+ 5 - 0
app/public/locales/zh/translation.json

@@ -3262,6 +3262,11 @@
     }
   },
   "whatsnew": {
+    "banner": {
+      "text": "你正在使用 {{version}}。看看有什么变化。",
+      "action": "新功能",
+      "dismiss": "关闭"
+    },
       "title": "新功能",
       "subtitle": "每个版本用它所改变的那次交互来说明。",
       "helpHint": "看看你正在运行的版本改了什么。",

+ 2 - 0
app/src/components/Layout.tsx

@@ -32,6 +32,7 @@ import InstallPrompt from '@/components/InstallPrompt'
 import { ThemeToggle } from '@/components/ThemeToggle'
 import { UpdateBanner } from '@/components/UpdateBanner'
 import { AnnouncementBanner } from '@/components/AnnouncementBanner'
+import { WhatsNewBanner } from '@/components/WhatsNewBanner'
 import { UpdateConfirmToast } from '@/components/UpdateConfirmToast'
 import { useIsMobile } from '@/hooks/use-mobile'
 import { useServerVersion } from '@/hooks/useServerVersion'
@@ -718,6 +719,7 @@ function Shell() {
         <main className="[view-transition-name:netpulse-content] mx-auto w-full max-w-[1400px] px-4 pb-tabbar pt-4 md:px-6 md:pb-10 md:pt-6">
           {isDemo && <DemoBanner />}
           <AnnouncementBanner />
+          <WhatsNewBanner />
           <UpdateBanner />
           {/* Confirmación post-update (issue #161): toast al cargar si el
               último apply llegó a arrancar con el commit nuevo. */}

+ 47 - 0
app/src/components/WhatsNewBanner.tsx

@@ -0,0 +1,47 @@
+import { Link, useLocation } from 'react-router'
+import { useTranslation } from 'react-i18next'
+import { Sparkles, X } from 'lucide-react'
+import { useServerVersion } from '@/hooks/useServerVersion'
+import { useWhatsNewBadge } from '@/whatsnew/useWhatsNewSeen'
+
+/**
+ * WhatsNewBanner — el aviso de versión nueva (#2116) con enlace a Novedades.
+ *
+ * Aparece cuando la versión que corre el servidor no es la que este navegador
+ * ha abierto nunca, así que también sirve de "acabas de actualizar". El punto
+ * del sello del sidebar sigue ahí, pero un punto se pierde: esto lo dice con
+ * palabras y lleva a la página.
+ */
+export function WhatsNewBanner() {
+  const { t } = useTranslation()
+  const location = useLocation()
+  const version = useServerVersion()
+  const { unseen, markSeen } = useWhatsNewBadge(version)
+
+  // En la propia página no pinta nada: se marca vista al montarla.
+  if (!unseen || location.pathname === '/whatsnew') return null
+
+  return (
+    <div className="mb-4 flex items-center gap-3 rounded-xl border border-accent/30 bg-accent-soft px-4 py-3">
+      <Sparkles className="h-4 w-4 shrink-0 text-accent" strokeWidth={1.75} aria-hidden="true" />
+      <p className="min-w-0 flex-1 text-caption text-text-primary">
+        {t('whatsnew.banner.text', { version })}
+      </p>
+      <Link
+        to="/whatsnew"
+        className="shrink-0 rounded-lg border border-accent/40 bg-surface px-3 py-1.5 text-caption font-semibold text-accent transition-colors hover:border-accent"
+      >
+        {t('whatsnew.banner.action')}
+      </Link>
+      <button
+        type="button"
+        onClick={markSeen}
+        aria-label={t('whatsnew.banner.dismiss')}
+        title={t('whatsnew.banner.dismiss')}
+        className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-text-secondary transition-colors hover:bg-hover hover:text-text-primary"
+      >
+        <X className="h-4 w-4" strokeWidth={2} />
+      </button>
+    </div>
+  )
+}