-
Notifications
You must be signed in to change notification settings - Fork 482
Assembly view #4196
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
Assembly view #4196
Changes from all commits
aaf5924
f9ad9da
450f89c
18d5ccc
9647b43
d929257
cdd2812
6c8cac8
d675127
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
| // @flow | ||
|
|
||
| import React from 'react'; | ||
| import classNames from 'classnames'; | ||
|
|
||
| import { getAssemblyViewIsOpen } from 'firefox-profiler/selectors/url-state'; | ||
| import { | ||
| openAssemblyView, | ||
| closeAssemblyView, | ||
| } from 'firefox-profiler/actions/profile-view'; | ||
| import explicitConnect from 'firefox-profiler/utils/connect'; | ||
|
|
||
| import type { ConnectedProps } from 'firefox-profiler/utils/connect'; | ||
|
|
||
| import { Localized } from '@fluent/react'; | ||
|
|
||
| type StateProps = {| | ||
| +assemblyViewIsOpen: boolean, | ||
| |}; | ||
|
|
||
| type DispatchProps = {| | ||
| +openAssemblyView: typeof openAssemblyView, | ||
| +closeAssemblyView: typeof closeAssemblyView, | ||
| |}; | ||
|
|
||
| type Props = ConnectedProps<{||}, StateProps, DispatchProps>; | ||
|
|
||
| class AssemblyViewToggleButtonImpl extends React.PureComponent<Props> { | ||
| _onClick = () => { | ||
| if (this.props.assemblyViewIsOpen) { | ||
| this.props.closeAssemblyView(); | ||
| } else { | ||
| this.props.openAssemblyView(); | ||
| } | ||
| }; | ||
|
|
||
| render() { | ||
| const { assemblyViewIsOpen } = this.props; | ||
|
|
||
| return assemblyViewIsOpen ? ( | ||
| <Localized id="AssemblyView--hide-button" attrs={{ title: true }}> | ||
| <button | ||
| className={classNames( | ||
| 'bottom-assembly-button', | ||
| 'photon-button', | ||
| 'photon-button-ghost', | ||
| 'photon-button-ghost--checked' | ||
| )} | ||
| title="Hide the assembly view" | ||
| type="button" | ||
| onClick={this._onClick} | ||
| /> | ||
| </Localized> | ||
| ) : ( | ||
| <Localized id="AssemblyView--show-button" attrs={{ title: true }}> | ||
| <button | ||
| className={classNames( | ||
| 'bottom-assembly-button', | ||
| 'photon-button', | ||
| 'photon-button-ghost' | ||
| )} | ||
| title="Show the assembly view" | ||
| type="button" | ||
| onClick={this._onClick} | ||
| /> | ||
| </Localized> | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| export const AssemblyViewToggleButton = explicitConnect< | ||
| {||}, | ||
| StateProps, | ||
| DispatchProps | ||
| >({ | ||
| mapStateToProps: (state) => ({ | ||
| assemblyViewIsOpen: getAssemblyViewIsOpen(state), | ||
| }), | ||
| mapDispatchToProps: { | ||
| openAssemblyView, | ||
| closeAssemblyView, | ||
| }, | ||
| component: AssemblyViewToggleButtonImpl, | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,47 +2,86 @@ | |
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| .bottom-box { | ||
| .bottom-box-pane { | ||
| display: flex; | ||
| height: 100%; | ||
| flex-flow: column; | ||
| height: 100%; /* direct child of SplitterLayout */ | ||
| flex-flow: column nowrap; | ||
| } | ||
|
|
||
| .bottom-main { | ||
| position: relative; | ||
| .bottom-sourceview-wrapper, | ||
| .bottom-assemblyview-wrapper { | ||
| position: relative; /* containing block for status overlay */ | ||
| display: flex; | ||
| min-height: 0; | ||
| flex: 1; | ||
| flex-flow: column; | ||
| background: var(--grey-20); | ||
| } | ||
|
|
||
| .bottom-box .layout-splitter { | ||
| position: relative; /* containing block for absolute ::before */ | ||
| width: 1px; | ||
| border: none; | ||
| background-color: var(--grey-30) !important; | ||
| } | ||
|
|
||
| /* Provide 3px extra grabbable surface on each side of the splitter */ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you start dragging that extra 3px grabbable area, the splitter jumps because of it. But probably that's not a big issue.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed that too and filed zesik/react-splitter-layout#67 about it, but the repo seems somewhat unmaintained. It also happens with a regular wide splitter, it's not because of the negative margins, from what I can tell.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, thanks for filing! Yeah, last commit is from 2019. Doesn't look like it's maintained |
||
| .bottom-box .layout-splitter::before { | ||
| position: absolute; | ||
| z-index: 1; | ||
| display: block; | ||
| content: ''; | ||
| inset: 0 -3px; | ||
| } | ||
|
|
||
| .bottom-box-bar { | ||
| display: flex; | ||
| overflow: hidden; | ||
| height: 24px; | ||
| flex-flow: row; | ||
| align-items: center; | ||
| justify-content: space-between; | ||
| border-bottom: 1px solid var(--grey-30); | ||
| background: var(--grey-10); | ||
| box-shadow: inset 0 -1px var(--grey-30); | ||
| line-height: 18px; | ||
| } | ||
|
|
||
| .bottom-box-title { | ||
| margin: 0; | ||
| margin-left: 8px; | ||
| overflow: hidden; | ||
| margin: 0 8px; | ||
| font: inherit; | ||
| text-overflow: ellipsis; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .bottom-close-button { | ||
| .bottom-box-header-trailing-buttons { | ||
| display: flex; | ||
| height: 100%; | ||
| flex-flow: row nowrap; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .bottom-close-button, | ||
| .bottom-assembly-button { | ||
| width: 24px; | ||
| height: 24px; | ||
| flex-shrink: 0; | ||
| background: url(/res/img/svg/close-dark.svg) no-repeat center / 16px 16px; | ||
| background-position: center; | ||
| background-repeat: no-repeat; | ||
| background-size: 16px 16px; | ||
| } | ||
|
|
||
| .bottom-close-button { | ||
| background-image: url(/res/img/svg/close-dark.svg); | ||
| } | ||
|
|
||
| .bottom-assembly-button { | ||
| background-image: url(/res/img/svg/asm-icon.svg); | ||
| } | ||
|
|
||
| .sourceStatusOverlay { | ||
| .codeLoadingOverlay, | ||
| .sourceCodeErrorOverlay, | ||
| .assemblyCodeErrorOverlay { | ||
| /** | ||
| * Put the overlay on top of everything in .bottom-main, but centered | ||
| * horizontally and vertically. We center using margin: auto, and enforce | ||
|
|
@@ -69,8 +108,8 @@ | |
| word-break: break-word; | ||
| } | ||
|
|
||
| /* Use :before to add a loading spinner image */ | ||
| .sourceStatusOverlay.loading::before { | ||
| /* Use ::before to add a loading spinner image */ | ||
| .codeLoadingOverlay::before { | ||
| display: block; | ||
| width: 32px; | ||
| height: 32px; | ||
|
|
@@ -79,8 +118,9 @@ | |
| content: ''; | ||
| } | ||
|
|
||
| /* Use :before to add an alert icon */ | ||
| .sourceStatusOverlay.error::before { | ||
| /* Use ::before to add an alert icon */ | ||
| .sourceCodeErrorOverlay::before, | ||
| .assemblyCodeErrorOverlay::before { | ||
| display: block; | ||
| width: 50px; | ||
| height: 50px; | ||
|
|
@@ -90,6 +130,6 @@ | |
| filter: brightness(70%) drop-shadow(0 1px rgb(255 255 255 / 0.5)); | ||
| } | ||
|
|
||
| .sourceStatusOverlay ul { | ||
| .codeErrorOverlay { | ||
| padding-left: 20px; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.