Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
+83
@@ -0,0 +1,83 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import { ManageIcon } from "@dndbeyond/character-components/es";
|
||||
import {
|
||||
CharacterTheme,
|
||||
ProficiencyGroup,
|
||||
rulesEngineSelectors,
|
||||
} from "@dndbeyond/character-rules-engine/es";
|
||||
|
||||
import { PaneInfo, useSidebar } from "~/contexts/Sidebar/Sidebar";
|
||||
import { PaneComponentEnum } from "~/subApps/sheet/components/Sidebar/types";
|
||||
|
||||
import {
|
||||
Subsection,
|
||||
SubsectionFooter,
|
||||
} from "../../../Shared/components/Subsection";
|
||||
import { appEnvSelectors } from "../../../Shared/selectors";
|
||||
import { AppEnvDimensionsState } from "../../../Shared/stores/typings";
|
||||
import ProficiencyGroupsBox from "../../components/ProficiencyGroupsBox";
|
||||
import { SheetAppState } from "../../typings";
|
||||
|
||||
interface Props {
|
||||
dimensions: AppEnvDimensionsState;
|
||||
theme: CharacterTheme;
|
||||
proficiencyGroups: Array<ProficiencyGroup>;
|
||||
isReadonly: boolean;
|
||||
paneHistoryStart: PaneInfo["paneHistoryStart"];
|
||||
}
|
||||
class ProficiencyGroupsDesktop extends React.PureComponent<Props> {
|
||||
handleManageShow = (): void => {
|
||||
const { paneHistoryStart, isReadonly } = this.props;
|
||||
|
||||
if (!isReadonly) {
|
||||
paneHistoryStart(PaneComponentEnum.PROFICIENCIES);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { dimensions, theme, proficiencyGroups, isReadonly } = this.props;
|
||||
|
||||
return (
|
||||
<Subsection name="Proficiency Groups">
|
||||
<ProficiencyGroupsBox
|
||||
dimensions={dimensions}
|
||||
theme={theme}
|
||||
proficiencyGroups={proficiencyGroups}
|
||||
onClick={this.handleManageShow}
|
||||
/>
|
||||
<SubsectionFooter>
|
||||
<ManageIcon
|
||||
onClick={this.handleManageShow}
|
||||
showIcon={!isReadonly}
|
||||
enableTooltip={!isReadonly}
|
||||
theme={theme}
|
||||
>
|
||||
Proficiencies & Training
|
||||
</ManageIcon>
|
||||
</SubsectionFooter>
|
||||
</Subsection>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state: SheetAppState) {
|
||||
return {
|
||||
dimensions: appEnvSelectors.getDimensions(state),
|
||||
theme: rulesEngineSelectors.getCharacterTheme(state),
|
||||
proficiencyGroups: rulesEngineSelectors.getProficiencyGroups(state),
|
||||
isReadonly: appEnvSelectors.getIsReadonly(state),
|
||||
};
|
||||
}
|
||||
|
||||
const ProficiencyGroupsDesktopContainer = (props) => {
|
||||
const {
|
||||
pane: { paneHistoryStart },
|
||||
} = useSidebar();
|
||||
return (
|
||||
<ProficiencyGroupsDesktop {...props} paneHistoryStart={paneHistoryStart} />
|
||||
);
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(ProficiencyGroupsDesktopContainer);
|
||||
@@ -0,0 +1,4 @@
|
||||
import ProficiencyGroupsDesktop from "./ProficiencyGroupsDesktop";
|
||||
|
||||
export default ProficiencyGroupsDesktop;
|
||||
export { ProficiencyGroupsDesktop };
|
||||
Reference in New Issue
Block a user