-
Notifications
You must be signed in to change notification settings - Fork 429
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
feat(core): Studio announcements #7515
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
No changes to documentation |
Component Testing Report Updated Sep 23, 2024 5:19 PM (UTC) ✅ All Tests Passed -- expand for details
|
pedrobonamin
force-pushed
the
studio-announcements
branch
from
September 17, 2024 09:41
8eecf04
to
bf315aa
Compare
pedrobonamin
force-pushed
the
studio-announcements
branch
from
September 17, 2024 12:38
e34d31c
to
4d9378f
Compare
pedrobonamin
force-pushed
the
studio-announcements
branch
from
September 23, 2024 17:04
b3c9a12
to
8d265b1
Compare
juice49
approved these changes
Sep 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new floating card and dialog for Studio announcements
This is mandated, by our internal admin studio in which you can define a a new
productAnnouncement
document to push an announcement into the studios.It also exports this new components for them to be consumed in the product announcement studio previews.
How does it works?
We go into the admin studio and create a new
productAnnouncement
document and publish it.This document will be fetched by the new
/announcements
api and returned to the studio.When a new visitor opens the studio, we will fetch data from two places:
/announcements
will return the existing announcements, the user could have seen or not. The announcements have a "expiryDate" so this list should be fairly small.keyValueStore
with the keystudio.announcement.seen
which will return the list of the ids of the seen announcements.studio.announcements.-.floating.card.mov
Note
All announcements returned by
/announcements
are stored in thestudioAnnouncements
state in theStudioAnnouncementsContext
so the users will be able to click in the Whats new menu item in resources to see all the previous announcements.studio.announcements.-.resources.menu.mov
Announcements could contain an expiry date, so we don't expect the
/announcements
api to return a big number of announcements.How do we keep the key value store data small?
Given announcements will contain an expiry date, we should not receive a big number of announcements from the
/announcements
API.We are only going to store as seen the announcements that are returned from the API, we are not keeping the history of all the seen announcements the user has.
Scenario:
/announcements
API returns 1 document with idfoo
, user sees that announcement, we will save to the key value store the id of that seen announcement. That user will have saved the value["foo"]
/announcements
API returns now 2 documents with idfoo
andbar
, user has seenfoo
so he will see the floating card for announcementbar
. When closing the dialog or dismissing the card, we will save to the key value store the two ids.["foo", "bar"]
foo
is removed. Now the api returnsbar
andbaz
, user seesbaz
, we will update the key value store to["bar", "baz"]
, givenfoo
is not returned anymore we don't need to know if the user has seen it or not.See tests for this behavior
A reset announcements query param can be provided to reset the seen announcements state.
/structure?reset-announcements=foo,bar
What to review
Are the changes correct?
Is it possible to do this in other ways?
Testing
Tests covering the new scenarios have been added
Browser testing is possible by visiting https://test-studio-git-studio-announcements.sanity.dev/staging, you should be prompted with the new card first time visiting. (Remember to use
?reset-announcements
to see the flow again)Notes for release
Adds studio announcements to the studio
It implements: