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: fable test app homepage #39

Merged
merged 5 commits into from
Sep 17, 2024
Merged

Conversation

ethanWallace
Copy link
Contributor

Summary | Résumé

Create homepage for the fable test app (holidays app) based on figma prototype.

Copy link
Collaborator

@daine daine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really cool! I love seeing the Next Holiday on the home page. I just have a few questions around that specific component

Comment on lines 14 to 15
"@cdssnc/gcds-components": "^0.26.0",
"@cdssnc/gcds-components-react": "^0.26.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use another version bump 😜

isCurrentHoliday? : boolean;
nextHoliday: {
date: string;
nameEn: string;
} | null;
federal?: boolean;
observedIn?: Provinces[];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this one better for clarity, what do you think?

Suggested change
observedIn?: Provinces[];
provincesObservedIn?: Provinces[];

@@ -23,6 +29,27 @@ const NextHoliday: React.FC<NextHolidayProps> = ({
return Math.floor((holidayDate.getTime() - today.getTime()) / (1000 * 3600 * 24));
};

// Get long version of date
const nextHolidayDate = (dateString: string) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see potential for this to be generalized, especially seeing the function call is nextHolidayDate(holidayDate) when it only returns formatting. Can we change it?

Suggested change
const nextHolidayDate = (dateString: string) => {
const formatDate = (dateString: string) => {

data.holidays.map((holiday: holidayObject) => {
if (holiday.federal === 1) {
const holidayDate = new Date (holiday.date).getTime();
if (holidayDate > currentDate && !fedAssigned) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small suggestion to do the boolean check first so it doesn't have to do the second check if it's already been assigned

Suggested change
if (holidayDate > currentDate && !fedAssigned) {
if (!fedAssigned && holidayDate > currentDate) {

let nationwideAssigned = false;
data.holidays.map((holiday: holidayObject) => {
const holidayDate = new Date (holiday.date).getTime();
if (holidayDate > currentDate && !nationwideAssigned) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above :)

};

// Create formatted list of <abbr> elements for provinces
const formatObservedIn = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const formatObservedIn = () => {
const getObservedInProvinces = () => {

or something similar; format* typically means you pass it something it'll change but this one just simply returns a block of html

fable-test-app/src/pages/Home.tsx Show resolved Hide resolved
Copy link
Collaborator

@daine daine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ethanWallace ethanWallace merged commit e659f4b into main Sep 17, 2024
2 checks passed
@ethanWallace ethanWallace deleted the feat/fable-test-app-homepage branch September 17, 2024 17:39
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.

2 participants