/TagFront - Tag fronts on DCR! - #7752
Conversation
| getArticleSchema, | ||
| getFrontSchema, | ||
| getNewsletterPageSchema, | ||
| getIndexPageSchema, |
There was a problem hiding this comment.
being pedantic here but index is quite an overloaded term, maybe we could go with tagPage instead? I think this is what we call them in the business no?
There was a problem hiding this comment.
actually, probably better to call it a TagFront, which it is, then we'd also avoid the TagPagePage business
There was a problem hiding this comment.
Your definitely right, in the spirit of hacking speed I'm going to keep going, but will be refactoring & tidying all this code on Friday
Update FrontPagination.tsx
|
Size Change: -10.4 kB (-2%) Total Size: 571 kB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Impressive!
Grouping with JS Map is very powerful and may simplify some of your grouping logic
EDIT: There’s an upcoming Array.prototype.group feature that will make grouping easier!
| return fallback; | ||
| }; | ||
|
|
||
| export const Sources = ({ sources }: { sources: ImageSource[] }) => { |
There was a problem hiding this comment.
Not in the scope of this PR, but we could really do with a "generic" picture element 😅
There was a problem hiding this comment.
I was definitely thinking of this, I think it should be pretty easy to put together!
| children: Array.from(node.childNodes).map(buildElementTree), | ||
| }); | ||
| default: | ||
| return jsx(node.tagName.toLowerCase(), { |
There was a problem hiding this comment.
In order to use this we want to be pretty sure that we won't receive a tag that doesn't accept children. I.e none of these elements https://developer.mozilla.org/en-US/docs/Glossary/Void_element Otherwise this will break the page. So it could be safer to handle tags explicitly and return null if an unexpected tag is received.
There was a problem hiding this comment.
Thanks - I'm pretty sure we wont see any of these other elements, but I'll take a look at raising another PR in the future to refactor all this code to be more heavily re-used & avoid any potential errors like this!
| // If there is a gap of more than 1 number between this entry and the last one | ||
| const shouldPrefixDots = | ||
| page > 1 && pageRange[index - 1] !== page - 1; |
There was a problem hiding this comment.
Not sure if this is helpful in this case, but distance between two numbers can also be obtained by calculating the absolute value of the difference between them: Math.abs(page - pageRange[index - 1]) > 1
There was a problem hiding this comment.
In this case I don't think it does make a difference, but definitely helpful to know!
| trailsByDay.map(({ day, trails: dayTrails }) => ({ | ||
| day, | ||
| trails: dayTrails, | ||
| })), |
There was a problem hiding this comment.
I think this map does nothing 😉


Adds support for tag fronts in DCR!
Completed features in this PR
groupTrailsByDates.ts- Logic for grouping trailsTagFrontLayout.tsx- Full working layout for tag frontsFrontPagination.tsx- Pagination logic that allows users to navigate between pages on tag frontsTagFrontHeader.tsx- Header for tag fronts which can include a title, description & image if they're provided for the tagFuture work required
Screenshots
tone/minutebyminute

profile/josh-haliday
