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:
2025-05-28 11:50:03 -07:00
commit 8df9031d27
3592 changed files with 319051 additions and 0 deletions
@@ -0,0 +1,89 @@
import {
CharacterTheme,
Constants,
DataOrigin,
DeathSaveInfo,
DiceAdjustment,
RuleData,
} from "@dndbeyond/character-rules-engine/es";
import DiceAdjustmentSummary from "../../../Shared/components/DiceAdjustmentSummary";
interface Props {
savingThrowDiceAdjustments: Array<DiceAdjustment>;
onDataOriginClick?: (dataOrigin: DataOrigin) => void;
deathSaveInfo: DeathSaveInfo;
ruleData: RuleData;
theme: CharacterTheme;
}
export default function SavingThrowsDetails({
savingThrowDiceAdjustments,
onDataOriginClick,
deathSaveInfo,
ruleData,
theme,
}: Props) {
const renderDiceAdjustmentList = (
diceAdjustments: Array<DiceAdjustment>,
showDataOrigin: boolean = false
): React.ReactNode => {
if (!diceAdjustments.length) {
return null;
}
return (
<>
{diceAdjustments.map((diceAdjustment, idx) => {
return (
<DiceAdjustmentSummary
theme={theme}
diceAdjustment={diceAdjustment}
key={diceAdjustment.uniqueKey}
ruleData={ruleData}
showDataOrigin={showDataOrigin}
onDataOriginClick={onDataOriginClick}
/>
);
})}
</>
);
};
if (
!savingThrowDiceAdjustments.length &&
!deathSaveInfo.disadvantageAdjustments.length &&
!deathSaveInfo.advantageAdjustments.length
) {
return (
<div className="ct-saving-throws-details__empty">
You have no saving throw modifiers
</div>
);
}
const advantageSavingThrowAdjustments: Array<DiceAdjustment> = [];
const disadvantageSavingThrowAdjustments: Array<DiceAdjustment> = [];
const bonusSavingThrowAdjustments: Array<DiceAdjustment> = [];
savingThrowDiceAdjustments.forEach((adjustment) => {
if (adjustment.type === Constants.DiceAdjustmentTypeEnum.ADVANTAGE) {
advantageSavingThrowAdjustments.push(adjustment);
}
if (adjustment.type === Constants.DiceAdjustmentTypeEnum.DISADVANTAGE) {
disadvantageSavingThrowAdjustments.push(adjustment);
}
if (adjustment.type === Constants.DiceAdjustmentTypeEnum.BONUS) {
bonusSavingThrowAdjustments.push(adjustment);
}
});
return (
<div className="ct-saving-throws-details">
{renderDiceAdjustmentList(advantageSavingThrowAdjustments)}
{renderDiceAdjustmentList(deathSaveInfo.advantageAdjustments)}
{renderDiceAdjustmentList(disadvantageSavingThrowAdjustments)}
{renderDiceAdjustmentList(deathSaveInfo.disadvantageAdjustments)}
{renderDiceAdjustmentList(bonusSavingThrowAdjustments, true)}
</div>
);
}
@@ -0,0 +1,4 @@
import SavingThrowsDetails from "./SavingThrowsDetails";
export default SavingThrowsDetails;
export { SavingThrowsDetails };