-
Notifications
You must be signed in to change notification settings - Fork 9
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/announcement block #1497
Feat/announcement block #1497
Conversation
@@ -803,13 +915,6 @@ const validateDayOfMonth = (month, day) => { | |||
} | |||
} | |||
|
|||
const validateNonFutureDate = (dateStr) => { |
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.
Note: this is not removed, but shifted up + renamed to group similar functions tgt
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.
Not a complete review yet, left EditHomepage.jsx but have some concerns regarding frontmatter
{ | ||
title: announcementTitle, | ||
date: announcementDate, | ||
announcement: announcementContent, | ||
link_text: announcementLinkText, | ||
link_url: announcementLinkUrl, | ||
}, |
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.
Not a functional comment but just wondering if it would be better to just have announcement
object here, then call things like announcement.title
below.
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.
hey i rather destructure at the top bah.
i didnt want to do announcement.announcement for clarity
7601bf0
to
94e3af7
Compare
dc75957
to
9c9b398
Compare
id={`announcements-${announcementIndex}-date`} | ||
inputValue={announcementDate} | ||
onInputValueChange={(value) => { | ||
onChange({ |
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.
feels like i shuold've wrapped the onChange
._.
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.
skimmed - seems to be ok
{moment(announcement.date, "DD/MM/YYYY").format( | ||
"DD MMMM YYYY" | ||
)} |
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.
noted that this will reconcile the diff in view but it still feels weird to have it here (as a view level thing) rather than just doing it at the data level. this offloads responsibility to the dev next time to know this @__@
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.
@@ -218,6 +240,57 @@ const validateHighlights = (highlightError, field, value) => { | |||
return newHighlightError | |||
} | |||
|
|||
const validateAnnouncementItems = (announcementError, field, value) => { |
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.
could we separate out the validation from the set? this makes it easier to reuse in the future, which was 1 blocker i faced when trying to use the existing validators
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.
validation from the set? May I get your help to expand more on this/direct me to the part of the codebase that uses the pattern you are trying to explain?
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.
abit unclear wording on my end, but validateAnnouncementItems
sets the corresponding index. in this case, it does not simply validate (ie, return bool + msg) but also does a side effect (setting the corresponding index). this isn't particularly important to fix now because it follows the existing style of code but when we want to do simple validation that is unaware of the structure of the error, will be an issue
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.
hmm ok, am inclined to keep it as is for consistency with the rest of the local code, will modify if future pain points warrant it?
667c783
to
01e35b9
Compare
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.
mostly sanity checks
let { | ||
content: { frontMatter }, | ||
sha, | ||
} = homepageData | ||
const { sha } = homepageData |
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: this change appears to have different semantics; content
now appears to be writable now whereas previously it was only readable
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.
Hey yes this is the case. There was a bug when the key was undefined, but its still valid frontmatter state. As such, I just refine an empty array so that our FE does not throw any error.
c60139a
to
612aba0
Compare
@seaerchin ps need to your look at small additional commit (the others shd be trivial) |
Problem
Announcement block editing in homepage according to figma.
Solution
In the interest of consistency, similar approach to key_highlights in the hero banner.
Breaking Changes
Screen.Recording.2023-09-15.at.7.10.16.PM.mov
Tests
1. The annoucemnet item
2. The entire announcement block
Known limitations
displayAnnouncements
for this but somehow it is not working as intended. Filing a ticket here.)AnnouncementBody.tsx
. Since we are rendering components over a map, each element would require a unique key. However, when I did do it the re-renders were visible + triggered an off-focus 😱. Have anyone solved this problem before?.
This key was removed in 1556850
Blockers
I think it is difficult for design to iterate give a green check here since we don't have storybook. I tried (a timeboxed) attempt it b5b41cc but the paddings and all were off so this attempt does not yield the benefits that I was hoping for. Since this to be shipped soon, for now Ill document the flows in video form to get Design's [@sehyunidaaa] approval first.
Note to reviewers
This PR is too bulky for my taste, I am seeking feedback on how I could have split this PR up (or if this PR size is actually ok).