loading-screen icon indicating copy to clipboard operation
loading-screen copied to clipboard

feat: add tips to loading screen

Open debs-obrien opened this issue 5 years ago • 7 comments

debs-obrien avatar Aug 13 '20 17:08 debs-obrien

WORK IN PROGRESS @pimlie this is not finished yet but wanted you to take a look as it is using your package for the random tips to show. was wondering if you could take a look and tell me what you think. For now there is just a messages.json file in there with 3 random tips but this will need to be moved to a separate npm package but for now please take a look and let me know what you think. cc @pi0 @Atinux

debs-obrien avatar Aug 13 '20 17:08 debs-obrien

@debs-obrien Wow, forgot all about this stuff :)

My idea for implementing was to create a different nuxt package that lists all the tips: https://github.com/nuxt-community/motd That lib exports a createGenerator method that you feed in the config and returns a generator fn, by default it already adds module names. Then any time you run that fn another tip / motd is returned.

// lib/module.js
const createGenerator = require('@nuxtjs/motd')
const motdGenerator = createGenerator(/* ...extra config */)
const interval = setInterval(() => {
  loading.setMotd(motdGenerator())
}, 10000)

Having motd as a separate package would make it easier for the community to add tips, eg we could have some kind of scoring mechanism to also let the community vote on whether a proposed tip is good or not.

When I was looking into this I wanted the motd to cycle during loading, so that eg every 10s another tip was shown. If I remember correctly I ran into an issue with that tho, not entirely sure anymore what the issue was but the only thing I can think of is that it had probably to do with sending the motd as part of the webpack state from nuxt to the loading-screen. But again, not totally sure anymore.

pimlie avatar Aug 14 '20 07:08 pimlie

@pimlie Indeed fully agree we should move it out to nuxt/tips. Also there is a TODO in code to change the tip on each build

pi0 avatar Aug 14 '20 17:08 pi0

Comments from slack:

  • UI: Maybe we can inline docs link on same line like (docs) ?
  • UI: We need to parse string to add code block
  • CLI: it is breaking consola style with double emojis
    • It is possible to override ! icon
    • It is possible to put tip in boxen
  • CLI: we may also find a way for having short links

pi0 avatar Aug 17 '20 09:08 pi0

@pi0 adding boxen removes the styles from the code. Any ideas of how to add both? Screenshot 2020-08-17 at 15 53 09

debs-obrien avatar Aug 17 '20 13:08 debs-obrien

TODOS:

  • [ ] Transfer https://github.com/nuxt-community/motd to nuxt/tips
  • [ ] Move tips messages there
  • [ ] Use @nuxt/tips here
  • [ ] Use Nuxt boxen to add the tip there

atinux avatar Sep 07 '20 14:09 atinux

@Atinux when using boxen it removes the styling for links and highlighting - see message above for example unless there is another boxen package I don't know about

debs-obrien avatar Sep 07 '20 15:09 debs-obrien