This repository has been archived by the owner on Sep 8, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Added ability to join different rooms (#54)
* ✨ Added room name to local state * ✨ Added useSharedStore factory * 💄 Make sure that control panel sits at grid start * 🚧 Fleshing out join room flow * ✨ Gave join form an input field for room anme * ✨ Added Join! button * ✨ Set room name on form submit * 🔧 VSCode workspace is now relative * ✏️ All files end in LF * ✨ Added join form * 🔥 Removed debugging for JoinForm * ✅ ActorList uses shared state context * ✅ ActorList and AddActor use shared store context * ✅ Added act around setState call * ✅ Wrapped useLocalStore in act * ✅ Removed unneeded act call * ✅ Updated token tests to use new shared state * ✅ Updated tabletop to use new shared store * 🔥 Removed old shared store * 🐛 Fixed creating duplicate useShareStores on every render * ✅ Passing all e2e tests * ✅ Disabled headed mode and slow-mo * 💄 Styled JoinForm * 📝 Added note about flaky test
- Loading branch information
1 parent
db91f64
commit 4efc265
Showing
20 changed files
with
427 additions
and
77 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 @@ | ||
* eol=lf |
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,7 +1,7 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"path": "C:\\Users\\josep\\Documents\\Programming\\TypeScript\\TableTop" | ||
"path": ".." | ||
} | ||
] | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,16 +1,51 @@ | ||
import * as React from "react" | ||
import { v4 as uuidv4 } from "uuid"; | ||
|
||
import { useLocalStore } from "./store/local"; | ||
import { useSharedStoreFactory } from "./store/shared"; | ||
|
||
import Tabletop from "~/components/tabletop/Tabletop"; | ||
import { RectangularGrid } from "~/components/tabletop/RectangularGrid"; | ||
|
||
import ControlPanel from "./components/control-panel/ControlPanel"; | ||
import JoinForm from "./components/join-form/JoinForm"; | ||
|
||
export const App = () => | ||
( | ||
<main style={{ width: "100%", height: "100%" }}> | ||
<ControlPanel /> | ||
<Tabletop grid={<RectangularGrid />} /> | ||
</main> | ||
export const SharedStoreContext = React.createContext( | ||
useSharedStoreFactory(uuidv4()) | ||
); | ||
|
||
export const App = () => | ||
{ | ||
const { room } = useLocalStore(); | ||
|
||
const useSharedStore = React.useMemo( | ||
() => useSharedStoreFactory(room), | ||
[ room ] | ||
); | ||
|
||
return ( | ||
<main | ||
style={{ | ||
width: "100vw", | ||
height: "100vh", | ||
display: "grid", | ||
placeItems: "center", | ||
}} | ||
> | ||
{ | ||
room === "" | ||
? ( | ||
<JoinForm /> | ||
) | ||
: ( | ||
<SharedStoreContext.Provider value={useSharedStore}> | ||
<ControlPanel /> | ||
<Tabletop grid={<RectangularGrid />} /> | ||
</SharedStoreContext.Provider> | ||
) | ||
} | ||
</main> | ||
) | ||
} | ||
|
||
export default App; |
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.