Trying to get game loading flowing again
This commit is contained in:
parent
49975e7a4b
commit
a8728f992e
@ -49,6 +49,7 @@ const Actions: React.FC<ActionsProps> = ({
|
||||
houseRulesActive,
|
||||
setHouseRulesActive,
|
||||
}) => {
|
||||
console.log("Actions component rendered");
|
||||
const ctx = useContext(GlobalContext) as LocalGlobalContext;
|
||||
const ws = ctx.ws ?? null;
|
||||
const gameId = ctx.gameId ?? null;
|
||||
@ -58,6 +59,7 @@ const Actions: React.FC<ActionsProps> = ({
|
||||
const [priv, setPriv] = useState<PrivateData | undefined>(undefined);
|
||||
const [turn, setTurn] = useState<TurnData>({});
|
||||
const [edit, setEdit] = useState<string | undefined>(name);
|
||||
console.log("Actions: name =", name, "edit =", edit);
|
||||
const [active, setActive] = useState<number>(0);
|
||||
const [players, setPlayers] = useState<Record<string, PlayerData>>({});
|
||||
const [alive, setAlive] = useState<number>(0);
|
||||
@ -80,6 +82,7 @@ const Actions: React.FC<ActionsProps> = ({
|
||||
}
|
||||
if ("name" in data.update && data.update.name !== edit) {
|
||||
setEdit(data.update.name);
|
||||
console.log("Actions: setEdit from data.update.name =", data.update.name);
|
||||
}
|
||||
if ("turn" in data.update && !equal(data.update.turn, turn)) {
|
||||
setTurn(data.update.turn);
|
||||
@ -154,6 +157,7 @@ const Actions: React.FC<ActionsProps> = ({
|
||||
};
|
||||
|
||||
const changeNameClick = () => {
|
||||
console.log("Actions: changeNameClick called, setting edit to ''");
|
||||
setEdit("");
|
||||
if (buildActive) setBuildActive(false);
|
||||
};
|
||||
@ -274,6 +278,8 @@ const Actions: React.FC<ActionsProps> = ({
|
||||
|
||||
const disableDone = volcanoActive || placeRoad || robberActions || !isTurn || !hasRolled;
|
||||
|
||||
console.log("Actions render: edit =", edit, "name =", name);
|
||||
|
||||
return (
|
||||
<Paper className="Actions">
|
||||
{edit === "" && <PlayerName name={name} setName={setName} />}
|
||||
|
@ -44,6 +44,7 @@ const loadAudio = (src: string) => {
|
||||
};
|
||||
|
||||
const Table: React.FC = () => {
|
||||
console.log("Table component rendered");
|
||||
const params = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [gameId, setGameId] = useState<string | undefined>(params.gameId ? (params.gameId as string) : undefined);
|
||||
@ -84,6 +85,7 @@ const Table: React.FC = () => {
|
||||
|
||||
const onWsOpen = (event: Event) => {
|
||||
console.log(`ws: open`);
|
||||
console.log("WebSocket opened, sending game-update and get");
|
||||
setError("");
|
||||
|
||||
setConnection(ws);
|
||||
@ -107,8 +109,10 @@ const Table: React.FC = () => {
|
||||
}, 3000);
|
||||
break;
|
||||
case "game-update":
|
||||
console.log("Received game-update:", data.update);
|
||||
if (!loaded) {
|
||||
setLoaded(true);
|
||||
console.log("App: setLoaded to true");
|
||||
}
|
||||
console.log(`app - message - ${data.type}`, data.update);
|
||||
|
||||
@ -116,6 +120,7 @@ const Table: React.FC = () => {
|
||||
const priv = data.update.private;
|
||||
if (priv.name !== name) {
|
||||
setName(priv.name);
|
||||
console.log("App: setName from priv.name =", priv.name);
|
||||
}
|
||||
if (priv.color !== color) {
|
||||
setColor(priv.color);
|
||||
@ -126,7 +131,9 @@ const Table: React.FC = () => {
|
||||
if ("name" in data.update) {
|
||||
if (data.update.name) {
|
||||
setName(data.update.name);
|
||||
console.log("App: setName from data.update.name =", data.update.name);
|
||||
} else {
|
||||
console.log("App: data.update.name is empty");
|
||||
setWarning("");
|
||||
setError("");
|
||||
setPriv(undefined);
|
||||
@ -551,6 +558,7 @@ const Table: React.FC = () => {
|
||||
};
|
||||
|
||||
const App: React.FC = () => {
|
||||
console.log("App component rendered");
|
||||
const [playerId, setPlayerId] = useState<string | undefined>(undefined);
|
||||
const [error, setError] = useState<string | undefined>(undefined);
|
||||
|
||||
|
@ -31,7 +31,7 @@ export default defineConfig({
|
||||
https: httpsOption,
|
||||
proxy: {
|
||||
'/ketr.ketran/api': {
|
||||
target: 'http://peddlers-server:8930',
|
||||
target: 'http://peddlers-server:8930/ketr.ketran',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/ketr.ketran/, '')
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ services:
|
||||
- ./db:/db:rw
|
||||
- ./server/routes:/server/routes:ro
|
||||
working_dir: /server
|
||||
environment:
|
||||
- VITE_basePath=/ketr.ketran
|
||||
peddlers-of-ketran-dev:
|
||||
profiles: [dev]
|
||||
container_name: ketr.ketran.dev
|
||||
@ -29,6 +31,7 @@ services:
|
||||
- 8930:8930
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- VITE_basePath=/ketr.ketran
|
||||
networks:
|
||||
- peddlers-network
|
||||
peddlers-client:
|
||||
|
Loading…
x
Reference in New Issue
Block a user