-
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 #451 from scottbenton/feat/campaign-types
Feat/campaign types
- Loading branch information
Showing
117 changed files
with
2,642 additions
and
1,788 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
import { Bytes } from "firebase/firestore"; | ||
import { World } from "types/World.type"; | ||
|
||
export type WorldDocument = Omit<World, "worldDescription"> & { | ||
export interface WorldDocument { | ||
name: string; | ||
worldDescription?: Bytes; | ||
}; | ||
newTruths?: Record<string, Truth>; | ||
ownerIds: string[]; | ||
campaignGuides?: string[]; | ||
} | ||
|
||
export interface World { | ||
name: string; | ||
newTruths?: Record<string, Truth>; | ||
ownerIds: string[]; | ||
worldDescription?: Uint8Array; | ||
campaignGuides?: string[]; | ||
} | ||
|
||
export interface Truth { | ||
selectedTruthOptionIndex?: number; | ||
selectedSubItemIndex?: number | null; | ||
|
||
customTruth?: { | ||
description: string; | ||
questStarter: string; | ||
}; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { arrayRemove, arrayUnion, updateDoc } from "firebase/firestore"; | ||
import { getWorldDoc } from "./_getRef"; | ||
import { createApiFunction } from "api-calls/createApiFunction"; | ||
|
||
export const updateWorldGuide = createApiFunction< | ||
{ | ||
worldId: string; | ||
guideId: string; | ||
shouldRemove?: boolean; | ||
}, | ||
void | ||
>((params) => { | ||
const { worldId, guideId, shouldRemove } = params; | ||
|
||
return new Promise((resolve, reject) => { | ||
updateDoc(getWorldDoc(worldId), { | ||
campaignGuides: !shouldRemove | ||
? arrayUnion(guideId) | ||
: arrayRemove(guideId), | ||
}) | ||
.then(() => { | ||
resolve(); | ||
}) | ||
.catch((e) => { | ||
reject(e); | ||
}); | ||
}); | ||
}, "Failed to update world guides."); |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.