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