Skip to content

cleanup custom DialogHeader inside Release Notes #7093

Closed

Description

@shiftkey

This is some cleanup to avoid the workarounds that we've used in some dialogs to support complex headers. #6032 talked about being able to provide support for passing in a JSX element rather than a plain string, which means we can clean up this custom element:

<Dialog id="release-notes" onDismissed={this.props.onDismissed}>
<DialogHeader title={` `} dismissable={false}>
<div className="release-notes-header">
<img
className="release-note-graphic-left"
src={ReleaseNoteHeaderLeftUri}
/>
<div className="title">
<p className="version">Version {release.latestVersion}</p>
<p className="date">{release.datePublished}</p>
</div>
<img
className="release-note-graphic-right"
src={ReleaseNoteHeaderRightUri}
/>
{this.renderCloseButton()}
</div>
</DialogHeader>

Version: development aka b552932

Testing:

To see this dialog for yourself, build the app in development mode and run it up:

$ yarn
$ yarn build:dev
$ yarn start

With it running, find the Help -> Show Popup -> Release notes menu item:

Screen Shot 2019-03-15 at 10 59 15 AM

This will then show the dialog - make a note of how things look to ensure that the cleanup in here doesn't affect the styles.

Screen Shot 2019-03-15 at 10 59 27 AM

With that change in place, check out the contents of render() inside app/src/ui/release-notes/release-notes-dialog.tsx. We should be able to remove the <DialogHeader> element and only use props on <Dialog> now to achieve the functionality:

    return (
      <Dialog
        id="release-notes"
        title={header} // TODO
        onDismissed={this.props.onDismissed}
      >
        <DialogContent>{contents}</DialogContent>

One thing to check while you're in here is that the close icon is positioned in the top-right (like in the original screenshot) - it looks like having a tall header now causes the default dialog styles to change:

Screen Shot 2019-03-15 at 11 08 43 AM

These are the header-specific styles for this dialog that you might need to tweak:

.dialog-header {
height: 100px;
.release-notes-header {
display: flex;
flex: 1;
}
.release-note-graphic-left {
margin-right: 20px;
}
.release-note-graphic-right {
margin-left: 20px;
}
.title {
text-align: center;
flex-grow: 1;
.version {
font-size: 14px;
font-weight: var(--font-weight-semibold);
margin-bottom: 0;
}
.date {
font-size: 11px;
color: var(--text-secondary-color);
}
}
}

But I think you'll need to look at the base styles for the dialog to get this working correctly again.

Activity

  1. added
    tech-debt
    help wanted
    on Mar 15, 2019
  2. alejandronanez commented on Mar 16, 2019

    @alejandronanez
    Contributor

    Hey there!

    I'm new to the project and I'd like to help - this seems to be a good issue for beginners, am I right?

    If so, can I grab it?

    Thanks!

  3. shiftkey commented on Mar 17, 2019

    @shiftkey
    MemberAuthor

    @alejandronanez go for it!

  4. alejandronanez commented on Mar 18, 2019

    @alejandronanez
    Contributor

    Awesome @shiftkey, I’ll work on this during this week!

    Thanks!

  5. alejandronanez commented on Mar 20, 2019

    @alejandronanez
    Contributor

    Hey @shiftkey, I had to attend a family emergency, so I won’t be able to start working on this until early next week. If that doesn’t work for the project, let me know!

    Thanks!

  6. shiftkey commented on Mar 20, 2019

    @shiftkey
    MemberAuthor

    @alejandronanez thanks for the update. I'm going to move this back into the "Available" pile to reflect that this could be picked up by someone else, but feel free to grab it next week when you have time!

  7. alejandronanez commented on Mar 27, 2019

    @alejandronanez
    Contributor

    Hey @shiftkey, I'm available again - since nobody claimed this issue, I'd like to start working on it!

  8. tierninho commented on Mar 27, 2019

    @tierninho
    Contributor

    @alejandronanez go for it and big thanks for contributing ✨

  9. alejandronanez commented on Mar 29, 2019

    @alejandronanez
    Contributor

    Hey @shiftkey & @tierninho - I got some questions regarding this issue,

    If I understand this correctly, what we want to achieve here is to avoid the usage of DialogHeader inside a Dialog component, to get to something like this:

    const dialogHeader = (
      <DialogHeader dismissable={false}>{dialogHeaderContents}</DialogHeader>
    )
    
    // later on
    return (
      <Dialog
        title={dialogHeader} // this is the new part
        id="release-notes"
        onDismissed={this.props.onDismissed}
      >
        <DialogContent>{content}</DialogContent>
        <DialogFooter>{content}</DialogFooter>
      </Dialog>
    )

    Is that right?

    Also, I want to make sure that you're aware that this would affect other dialogs, are you aware of this? - asking because this issue's title cleanup custom DialogHeader inside Release Notes

    Screen Shot 2019-03-29 at 6 54 00 AM

    If so, how what are the steps to open the Merge Conflicts and Merge dialogs?

    Thanks!

  10. shiftkey commented on Mar 29, 2019

    @shiftkey
    MemberAuthor

    @alejandronanez you're on the right track, but let me see if I can clarify things:

    If I understand this correctly, what we want to achieve here is to avoid the usage of DialogHeader inside a Dialog component, to get to something like this:

    Because we added support for using JSX in the header of a Dialog, we should be able to just pass in dialogHeaderContents (or a tweaked version) and avoid the need to import and wrap it in a <DialogHeader>. Does that clarify things?

    Also, I want to make sure that you're aware that this would affect other dialogs, are you aware of this? -

    This is fine - the work to make changes to Merge Conflict and Merge Branch is tracked in #7043, and we have an open PR #7151 to go with it.

  11. xPaw commented on Nov 10, 2025

    @xPaw

    One thing to check while you're in here is that the close icon is positioned in the top-right

    this was never fixed and now it blends in even more :)

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

Metadata

Metadata

Labels

help wantedtech-debt

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions