Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Update delete shot confirmation dialog. #4341

Merged

Conversation

chenba
Copy link
Collaborator

@chenba chenba commented Apr 14, 2018

Fixes #4186

@chenba chenba requested a review from flodolo as a code owner April 14, 2018 00:41
@codecov-io
Copy link

codecov-io commented Apr 14, 2018

Codecov Report

Merging #4341 into master will increase coverage by 0.12%.
The diff coverage is 17.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4341      +/-   ##
==========================================
+ Coverage   45.81%   45.93%   +0.12%     
==========================================
  Files          36       36              
  Lines        1600     1600              
  Branches      289      288       -1     
==========================================
+ Hits          733      735       +2     
+ Misses        867      865       -2
Impacted Files Coverage Δ
server/src/pages/shotindex/view.js 27.6% <10%> (+0.66%) ⬆️
server/src/pages/shot/view.js 52.1% <28.57%> (+0.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ecd240c...eb6d850. Read the comment docs.

Copy link
Collaborator

@flodolo flodolo left a comment

Choose a reason for hiding this comment

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

Just a nit from a l10n point of view. I'm not convinced by the text used in the title attribute, but that's more of a copy problem in en-US

@@ -261,6 +261,14 @@ shotIndexPageNextPage =
shotIndexNoExpirationSymbol = ∞
.title = This shot does not expire


## Delete Confirmation Dialog
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: leave a blank line after a section comment

@chenba
Copy link
Collaborator Author

chenba commented Apr 16, 2018

@flodolo Heh, those title attributes sounded pretty awkward to me when I was reviewing the commit. I'll change them to simply match the button text.

@jaredhirsch jaredhirsch self-assigned this Apr 17, 2018
Copy link
Member

@jaredhirsch jaredhirsch left a comment

Choose a reason for hiding this comment

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

The code works, but I'm concerned about maintainability with the dialog duplicated in two files. Couple of CSS nits, too.

@@ -51,6 +52,10 @@
margin-right: 4px;
}

button.trash.shot-delete-confirmation {
Copy link
Member

Choose a reason for hiding this comment

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

Two thoughts here: first, it seems odd that you press the button, giving it the 'active' highlight, then it changes to the lighter 'hover' highlight. Maybe using the 'active' color would be better.

Also, since this class just applies a 'hover' (er, 'active') effect, it might make more sense to make this a more generic 'active' (or 'active-button') class.

border: 1px solid #c7c7c7 ;
border-radius: 3px;
box-shadow: 0 5px 11px 0 rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(0, 0, 0, 0.29), inset 0 0 0 0 #fff;
height: 114px;
Copy link
Member

Choose a reason for hiding this comment

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

Right now, if the string in the box grows (always possible in German), the buttons are pushed outside the dialog container:

screen shot 2018-04-17 at 1 03 36 pm

If you change this line from a height to a min-height, the container should grow to fit the content.

}
}
.delete-confirmation-message {
font-size: 12px;
Copy link
Member

Choose a reason for hiding this comment

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

The text size seems unusually small, compared to other body / detail text in the shot page header:

screen shot 2018-04-17 at 1 02 40 pm

Maybe 15px would be better?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm I thought I grabbed the font-size straight out of https://sevaan.github.io/fxscreenshots/menus/#artboard0, but it's 13px there (which is still small). @sevaan what do you think of 15px?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You're right, that does seem small. 15px would work great (matching the font size that says "2 minutes ago" in your screenshot above.

}

componentDidUpdate() {
if (this.state.confirmDelete) {
Copy link
Member

@jaredhirsch jaredhirsch Apr 17, 2018

Choose a reason for hiding this comment

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

I kinda think it would make more sense for the state to track whether the delete button is pressed, matching the panelOpen state. This is pretty minor, though.

Edit: this is just an optional suggestion

maybeCloseDeleteConfirmation(e) {
let el = e.target;

while (el) {
Copy link
Member

Choose a reason for hiding this comment

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

I suspect you could use Node.contains() to simplify this, avoiding the while loop

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True. Just need to get refs to the dialog and the delete button.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah. If this is getting extracted to its own component, maybe pass the delete button ref into the constructor: "dialog, attach to this element here"

@@ -293,6 +293,19 @@ class Card extends React.Component {
constructor(props) {
super(props)
this.state = {panelOpen: "panel-closed", deleted: false};
this.maybeCloseDeleteConfirmation = this.maybeCloseDeleteConfirmation.bind(this);
Copy link
Member

Choose a reason for hiding this comment

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

There is a lot of code duplication between these two view files. Could you extract the modal code to a single shared component?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, that code duplication is pretty gross. I'll try styling up a div as a button and have the confirmation dialog in there. (Currently the dialog is actually a sibling of the button...which is the main reason they aren't in a component.)

@@ -252,6 +258,17 @@ h1 {
}
}

.delete-confirmation-dialog {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe the default dialog style could be declared in one spot, and overridden in the other, to minimize duplication? Not sure if it's worth it, your call

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since the dialog is absolute positioned to the delete button's parent, the defaults that work for one page would need to be completely overridden for the other page anyway, so I left them out of the partial.

Copy link
Member

Choose a reason for hiding this comment

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

Right, that makes sense.

@chenba chenba dismissed jaredhirsch’s stale review April 25, 2018 18:18

Moved the markup and the confirmation panel state into a component.

Copy link
Member

@jaredhirsch jaredhirsch left a comment

Choose a reason for hiding this comment

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

Looks great. Nice work!

@jaredhirsch jaredhirsch merged commit 10bc456 into mozilla-services:master Apr 25, 2018
testeaxeax pushed a commit to testeaxeax/screenshots that referenced this pull request Jun 7, 2018
testeaxeax pushed a commit to testeaxeax/screenshots that referenced this pull request Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants