-
Notifications
You must be signed in to change notification settings - Fork 26
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
[VO-710] feat: Show announcements #2177
Conversation
BundleMonFiles updated (7)
Unchanged files (6)
Total files change +3.36KB +0.1% Final result: ✅ View report in BundleMon website ➡️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one question about the fetchJSON call. Everything else is Nit.
All the logic seems good, nice work 👍
|
||
const saveAnnouncement = (data: { | ||
dismissedAt?: string | ||
seen?: string[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seen
is optional here but not in the save
declared in line 25. Is that expected?
import { AnnouncementsConfig } from 'components/Announcements/types' | ||
import flag from 'cozy-flags' | ||
|
||
const useAnnouncementsUploads = (url: string | undefined): string | null => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: My understanding is that upload
is a name relative to announcements but does not means that we are uploading anything here? Would be nice to have some nomenclature to explain this somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not uploading anything we only get images from the announcements server which are located inside the uploads route. To avoid misunderstanding I added some documentation and also renamed the hook to useAnnoncementsImage
const fetchBinary = (await client?.stackClient.fetch( | ||
'GET', | ||
`/remote/${config.remoteDoctype}.uploads?url=${urlWithoutPrefix}` | ||
)) as Response | ||
const blob = await fetchBinary.blob() | ||
setImage(URL.createObjectURL(blob)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why we need to fetch the image in JS side instead of giving the URL to the <img>
element?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I follow a similar process as for the wallpaper (code) because I had a problem with authentification and CSP
3d5c833
to
8774b57
Compare
This PR allow to displays a modal with the latest announcement from the cozy ecosystem
Related PRs :
Preview :