Skip to content
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

Less flashy closing-remarks #6497

Merged
merged 5 commits into from
Apr 12, 2023
Merged

Less flashy closing-remarks #6497

merged 5 commits into from
Apr 12, 2023

Conversation

async function init(): Promise<void> {
const mergeCommit = select(`.TimelineItem.js-details-container.Details a[href^="/${getRepo()!.nameWithOwner}/commit/" i] > code`)!.textContent!;
const tagName = await getFirstTag(mergeCommit);

if (tagName) {
addExistingTagLink(tagName);
} else {
void addReleaseBanner('The merge commit doesn’t appear in any tags');
void addReleaseBanner('This PR’s merge commit doesn’t appear in any tags');
Copy link
Member Author

Choose a reason for hiding this comment

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

The copy was a little too vague

text: <>This pull request first appeared in <span className="text-mono text-small">{tagName}</span></>,
classes: ['flash-success'],
action: tagUrl,
buttonLabel: <><TagIcon/> See release</>,
Copy link
Member Author

Choose a reason for hiding this comment

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

This widget only shows the state of the PR, it doesn't require any actions, so I think it'd make sense to not use the button.

This now also helps differentiate the two states:

  • released
  • unreleased

… because they used to be clearly blue and clearly green, but now their color varies very little.

buttonLabel: <><TagIcon/> Draft a new release</>,
} : {text})}
buttonLabel: 'Draft a new release',
} : bannerContent)}
Copy link
Member Author

Choose a reason for hiding this comment

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

RequireAllOrNone types make optional properties annoying to use. Feel free to try locally

action: url,
buttonLabel: <><TagIcon/> Draft a new release</>,
} : {text})}
buttonLabel: 'Draft a new release',
Copy link
Member Author

Choose a reason for hiding this comment

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

@fregante fregante requested a review from kidonng April 12, 2023 09:43
classes: ['flash-success'],
action: tagUrl,
buttonLabel: <><TagIcon/> See release</>,
icon: <TagIcon className="m-0"/>,
Copy link
Member Author

Choose a reason for hiding this comment

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

The tag also aligns it well with rgh-netiquette in refined-github/sandbox#1

Screenshot 11

Co-authored-by: Kid <44045911+kidonng@users.noreply.github.com>
@kidonng
Copy link
Member

kidonng commented Apr 12, 2023

This is a good chance to refactor createBanner a bit:

// Classes copied from "had recent pushes" banner from repo home
const classes = 'flex-shrink-0 btn btn-sm ml-sm-3 mt-2 mt-sm-n2 mb-sm-n2 mr-sm-n1 flex-self-center';

- // Classes copied from "had recent pushes" banner from repo home
+ // https://primer.style/css/components/alerts#with-action-button
- const classes = 'flex-shrink-0 btn btn-sm ml-sm-3 mt-2 mt-sm-n2 mb-sm-n2 mr-sm-n1 flex-self-center'; 
+ const classes = 'btn btn-sm flash-action';

<div className={['flash', ...props.classes ?? ''].join(' ')}>
<div className="d-sm-flex flex-items-center gap-2">
<div className="d-flex flex-auto flex-self-center flex-items-center gap-2">
{props.icon}
{/* TODO: Drop `any` after https://github.com/frenic/csstype/issues/177 */}
<span style={{textWrap: 'balance'} as any}>{props.text}</span>
</div>
{button}
</div>
</div>

<div className={['flash', ...props.classes ?? ''].join(' ')}>
-	<div className="d-sm-flex flex-items-center gap-2">
-		<div className="d-flex flex-auto flex-self-center flex-items-center gap-2">
			{props.icon}
			{/* TODO: Drop `any` after https://github.com/frenic/csstype/issues/177 */}
			<span style={{textWrap: 'balance'} as any}>{props.text}</span>
-		</div>
		{button}
-	</div>
</div>

This was intended to be part of #6489

@fregante
Copy link
Member Author

As the inline comment suggests, we're using GitHub’s own classes. I'm pretty sure that they lead to a better result than just that. See the current mobile version:

Screenshot 17

versus what I get (if I didn't make mistakes) by applying your change:

Screenshot 18

@fregante
Copy link
Member Author

Basically that change would revert #5772

You can include this in your lint PR after this one is merged, if you can achieve the same result with semantic classes

@fregante
Copy link
Member Author

Indeed 🙂

Screenshot 19

@kidonng
Copy link
Member

kidonng commented Apr 12, 2023

That's float for you! (To be honest I encountered this in my attempt too)

It doesn't make sense to revert that PR. I will just create a new one to get rid of flash completely.

@fregante
Copy link
Member Author

I will just create a new one to get rid of flash completely.

Reasoning?

@kidonng
Copy link
Member

kidonng commented Apr 12, 2023

Reasoning?

Because we are overriding most things from that class?

@fregante
Copy link
Member Author

fregante commented Apr 12, 2023

Reasoning?

Because we are overriding most things from that class?

We're not? Borders, rounding, padding, colors, icon colors still come from flash. None of those classes (flex-shrink-0 btn btn-sm ml-sm-3 mt-2 mt-sm-n2 mb-sm-n2 mr-sm-n1 flex-self-center) actually override anything, we're only overriding the background right?

I suppose that if you can replicate what flash with Box and color-blue it might still be worth it, but if you're going to add 4 classes to replace 1… I don't think it's worth it. Also if we use utility classes instead of flash we lose any future update to flash

@fregante fregante merged commit f501e3c into main Apr 12, 2023
9 checks passed
@fregante fregante deleted the incospicuous-closing-remargs branch April 12, 2023 20:14
@fregante
Copy link
Member Author

fregante commented Apr 17, 2023

It looks like GitHub uses the same format and location to display status in open PRs:

Screenshot 9

The HTML

<div
  class="border color-border-default rounded-2 branch-action-item js-details-container js-transitionable"
>
 
  <div
    class="merge-status-list-wrapper"
  >
    <div
      class="float-left branch-action-item-icon completeness-indicator circle color-fg-muted border"
    >
      <RocketIcon/>
    </div>

    <h3 class="h4 status-heading">This branch has not been deployed</h3>
    <span class="status-meta"> No deployments </span>
  </div>
</div>

It looks decent on mobile but:

  • the icon isn't centered vertically (🤷‍♂️)
  • the button-related media-query classes are still missing

Screenshot 10

So it's still probably not worth spending a lot of time on it (or any) given the 50 open bugs 😅

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

Successfully merging this pull request may close these issues.

closing-remarks has wrong style
2 participants