-
Notifications
You must be signed in to change notification settings - Fork 89
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(ONYX-1479): add quick links section #6354
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Mounir Dhahri <[email protected]>
|
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.
Looks great 🌟
/* | ||
* A section type in the home view is specified declaratively | ||
* as a GraphQL object that implements the HomeViewGenericSectionInterface | ||
* | ||
* Below we will configure its various fields. | ||
*/ |
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.
🧹
/* | |
* A section type in the home view is specified declaratively | |
* as a GraphQL object that implements the HomeViewGenericSectionInterface | |
* | |
* Below we will configure its various fields. | |
*/ |
|
||
export const QuickLinks: HomeViewSection = { | ||
id: "home-view-section-quick-links", | ||
// TODO: add ContextModule quickLinks |
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.
👍
Co-authored-by: Mounir Dhahri <[email protected]>
Co-authored-by: Mounir Dhahri <[email protected]>
contextScreenOwnerId: { | ||
type: GraphQLString, | ||
description: "The owner ID for the context module", |
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.
@anandaroop @dblandin what do you think about 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.
What is this used for? The only specific value I see currently is "/collect?price_range=*-1000" which doesn't read as an ID to me.
Is this needed value need for the analytics support?
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.
yes, that's what we have in mind. We can also use the href as a payload for the tracking event. it's not clear so far.
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.
To capture the href
value, you could use destination_path
which we've included in similar events.
Co-authored-by: Mounir Dhahri <[email protected]>
Co-authored-by: Mounir Dhahri <[email protected]>
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.
Looking good!
Some high-level feedback:
I like "QuickLinks" as the name of the specific section instance but I wonder if we can abstract the section type a bit more. Maybe "NavigationPills"?
That way, we can potentially have more than one instance of this section type in the schema. For example, maybe later on we have a need for two different section instances (e.g. "ForYouQuickLinks" and "ExploreQuickLinks") and each can be backed by the same "NavigationPills" section type.
What do you think?
contextScreenOwnerId: { | ||
type: GraphQLString, | ||
description: "The owner ID for the context module", |
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.
What is this used for? The only specific value I see currently is "/collect?price_range=*-1000" which doesn't read as an ID to me.
Is this needed value need for the analytics support?
That's great feedback @dblandin thanks |
contextScreenOwnerId: { | ||
type: GraphQLString, | ||
description: "The owner ID for the context module", |
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.
yes, that's what we have in mind. We can also use the href as a payload for the tracking event. it's not clear so far.
@@ -2,25 +2,25 @@ import { ContextModule, OwnerType } from "@artsy/cohesion" | |||
import { HomeViewSection } from "." | |||
import { HomeViewSectionTypeNames } from "../sectionTypes/names" | |||
|
|||
export const QuickLinks: HomeViewSection = { | |||
export const NavigationPills: HomeViewSection = { |
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 believe that we don't need to rename this. Renaming the section type should be enough
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.
Hmmm I have the same question I'm asking here: is there a reason you want to keep different names?
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.
Cross-linking this comment: artsy/cohesion#548 (comment)
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.
Yeah, I think NavigationPills
is a good name for the section type — but for this section instance I like the idea of calling it something else like QuickLinks
. That way we decouple the section type from the specific, concrete section that uses it, as we have for the previous sections mentioned in Devon's linked comment.
This is of greater value for section types that can be re-used and I'm not sure if this one will be, but I think this is a good default for us to follow.
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.
Ah omg, I get it now, thanks everyone for explaining!
} | ||
|
||
export interface NavigationPill { | ||
contextScreenOwnerId?: 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.
action item: to delete
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.
Looking good!
I've just added some thoughts about naming and organization, similar to others' comments.
I'd be in favor of de-coupling the section type (NavigationPills
) from the specific section instance (QuickLinks
?) even if there isn't an immediately obvious opportunity for re-use of the section type.
The type:
// sectionTypes/NavigationPills.ts
export interface NavigationPill {
…
}
const NavigationPillType = new GraphQLObjectType<NavigationPill, …>({
name: "NavigationPill",
...
})
export const HomeViewNavigationPillsSectionType = new GraphQLObjectType({
name: HomeViewSectionTypeNames.HomeViewSectionNavigationPills,
description: "A selection of navigational pills in the home view",
...
})
The instance:
// sections/QuickLinks.ts
export const QuickLinks: HomeViewSection = {
id: "home-view-section-quick-links",
type: HomeViewSectionTypeNames.HomeViewSectionNavigationPills,
…
}
@@ -2,25 +2,25 @@ import { ContextModule, OwnerType } from "@artsy/cohesion" | |||
import { HomeViewSection } from "." | |||
import { HomeViewSectionTypeNames } from "../sectionTypes/names" | |||
|
|||
export const QuickLinks: HomeViewSection = { | |||
export const NavigationPills: HomeViewSection = { |
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.
Yeah, I think NavigationPills
is a good name for the section type — but for this section instance I like the idea of calling it something else like QuickLinks
. That way we decouple the section type from the specific, concrete section that uses it, as we have for the previous sections mentioned in Devon's linked comment.
This is of greater value for section types that can be re-used and I'm not sure if this one will be, but I think this is a good default for us to follow.
export const NavigationPills: HomeViewSection = { | ||
id: "home-view-section-navigation-pills", | ||
contextModule: ContextModule.quickLinks, | ||
ownerType: OwnerType.quickLinks, |
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.
question: This ownerType
optional attribute is intended for a section's view-all screen — I think that's not actually relevant or required here, right?
}, | ||
} | ||
|
||
export interface NavigationPill { |
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.
question: I wonder if it makes more sense for this interface to live over in the NavigationPill
section type and be imported here? This interface is very coupled to that section type's response shape.
Addresses ONYX-1479
Adds QuickLinks section to the list of HomeView sections