Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert mechanism #372

Closed
coke opened this issue May 7, 2024 · 10 comments
Closed

Alert mechanism #372

coke opened this issue May 7, 2024 · 10 comments
Labels
enhancement New feature or request

Comments

@coke
Copy link
Contributor

coke commented May 7, 2024

It would be nice to have an alert popup available on the docs site for things like:

  • Hey, we added an ebook
  • Updated docs to include 2024.04 release
  • 6.e dropped!

etc. Be nice if

  • We could support at least one message at a time. We do NOT need to support multiples but it if it's easy...
  • Once a user has hidden a message it goes away.
  • We don't need an archive of messages.
  • OK if we need to do a deploy to get a new message (don't need a way for admins to create it dynamically through the site)
@coke coke added the enhancement New feature or request label May 7, 2024
@finanalyst
Copy link
Collaborator

finanalyst commented May 7, 2024 via email

@patrickbkr
Copy link
Member

I like the idea.

What about accumulated messages?

I say lets display only the last message. If we want to make sure people have a chance to see older ones, we could have an "Announcements" page where the full history can be seen.

@finanalyst
Copy link
Collaborator

@coke @patrickbkr
An announcements page is a good idea. So here's a suggested design:

  • we create a Rakudoc page for announcements, and we have it included in the Introduction section, so it is available as a normal page (this is trivial)
  • the format of the page would need to be strict to make parsing easier, perhaps:
    • =item B<date in yyyy-mm-dd>Announcement
    • choiice of format so no one confuses month and day (as European and US forms are inverted)
    • also easier sorting
  • we add a local storage object,
    • contains the date of the last announcement shown to a user
    • a boolean for suppressing popups
  • we add a function to the main js that has a DocumentLoaded listener
    • The js function contains the last announcement's HTML
    • The js is generated at Build time, so the announcement page has been rendered and the HTML is available.
    • the function gets the local storage object, checks the date of the last announcement,
    • checks if the popup is allowed
    • pops the announcement if the last two are true.
    • stores the date of the announcement in the local storage.
    • so, when popup is dismissed, it will not appear again until a new announcement is added.
  • we add a button to the More dropdown that cancels/allows the popup.

So, all that is needed for the moderator is to change the Announcements page by adding an item to the top of the page.

Just some UX questions

  • Bulma (the CSS framework used here) has a modal window, which we used. Examples can be found here
  • the Bulma variant is the easiest is implement, and Bulma will ensure it is responsive and trans-browser. But it seems a bit too intrusive for my preferences.
  • there is a js alert function, but I do not know how this is consistent across browsers/OS
  • we could add a div to the navigation bar with a cancel button (this would be time consuming to get right)

@patrickbkr
Copy link
Member

Sounds good.

@coke
Copy link
Contributor Author

coke commented May 10, 2024

The bulma model is going to be a better experience than alert(), IME.

finanalyst added a commit that referenced this issue May 12, 2024
- announcements.rakudoc is the source for the anouncement page and is contained in 'structure-sources' for this PR
- When the website is opened an announcement modal pops-up
- Once dismissed, it never appears again for that announcement
- Adding a `Note` to the ***top*** of the announcements page changes the id of the last pop-up and so the new announcement will be popped when next the website is opened by a user
- announcements can be suppressed by toggle in the ABOUT dropdown.
- the SCSS is preliminary for both the pop-up and the page.

Changes to
- raku-styling to allow for popup HTML and More dropdown
- config/02-plugins to enable announcements
- added announcements plugin
- added test announcements.rakudoc file
@finanalyst
Copy link
Collaborator

@coke @dontlaugh @lizmat A PRs to address this issue. It will be in the docs-dev branch, so the results will be visible on https://docs-dev.raku.org.

An issue to be resolved if the PR meets the requirements of the ask is where to put the 'announcements.rakudoc' page.
For the PR, it is located in Website/structure-sources and so is local to this repo.
However, this has the disadvantage that it will not be included in the Introduction page (tab). [This is a limitation of Collection's design, which I plan to remove once I start working on the replacement of Collection after RakuAST-RakuDoc is complete]
Since Announcements is not listed, it cant be found onsite (of course we could include a link to it in eg About)

My preference would be to have announcements.rakudoc as a file in the Raku/docs repository immediately inside doc/.

@finanalyst
Copy link
Collaborator

@coke a small announcements.rakudoc file needs to be created. Is the test file OK?

@finanalyst
Copy link
Collaborator

@coke @dontlaugh @lizmat @patrickbkr PR now working on docs-dev deployment eg introduction.
First time site opens, you get latest message. Then refresh page, and the modal pane will not fire!
If you want to see all announcements (assuming you dont click on the link in the modal pane), this is the url.
Suppress toggle is at navigation_bar->More->announcements
If you want to test with fresh window, then on Firefox (I dont know the sequence for other browsers), goto developers window/tab (on Ubuntu its F12), then 'storage', then 'local storage', then the element labeled 'docs-dev.raku.org', then delete the item labelled 'announcementState'.
See posts above about outstanding issues.

finanalyst added a commit that referenced this issue May 12, 2024
* addresses issue #372 by adding announcement popup & page
- announcements.rakudoc is the source for the anouncement page and is contained in 'structure-sources' for this PR
- When the website is opened an announcement modal pops-up
- Once dismissed, it never appears again for that announcement
- Adding a `Note` to the ***top*** of the announcements page changes the id of the last pop-up and so the new announcement will be popped when next the website is opened by a user
- announcements can be suppressed by toggle in the ABOUT dropdown.
- the SCSS is preliminary for both the pop-up and the page.

Changes to
- raku-styling to allow for popup HTML and More dropdown
- config/02-plugins to enable announcements
- added announcements plugin
- added test announcements.rakudoc file

* fix error when no announcement page is available

* remove announcement.rakudoc from website repo
- add to Raku/docs
@finanalyst
Copy link
Collaborator

PR merged to main without an announcements.rakudoc page. I'll raise a PR on Raku/doc with a short source. Once that is merged into main, the announcements plugin will serve the topmost announcement after the next build here (about 2 hours later).

@finanalyst
Copy link
Collaborator

closing as completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants