Skip to content

Commit

Permalink
Apply campaign asset visibility to character create
Browse files Browse the repository at this point in the history
  • Loading branch information
AG-Guardian committed Oct 31, 2024
1 parent d1e6a3b commit d9b3a14
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,23 @@ export interface AssetCardDialogProps {
handleClose: () => void;
handleAssetSelection: (asset: Omit<AssetDocument, "order">) => void;
actionIsHide?: boolean;
campaignId?: string;
}

export function AssetCardDialog(props: AssetCardDialogProps) {
const { open, loading, handleClose, handleAssetSelection, actionIsHide = false } = props;
const { open, loading, handleClose, handleAssetSelection, actionIsHide = false, campaignId } = props;

const assetGroups = useStore(
(store) => store.rules.assetMaps.assetCollectionMap
);
const hiddenAssets = useStore(
let hiddenAssets = useStore(
(store) => store.campaigns.currentCampaign.currentCampaign?.hiddenAssetIds
)
);
const campaigns = useStore((store) => store.campaigns.campaignMap);

if (!hiddenAssets && campaignId && Object.keys(campaigns).includes(campaignId)) {
hiddenAssets = campaigns[campaignId].hiddenAssetIds;
}

const [selectedTabId, setSelectedTabId] = useState<string>(
Object.keys(assetGroups)[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function CharacterCreatePageContent() {
<CharacterDetails control={control} watch={watch} />
{!campaignId && <ExpansionsAndHomebrew control={control} />}
<Stats control={control} />
<Assets control={control} />
<Assets control={control} campaignId={campaignId || undefined} />
<Box display={"flex"} justifyContent={"flex-end"}>
<Button
variant={"contained"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import { AssetCard } from "components/features/assets/AssetCard";

export interface AssetsProps {
control: Control<Form>;
campaignId?: string;
}

export function Assets(props: AssetsProps) {
const { control } = props;
const { control, campaignId } = props;

const defaultRuleAlertText = useGameSystemValue({
[GAME_SYSTEMS.IRONSWORN]:
Expand Down Expand Up @@ -120,6 +121,7 @@ export function Assets(props: AssetsProps) {
});
setIsAddAssetDialogOpen(false);
}}
campaignId={campaignId}
/>
</>
);
Expand Down

0 comments on commit d9b3a14

Please sign in to comment.