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

chore: Migrate widgets that are still using format_structure (ALPHA-4191) #159

Merged
merged 8 commits into from
Dec 7, 2023

Conversation

v-almonacid
Copy link
Contributor

@v-almonacid v-almonacid commented Nov 30, 2023

This concerns the following widgets:

  • MapContainer
  • VenueMapContainer
  • AgendaContainer
  • RoadmapContainer
  • CalendarContainer
  • FaqContainer
  • CountdownContainer
  • MediaContainer

https://github.com/AlphadayHQ/backend/pull/740 takes care of the data layer.

- rename NoItems component by CenteredBlock
- Use CenteredBlock to display 'no results' instead of an inifinite spinner when data is missing or invalid
@v-almonacid v-almonacid changed the title chore: Migrate faq widget chore: Migrate widgets that are still using format_structure (ALPHA-4191) Dec 1, 2023
@v-almonacid v-almonacid marked this pull request as ready for review December 1, 2023 22:41
@@ -1,25 +1,26 @@
export * from "./agenda";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just reorder and added agenda

@@ -174,5 +175,11 @@ export const customDatumAsItem: (datum: TRemoteCustomDatum) => TItem = (d) => {
}, {} as TItem);
};

export const customDataAsItems: (data: TRemoteCustomData) => TItem[] = (d) =>
d.map(customDatumAsItem);
export const customDataAsItems: (data: TRemoteCustomData) => TItem[] = (d) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this needs a proper fix in the validation functions

@v-almonacid v-almonacid marked this pull request as draft December 1, 2023 22:57
@v-almonacid v-almonacid marked this pull request as ready for review December 1, 2023 22:57
Copy link
Contributor

@Xavier-Charles Xavier-Charles left a comment

Choose a reason for hiding this comment

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

This works, I just mentioned one small issue

try {
return d.map(customDatumAsItem);
} catch (error) {
Logger.error("customDataAsItems: unexpected error", error);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's say this fails I think it will be helpful to know which container this error comes from.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right but I don't want to add code that will need to be cleaned up later on. This should never fail (that would mean we could not trust the expected type of the function input) so I'm actually removing the try-catch.

@v-almonacid v-almonacid marked this pull request as draft December 4, 2023 21:25
@v-almonacid v-almonacid marked this pull request as ready for review December 4, 2023 21:25
@v-almonacid v-almonacid merged commit 7687a35 into dev Dec 7, 2023
1 check passed
@v-almonacid v-almonacid deleted the ALPHA-4192-migrate-faq-widget branch December 7, 2023 14: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