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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[release-calendar] Change tooltip to use hooks 馃帲 and portals #813
Conversation
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.
Nice use of 馃帲
<div className={'content-row'} key={row.icon}> | ||
<div className={'icon'}> | ||
<i | ||
className='material-icons' |
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.
Is it possible to use emojis instead of icons? We usually use 馃殑 for release
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.
Also do you have a better idea for a Github emoji? 馃枼is just sad
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.
And! for LTS, what's better 馃彊or 馃彴? or other?
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.
Hmm I think 馃彊
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.
For the GitHub release link, I'd put 馃敆
</span> | ||
</div> | ||
<div className={'text'}> | ||
{match.text + moment(row.date).format('MMMM Do, hA')} |
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.
Instead of having a match.text
field, this can serve as a template to remove duplication.
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'm not sure what you mean. Hm, if you're thinking that there could be something like
Promoted to Opt-in Experimental, Opt-In Beta on April 20th, 11 am
Promoted to Opt-in Experimental, Opt-In Beta on April 20th, 11 am
one line which represents Channel.OPT_IN_EXPERIMENTAL
and the other Channel.OPT_IN_BETA
? That wont happen because Channel.OPT_IN_BETA
doesn't exist in the schedule template. There is the possibility of duplication if there had been a rollback and a release is getting reinstated to a channel it was already in. Is that what you're referring to? If so, I can brainstorm about adding a rollback line to divide the two promotions?
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.
By template I mean removing the match.text
field and putting here:
{match.title} was promoted ...
You don't have to have a single line for experimental/beta, if it makes it easier. 1 channel per line is okay.
<div ref={node}> | ||
<div | ||
ref={setPopperElement} | ||
style={{...{zIndex: 999}, ...styles.popper}} |
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.
Can this be moved to an SCSS file? Not sure what popper
suggests
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.
There's a couple of things I can do.
- Change the CSSProperty in styles.popper directly.
styles.popper['zIndex'] = 999;
- Keep what I have above
style={{...{zIndex: 999}, ...styles.popper}}
- Or declare
zIndex: 999
in a different variable
const bringForward: React.CSSProperties = {zIndex: 999};
style={{...bringForward,...styles.popper}}
Popper doesn't have a suggestion for smaller changes to style like this. But when doing a full customized tooltip, they suggest the third (when I wouldn't use styles.popper at all).
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.
Hmm, okay. We can leave this as is.
<div ref={node}> | ||
<div | ||
ref={setPopperElement} | ||
style={{...{zIndex: 999}, ...styles.popper}} |
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.
Hmm, okay. We can leave this as is.
}, | ||
]; | ||
|
||
getTitle(search: Channel): string { |
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 if history
was a dict with Channel as the key? Could be a lot cleaner here.
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.
The best solution I can think to debug the channels with "-" not being accessible within the dictionary is to create an interface where the key is typed as a string. This will push the enum into a string under the hood, but it allows for normal dictionary sets and gets. If you are okay with here, then I could also make the channelsTitles a dictionary, which is currently a {channel: Channel, title: string}[]. We had used this structure because of the same weird "-" enum behavior. If I switched it, then I'd again have direct access to the titles I want instead of doing the find() loop I do now.
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.
Can we revisit the dict idea? Hyphens should not be a problem. For example
const channelMap = {
'lts': 'lts',
'stable': 'stable',
'opt-in-beta': 'opt in beta',
'perc-beta': '1% beta',
};
console.log(channels['opt-in-beta']);
// opt in beta
console.log(channels['perc-beta']);
// 1% beta
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.
Making channelsTitles a dictionary is a great idea :)
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.
Also I totally misread your comment! My "revisit the dict idea" was not helpful haha. Nice workaround.
getReleaseDates() will be renamed to getRelease() once the current getRelease is changed in a different pr |
@@ -61,4 +61,10 @@ export class ApiService { | |||
); | |||
return new CurrentReleases(currentReleases); | |||
} | |||
|
|||
async getReleaseDates(requestedRelease: string): Promise<Release> { |
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.
rename getReleaseDates
because it's not getting releaseDates
anymore.
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.
Oh, I just saw your comment. Okay.
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.
:)
}, | ||
]; | ||
|
||
getTitle(search: Channel): string { |
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.
Can we revisit the dict idea? Hyphens should not be a problem. For example
const channelMap = {
'lts': 'lts',
'stable': 'stable',
'opt-in-beta': 'opt in beta',
'perc-beta': '1% beta',
};
console.log(channels['opt-in-beta']);
// opt in beta
console.log(channels['perc-beta']);
// 1% beta
This creates a tooltip that utilizes react portals in order to live outside of the
calendar
component in which is was made.This is an example of a tooltip living outside of its parent component.
Included:
installation of @popperjs/core (for the tooltip), moment (to assist in the format of time in tooltip), react-popper (so the tooltip can be rendered in the correct position)
creation of
Tooltip
andHook
which together manage the positioning of the tooltip.Tooltip
replaces the event element which would otherwise be automatically rendered FullCalendar. It replaces it with the hook.Hook
makes the connection between the replacement event element and the newEventCard
.Hook
also conceals theEventCard
when someone clicks away from the element and does so witheventListeners
.creation of
EventCard
which renders rows of information about the release. Each row has a related icon to the left and information to the right. The release cards match the corresponding channels by displaying a thin top bar and transparent background of the channel color.styling for
eventCard
styling adjustments to
calendar
in order to overwrite the default button colors of FullCalendar. FullCalendar.io does not allow for customized styling other than full Bootstrap themes- that seemed like an overkill.small adjustments to the calendar so that the tooltip will not be cut off when it's positioned very low on the screen
change of testData from the first release being named 1234567890123 to 2004252135000 which instead is a real release tag so as to test the link to the github release body. Link will create a new tab.
emojis for channel schedule
add
getReleaseDates(requestedRelease: string)
to client side that uses the already madegetCurrentReleases()
call on the server side. This will carryReleaseDate[]
which contains promotion channels and start dates so to populate the emoji schedule.TODO: Add cherrypick attribute to
releaseDates
currently the code onEventCard
is commented outTODO: Place emojis in rtv square on
ChannelTable