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

feat(core): Studio announcements #7515

Merged
merged 24 commits into from
Sep 24, 2024
Merged

feat(core): Studio announcements #7515

merged 24 commits into from
Sep 24, 2024

Conversation

pedrobonamin
Copy link
Contributor

@pedrobonamin pedrobonamin commented Sep 16, 2024

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 key studio.announcement.seen which will return the list of the ids of the seen announcements.
  • The existing announcements will be checked against the seen ones, if at least one announcement is unseen the floating card will show to the user.
  • Clicking the floating card opens a dialog with the announcement, closing the dialog marks the announcement as seen
  • Dismissing the card, marks the announcement as seen.
  • Next time the user opens the studio, the seen announcement will be returned by the key value store so he will only see each announcement once.
studio.announcements.-.floating.card.mov

Note

All announcements returned by /announcements are stored in the studioAnnouncements state in the StudioAnnouncementsContext 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 id foo, 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"]
  • A new announcement is added, /announcements API returns now 2 documents with id foo and bar, user has seen foo so he will see the floating card for announcement bar. When closing the dialog or dismissing the card, we will save to the key value store the two ids. ["foo", "bar"]
  • A new announcement is added and foo is removed. Now the api returns bar and baz, user sees baz , we will update the key value store to ["bar", "baz"], given foo 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:

  • GRO-2497
  • GRO-2494
  • GRO-2493
  • GRO-2499
  • GRO-2495
  • GRO-2496
  • GRO-2498

Copy link

vercel bot commented Sep 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 23, 2024 5:17pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 23, 2024 5:17pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 23, 2024 5:17pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 23, 2024 5:17pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 23, 2024 5:17pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Sep 23, 2024 5:17pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Sep 16, 2024

Component Testing Report Updated Sep 23, 2024 5:19 PM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 44s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 30s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 36s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 17s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 44s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 50s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 17s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 26s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 34s 12 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

@pedrobonamin pedrobonamin added this pull request to the merge queue Sep 24, 2024
Merged via the queue into next with commit 3593bf5 Sep 24, 2024
42 checks passed
@pedrobonamin pedrobonamin deleted the studio-announcements branch September 24, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants