nuxt / nuxt.com

The Nuxt website, made with Nuxt.
https://nuxt.com
MIT License
282 stars 138 forks source link

feat: add current Nuxt version to header #1553

Closed IsraelOrtuno closed 4 months ago

IsraelOrtuno commented 4 months ago

This little PR adds the current Nuxt version right to the header. I find this really useful as docs are visited very often by devs of any level and this is really useful to discover patch releases.

Despite I have tried to design it as soft as possible (but readable) I am aware this may be a little bit intrusive. Open to any feedback from the design team and maybe put it in a tooltip (show only on hover) or maybe somewhere else (docs sidebar sounds right too).

It also exposes a /api/release.json endpoint which returns the latest version and maybe some other useful meta information in the future.

Screenshot 2024-04-08 at 19 46 48 Screenshot 2024-04-08 at 19 46 53
atinux commented 4 months ago

Not sure if I want to have it in the header though 🤔

What do you think @benjamincanac ?

benjamincanac commented 4 months ago

I'm not sure either where to put this but maybe we could use a badge to display it? Like https://ui.nuxt.com/dev/getting-started

atinux commented 4 months ago

Badge like Nuxt UI could be nice.

I would also avoid having the patch version (ex: v3.11)

IsraelOrtuno commented 4 months ago

Badge like Nuxt UI could be nice.

I would also avoid having the patch version (ex: v3.11)

We could add the patch version on a tooltip on hover. Will update the PR with the badge soon.

IsraelOrtuno commented 4 months ago

Way cleaner with badge and tooltip:

Screenshot 2024-04-16 at 11 40 21 Screenshot 2024-04-16 at 11 40 24 Screenshot 2024-04-16 at 11 40 28
atinux commented 4 months ago

Thanks @IsraelOrtuno !

I updated the Nuxt API to return the version: https://api.nuxt.com/stats

This way we can directly use useStats().

I simplified your code and merging now!

IsraelOrtuno commented 4 months ago

Didn't know about useStats composable, way cleaner!