Skip to content

web: move share snapshot in to modal, show register token URL #2095

Merged
jazzdan merged 12 commits into
masterfrom
dmiller/ch3249/as-a-user-when-i-click-share-snapshot-the
Aug 22, 2019
Merged

web: move share snapshot in to modal, show register token URL #2095
jazzdan merged 12 commits into
masterfrom
dmiller/ch3249/as-a-user-when-i-click-share-snapshot-the

Conversation

@jazzdan

@jazzdan jazzdan commented Aug 21, 2019

Copy link
Copy Markdown
Contributor

It's pretty ugly, but:

Screen Shot 2019-08-21 at 5 49 00 PM

After clicking "Share Snapshot":

Screen Shot 2019-08-21 at 5 49 10 PM

Will probably need to rope @nicks in for some styling help 😅

@jazzdan
jazzdan requested review from landism and nicks August 21, 2019 21:50
Comment thread internal/tft/url.go Outdated
@@ -0,0 +1,14 @@
package tft

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe "cloud" instead of "tft"?

Comment thread web/src/ShareSnapshotModal.tsx Outdated
<section className="modal-main">
<section className="modal-snapshotUrlWrap">
<button onClick={props.handleClose}>close</button>
<button onClick={() => props.handleSendSnapshot(props.state)}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it seems weird to pass modal the entire state. usually you would bind the snapshot to the function, so that this was just invoked as props.sendSnapshot()

Comment thread web/src/ShareSnapshotModal.tsx Outdated
if (!hasLink) {
return (
<div className={showHideClassName}>
<section className="modal-main">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this isn't what section is for, see
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section#Usage_notes

Do not use the <section> element as a generic container; this is what <div> is for, especially when the sectioning is only for styling purposes. A rule of thumb is that a section should logically appear in the outline of a document.

Comment thread web/src/ShareSnapshotModal.tsx Outdated
<section className="modal-main">
<section className="modal-snapshotUrlWrap">
<button onClick={props.handleClose}>close</button>
<button onClick={() => window.open(props.snapshotUrl)}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you reduce the duplication here by assigning this button to a variable?

e.g.
let button = <button...>
if (hasLink) {
button = <button ...>
}

transform: translate(-50%,-50%);
}

.display-block {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i would usually call this u-displayBlock / u-displayNone

in BEM convention, "display-none" typically means "in the display component, there's a sub-element called block", which is obviously not what you mean here

}

.modal-main {
position:fixed;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if you've got a fixed element inside another fixed element, that usually means you're confused and not using it correctly. tho i can clean this up in a follow-up pr

Comment thread web/src/TopBar.tsx Outdated
</section>
)
}
const renderSnapshotModal = (handleOpenModal: () => void) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this would make more sense as a method of TopBar? that way it has access to this.props. It creates a sub-element of topbar and doesn't seem generally useful outside it

Comment thread web/src/ShareSnapshotModal.tsx Outdated
)
}

const loggedOutTiltCloudCopy = (registerTokenURL: string) => (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it might make more sense if ShareSnapshotModal was a class, so this could be a method

Comment thread web/src/ShareSnapshotModal.tsx Outdated
<section className="modal-main">
<section className="modal-snapshotUrlWrap">
<button onClick={props.handleClose}>close</button>
<button onClick={() => window.open(props.snapshotUrl)}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also, this should really be an <a> with an href

Comment thread web/src/HUD.tsx Outdated
} | null
IsSidebarClosed: boolean
SnapshotLink: string
ShowSnapshotModal: boolean

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fine for this PR, but it seems weird that all these fields are capitalized

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

They're capitalized because they come from Go and we don't override the JSON serialization.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this property doesn't come from Go, though, right? or am i misunderstanding?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ohh you're right @nicks, good call. I can lowercase it.

@jazzdan jazzdan changed the title web: move share snapshot in to model, show register token URL web: move share snapshot in to modal, show register token URL Aug 22, 2019
@jazzdan
jazzdan requested a review from nicks August 22, 2019 18:24
Comment thread web/src/HUD.tsx Outdated
} | null
IsSidebarClosed: boolean
SnapshotLink: string
ShowSnapshotModal: boolean

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this property doesn't come from Go, though, right? or am i misunderstanding?

@jazzdan
jazzdan merged commit 3a8824a into master Aug 22, 2019
@nicks
nicks deleted the dmiller/ch3249/as-a-user-when-i-click-share-snapshot-the branch February 3, 2022 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants