-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #421 from scottbenton/feat/truths-update
Feat/truths update
- Loading branch information
Showing
24 changed files
with
782 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { updateDoc } from "firebase/firestore"; | ||
import { getWorldDoc } from "./_getRef"; | ||
import { createApiFunction } from "api-calls/createApiFunction"; | ||
import { NewTruth } from "types/World.type"; | ||
|
||
export const updateWorldTruthNew = createApiFunction< | ||
{ worldId: string; truthKey: string; truth: NewTruth }, | ||
void | ||
>((params) => { | ||
const { worldId, truthKey, truth } = params; | ||
|
||
return new Promise((resolve, reject) => { | ||
updateDoc(getWorldDoc(worldId), { | ||
[`newTruths.${truthKey}`]: truth, | ||
}) | ||
.then(() => { | ||
resolve(); | ||
}) | ||
.catch((e) => { | ||
reject(e); | ||
}); | ||
}); | ||
}, "Failed to update world truth."); |
53 changes: 53 additions & 0 deletions
53
...s/features/charactersAndCampaigns/LinkedDialog/LinkedDialogContent/AssetDialogContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useStore } from "stores/store"; | ||
import { LinkedDialogContentTitle } from "./LinkedDialogContentTitle"; | ||
import { Box, DialogContent } from "@mui/material"; | ||
import { AssetCard } from "components/features/assets/NewAssetCard"; | ||
|
||
export interface AssetDialogContentProps { | ||
id: string; | ||
handleBack: () => void; | ||
handleClose: () => void; | ||
isLastItem: boolean; | ||
} | ||
|
||
export function AssetDialogContent(props: AssetDialogContentProps) { | ||
const { id, handleBack, handleClose, isLastItem } = props; | ||
|
||
const assets = useStore((store) => store.rules.assetMaps.assetMap); | ||
|
||
const asset = assets[id]; | ||
|
||
if (!asset) { | ||
return ( | ||
<> | ||
<LinkedDialogContentTitle | ||
id={id} | ||
handleBack={handleBack} | ||
handleClose={handleClose} | ||
isLastItem={isLastItem} | ||
> | ||
Asset Not Found | ||
</LinkedDialogContentTitle> | ||
<DialogContent>Sorry, we could not find that asset.</DialogContent> | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<LinkedDialogContentTitle | ||
id={id} | ||
handleBack={handleBack} | ||
handleClose={handleClose} | ||
isLastItem={isLastItem} | ||
> | ||
{asset.name} | ||
</LinkedDialogContentTitle> | ||
<DialogContent> | ||
<Box maxWidth={(theme) => theme.spacing(48)} mx={"auto"}> | ||
<AssetCard assetId={id} /> | ||
</Box> | ||
</DialogContent> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.