New source found from dndbeyond.com
This commit is contained in:
+30
-3
@@ -1,11 +1,37 @@
|
||||
import { useLayoutEffect } from "react";
|
||||
import { useEffect, useLayoutEffect, useState } from "react";
|
||||
|
||||
import { getCharacterSlots } from "~/helpers/characterServiceApi";
|
||||
import { useDispatch } from "~/hooks/useDispatch";
|
||||
import { BuilderProvider } from "~/subApps/builder/contexts/Builder";
|
||||
import { PremadeListing } from "~/subApps/builder/routes/PremadeListing";
|
||||
import { appEnvActions } from "~/tools/js/Shared/actions/appEnv";
|
||||
|
||||
import ErrorBoundary from "../../../Shared/components/ErrorBoundary";
|
||||
import CharacterBuilder from "../CharacterBuilder";
|
||||
|
||||
export function CharacterBuilderContainer(props) {
|
||||
interface CharacterBuilderContainerProps {
|
||||
isPremadeListing?: boolean;
|
||||
}
|
||||
|
||||
export function CharacterBuilderContainer(
|
||||
props: CharacterBuilderContainerProps
|
||||
) {
|
||||
const dispatch = useDispatch();
|
||||
const [isSlotLimitsLoaded, setIsSlotLimitsLoaded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isSlotLimitsLoaded) {
|
||||
getCharacterSlots().then((characterSlots) => {
|
||||
dispatch(
|
||||
appEnvActions.dataSet({
|
||||
characterSlots,
|
||||
})
|
||||
);
|
||||
setIsSlotLimitsLoaded(true);
|
||||
});
|
||||
}
|
||||
}, [isSlotLimitsLoaded]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
document
|
||||
.getElementsByTagName("body")[0]
|
||||
@@ -26,10 +52,11 @@ export function CharacterBuilderContainer(props) {
|
||||
);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<BuilderProvider>
|
||||
<ErrorBoundary>
|
||||
<CharacterBuilder />
|
||||
{props.isPremadeListing ? <PremadeListing /> : <CharacterBuilder />}
|
||||
</ErrorBoundary>
|
||||
</BuilderProvider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user