Skip to content

Port EventList to React#5727

Open
gettinToasty wants to merge 5 commits intomasterfrom
sb_port_event_list
Open

Port EventList to React#5727
gettinToasty wants to merge 5 commits intomasterfrom
sb_port_event_list

Conversation

@gettinToasty
Copy link
Contributor

No description provided.

// EventList: {
//
// },
[WidgetType.EventList]: {
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand the old code correctly, EventListService is dead code after this change and can be removed as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep! good catch forgot to do that

},

url: `https://${host}/widgets/event-list/v1/${token}`,
previewUrl: `https://${host}/widgets/event-list/v1/${token}?simulate=1`,
Copy link
Contributor

Choose a reason for hiding this comment

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

This will have a merge conflict with #5734, and will need to add the webSettingsUrl property from event-list.ts:

Suggested change
previewUrl: `https://${host}/widgets/event-list/v1/${token}?simulate=1`,
previewUrl: `https://${host}/widgets/event-list/v1/${token}?simulate=1`,
webSettingsUrl: `https://${host}/dashboard#/widgets/event-list`,

Whichever one merges last can include the change.

Comment on lines +98 to +136
get eventsByPlatform() {
const platform = this.UserService.views.platform?.type;
const baseEvents = {
show_donations: metadata.bool({ label: $t('Donations') }),
show_merch: metadata.bool({ label: $t('Merch') }),
};
const platformEvents: PartialRec<TPlatform, any> = {
twitch: {
show_follows: metadata.bool({ label: $t('Follows') }),
show_subscriptions: metadata.bool({ label: $t('Subscriptions') }),
show_resubs: metadata.bool({ label: $t('Show Resubs') }),
show_sub_tiers: metadata.bool({ label: $t('Show Sub Tiers') }),
show_bits: metadata.bool({ label: $t('Bits') }),
show_raids: metadata.bool({ label: $t('Raids') }),
},
facebook: {
show_follows: metadata.bool({ label: $t('Follows') }),
show_stars: metadata.bool({ label: $t('Stars') }),
show_supports: metadata.bool({ label: $t('Supporters') }),
show_likes: metadata.bool({ label: $t('Likes') }),
show_shares: metadata.bool({ label: $t('Shares') }),
},
youtube: {
show_subscribers: metadata.bool({ label: $t('Subscriptions') }),
show_sponsors: metadata.bool({ label: $t('Members') }),
show_fanfundings: metadata.bool({ label: $t('Super Chats') }),
},
trovo: {
show_follows: metadata.bool({ label: $t('Follows') }),
show_raids: metadata.bool({ label: $t('Raids') }),
show_subscriptions: metadata.bool({ label: $t('Subscriptions') }),
show_resubs: metadata.bool({ label: $t('Show Resubs') }),
show_sub_gifts: metadata.bool({ label: $t('Show Gift Subs') }),
show_sub_tiers: metadata.bool({ label: $t('Show Sub Tiers') }),
},
};
if (!platform) return baseEvents;
return { ...platformEvents[platform], ...baseEvents };
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Moving this from a map to a switch saves loading all the loc strings for the unused platforms:

Suggested change
get eventsByPlatform() {
const platform = this.UserService.views.platform?.type;
const baseEvents = {
show_donations: metadata.bool({ label: $t('Donations') }),
show_merch: metadata.bool({ label: $t('Merch') }),
};
const platformEvents: PartialRec<TPlatform, any> = {
twitch: {
show_follows: metadata.bool({ label: $t('Follows') }),
show_subscriptions: metadata.bool({ label: $t('Subscriptions') }),
show_resubs: metadata.bool({ label: $t('Show Resubs') }),
show_sub_tiers: metadata.bool({ label: $t('Show Sub Tiers') }),
show_bits: metadata.bool({ label: $t('Bits') }),
show_raids: metadata.bool({ label: $t('Raids') }),
},
facebook: {
show_follows: metadata.bool({ label: $t('Follows') }),
show_stars: metadata.bool({ label: $t('Stars') }),
show_supports: metadata.bool({ label: $t('Supporters') }),
show_likes: metadata.bool({ label: $t('Likes') }),
show_shares: metadata.bool({ label: $t('Shares') }),
},
youtube: {
show_subscribers: metadata.bool({ label: $t('Subscriptions') }),
show_sponsors: metadata.bool({ label: $t('Members') }),
show_fanfundings: metadata.bool({ label: $t('Super Chats') }),
},
trovo: {
show_follows: metadata.bool({ label: $t('Follows') }),
show_raids: metadata.bool({ label: $t('Raids') }),
show_subscriptions: metadata.bool({ label: $t('Subscriptions') }),
show_resubs: metadata.bool({ label: $t('Show Resubs') }),
show_sub_gifts: metadata.bool({ label: $t('Show Gift Subs') }),
show_sub_tiers: metadata.bool({ label: $t('Show Sub Tiers') }),
},
};
if (!platform) return baseEvents;
return { ...platformEvents[platform], ...baseEvents };
}
get eventsByPlatform() {
const baseEvents = {
show_donations: metadata.bool({ label: $t('Donations') }),
show_merch: metadata.bool({ label: $t('Merch') }),
};
switch (this.UserService.views.platform?.type) {
case 'twitch':
return {
show_follows: metadata.bool({ label: $t('Follows') }),
show_subscriptions: metadata.bool({ label: $t('Subscriptions') }),
show_resubs: metadata.bool({ label: $t('Show Resubs') }),
show_sub_tiers: metadata.bool({ label: $t('Show Sub Tiers') }),
show_bits: metadata.bool({ label: $t('Bits') }),
show_raids: metadata.bool({ label: $t('Raids') }),
...baseEvents,
};
case 'facebook':
return {
show_follows: metadata.bool({ label: $t('Follows') }),
show_stars: metadata.bool({ label: $t('Stars') }),
show_supports: metadata.bool({ label: $t('Supporters') }),
show_likes: metadata.bool({ label: $t('Likes') }),
show_shares: metadata.bool({ label: $t('Shares') }),
...baseEvents,
};
case 'youtube':
return {
show_subscribers: metadata.bool({ label: $t('Subscriptions') }),
show_sponsors: metadata.bool({ label: $t('Members') }),
show_fanfundings: metadata.bool({ label: $t('Super Chats') }),
...baseEvents,
};
case 'trovo':
return {
show_follows: metadata.bool({ label: $t('Follows') }),
show_raids: metadata.bool({ label: $t('Raids') }),
show_subscriptions: metadata.bool({ label: $t('Subscriptions') }),
show_resubs: metadata.bool({ label: $t('Show Resubs') }),
show_sub_gifts: metadata.bool({ label: $t('Show Gift Subs') }),
show_sub_tiers: metadata.bool({ label: $t('Show Sub Tiers') }),
...baseEvents,
};
default:
return baseEvents;
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants