Skip to content

Commit

Permalink
Fix the button to allow player to view private games + remove legacy …
Browse files Browse the repository at this point in the history
…button
  • Loading branch information
PvtVoid committed May 3, 2024
1 parent 9bef915 commit 488e2ec
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/app/ParseGameState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function ParseEquipment(input: any) {

export default function ParseGameState(input: any) {
const result: GameState = {
gameInfo: { gameID: 0, playerID: 0, authKey: '', isPrivate: false },
gameInfo: { gameID: 0, playerID: 0, authKey: '', isPrivateLobby: false },
gameDynamicInfo: {},
playerOne: {},
playerTwo: {},
Expand Down
2 changes: 1 addition & 1 deletion src/features/GameStaticInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default interface GameStaticInfo {
gameID: number;
playerID: number;
authKey: string;
isPrivate: boolean;
isPrivateLobby: boolean;
roguelikeGameID?: number;
altArts?: AltArt[];
isRoguelike?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/features/game/GameSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ export const gameSlice = createSlice({
state.isUpdateInProgress = false;
state.isPlayerInputInProgress = false;

state.gameInfo.isPrivate =
action.payload.isPrivateLobby ?? state.gameInfo.isPrivate;
state.gameInfo.isPrivateLobby =
action.payload.isPrivateLobby ?? state.gameInfo.isPrivateLobby;
state.gameDynamicInfo.lastUpdate = action.payload.lastUpdate;
state.chatLog = action.payload.gameLog?.split('<br>');
state.playerTwo.Name = action.payload.theirName;
Expand Down
16 changes: 8 additions & 8 deletions src/routes/game/components/elements/optionsMenu/OptionsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import OptionsSettings from './OptionsSettings';
import { shallowEqual } from 'react-redux';

const OptionsContent = () => {
const { gameID, playerID, isPrivate } = useAppSelector(
const { gameID, playerID, isPrivateLobby } = useAppSelector(
getGameInfo,
shallowEqual
);
const dispatch = useAppDispatch();
const navigate = useNavigate();
const [allowSpectator, setAllowSpectator] = useState(false);

const gameURL = `http://fe.talishar.net/game/play/${gameID}`;
const gameURL = `http://talishar.net/game/play/${gameID}`;

const clickCloseOptionsHandler = () => {
dispatch(closeOptionsMenu());
Expand All @@ -38,11 +38,11 @@ const OptionsContent = () => {
dispatch(submitButton({ button: { mode: PROCESS_INPUT.CONCEDE_GAME } }));
};

const clickPlayLegacyHandler = async (e: React.MouseEvent) => {
/* const clickPlayLegacyHandler = async (e: React.MouseEvent) => {
e.preventDefault;
await screenfull.exit();
window.location.href = `https://legacy.talishar.net/game/NextTurn4.php?gameName=${gameID}&playerID=${playerID}`;
};
}; */

// going to main menu means you concede the game
const handleClickMainMenuButton = async (e: React.MouseEvent) => {
Expand Down Expand Up @@ -110,9 +110,9 @@ const OptionsContent = () => {
<div className={styles.column}>
<h3>Navigation</h3>
<div className={styles.buttonColumn}>
<button className={styles.buttonDiv} onClick={clickPlayLegacyHandler}>
{/*<button className={styles.buttonDiv} onClick={clickPlayLegacyHandler}>
Legacy Talishar Client
</button>
</button> */}
<button
className={styles.buttonDiv}
onClick={handleClickMainMenuButton}
Expand Down Expand Up @@ -164,7 +164,7 @@ const OptionsContent = () => {
</div>
<h3>Invite Spectators</h3>
<div className={styles.buttonColumn}>
{isPrivate && allowSpectator ? (
{isPrivateLobby && !allowSpectator ? (
<>
<button
style={{ marginTop: '0.5em' }}
Expand All @@ -181,7 +181,7 @@ const OptionsContent = () => {
className={styles.buttonDiv}
onClick={clickCopySpectateToClipboardHandler}
>
Copy Spectate Link
<FaLink />&nbsp;Copy Spectate Link
</button>
</>
)}
Expand Down

0 comments on commit 488e2ec

Please sign in to comment.