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:
@@ -0,0 +1,67 @@
|
||||
import {
|
||||
Collapsible,
|
||||
TypeScriptUtils,
|
||||
} from "@dndbeyond/character-components/es";
|
||||
import {
|
||||
HtmlSelectOption,
|
||||
RuleDataUtils,
|
||||
} from "@dndbeyond/character-rules-engine/es";
|
||||
|
||||
import CurrencyPaneSelectEditor from "../../../Shared/containers/panes/CurrencyPane/CurrencyPaneSelectEditor";
|
||||
|
||||
const Lifestyle = ({
|
||||
lifestyle,
|
||||
ruleData,
|
||||
isReadonly,
|
||||
handleLifestyleUpdate,
|
||||
}) => {
|
||||
const lifestyleData = RuleDataUtils.getLifestyles(ruleData);
|
||||
const lifestyleOptions: Array<HtmlSelectOption> = lifestyleData
|
||||
.map((lifestyle) => {
|
||||
if (lifestyle.id === null) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
label: `${lifestyle.name} ${
|
||||
lifestyle.cost === "-" ? "" : `(${lifestyle.cost})`
|
||||
}`,
|
||||
value: lifestyle.id,
|
||||
};
|
||||
})
|
||||
.filter(TypeScriptUtils.isNotNullOrUndefined);
|
||||
|
||||
let lifestyleDescriptionNode: React.ReactNode;
|
||||
if (lifestyle !== null) {
|
||||
lifestyleDescriptionNode = lifestyle.description;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="ct-currency-pane__lifestyle">
|
||||
<CurrencyPaneSelectEditor
|
||||
label="Lifestyle Expenses"
|
||||
options={lifestyleOptions}
|
||||
defaultValue={lifestyle === null ? null : lifestyle.id}
|
||||
propertyKey="lifestyleId"
|
||||
onUpdate={handleLifestyleUpdate}
|
||||
isReadonly={isReadonly}
|
||||
/>
|
||||
{lifestyleDescriptionNode && (
|
||||
<Collapsible
|
||||
className={"ct-currency-pane__lifestyle-detail"}
|
||||
header={
|
||||
<span className="ct-currency-pane__lifestyle-detail-header">
|
||||
{lifestyle?.name ?? "Lifestyle"} Details
|
||||
</span>
|
||||
}
|
||||
layoutType="minimal"
|
||||
>
|
||||
<div className="ct-currency-pane__lifestyle-description">
|
||||
{lifestyleDescriptionNode}
|
||||
</div>
|
||||
</Collapsible>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Lifestyle;
|
||||
Reference in New Issue
Block a user