This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7ebeaa
commit 28a8e09
Showing
24 changed files
with
527 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { connect } from "react-redux"; | ||
import { bindActionCreators } from "redux"; | ||
import { Component, createFactory, DOM as dom } from "react"; | ||
import { isEnabled } from "devtools-config"; | ||
|
||
import _Breakpoint from "./Breakpoint"; | ||
const Breakpoint = createFactory(_Breakpoint); | ||
|
||
import actions from "../../actions"; | ||
import { getSelectedSource } from "../../selectors"; | ||
import getVisibleBreakpoints from "../../selectors/visibleBreakpoints"; | ||
import { makeLocationId } from "../../utils/breakpoint"; | ||
|
||
import type { SourceRecord, BreakpointMap } from "../../reducers/types"; | ||
|
||
type props = { | ||
selectedSource: SourceRecord, | ||
breakpoints: BreakpointMap, | ||
editor: Object | ||
}; | ||
|
||
class Breakpoints extends Component { | ||
props: props; | ||
|
||
shouldComponentUpdate(nextProps: any) { | ||
if (nextProps.selectedSource && nextProps.selectedSource.get("loading")) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
render() { | ||
const { breakpoints, selectedSource, editor } = this.props; | ||
|
||
if (!selectedSource || !breakpoints || selectedSource.get("isBlackBoxed")) { | ||
return null; | ||
} | ||
|
||
return dom.div( | ||
{}, | ||
breakpoints | ||
.valueSeq() | ||
.filter( | ||
b => (isEnabled("columnBreakpoints") ? !b.location.column : true) | ||
) | ||
.map(bp => | ||
Breakpoint({ | ||
key: makeLocationId(bp.location), | ||
breakpoint: bp, | ||
selectedSource, | ||
editor: editor | ||
}) | ||
) | ||
); | ||
} | ||
} | ||
|
||
Breakpoints.displayName = "Breakpoints"; | ||
|
||
export default connect( | ||
state => ({ | ||
breakpoints: getVisibleBreakpoints(state), | ||
selectedSource: getSelectedSource(state) | ||
}), | ||
dispatch => bindActionCreators(actions, dispatch) | ||
)(Breakpoints); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.