Skip to content

Commit

Permalink
a constant to determine whether its in game or launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Aug 10, 2024
1 parent cafd95f commit 493c11a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { sc } from "./utils/sizeScaler";
import { DEBUG_MODE, IN_GAME } from "./constants/app";

const App = () => {
const [loading, setLoading] = useState(true);
const [loading, setLoading] = useState(!IN_GAME);
const [maximized, setMaximized] = useState(false);
const { theme } = useTheme();
const { language, shouldUpdateDiscordStatus } = useGenericPersistentState();
Expand Down
1 change: 1 addition & 0 deletions src/constants/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const VERSION = "4";
export const IN_GAME = process.argv[4] && process.argv[4] == "--ingame";
export const DEBUG_MODE = process.argv[3] && process.argv[3] == "--ompdebug";

type ResourceName =
Expand Down
41 changes: 23 additions & 18 deletions src/containers/WindowTitleBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { images } from "../constants/images";
import { useSettingsModal } from "../states/settingsModal";
import { useTheme } from "../states/theme";
import { sc } from "../utils/sizeScaler";
import { IN_GAME } from "../constants/app";

const NativeWindowTitleBarButtons = ({
size = sc(30),
Expand Down Expand Up @@ -177,24 +178,28 @@ const WindowTitleBar = () => {
}
}}
/>
<CustomWindowTitleBarButtons
title={t("settings")}
image={images.icons.settings}
marginRight={sc(16)}
color={theme.textSecondary}
backgroundColor={theme.itemBackgroundColor}
onPress={() => showSettings()}
/>
<NativeWindowTitleBarButtons
title={t("minimize")}
image={images.icons.windowMinimize}
onPress={() => appWindow.minimize()}
/>
<NativeWindowTitleBarButtons
title={t("maximize")}
image={images.icons.windowMaximize}
onPress={() => appWindow.toggleMaximize()}
/>
{!IN_GAME && (
<>
<CustomWindowTitleBarButtons
title={t("settings")}
image={images.icons.settings}
marginRight={sc(16)}
color={theme.textSecondary}
backgroundColor={theme.itemBackgroundColor}
onPress={() => showSettings()}
/>
<NativeWindowTitleBarButtons
title={t("minimize")}
image={images.icons.windowMinimize}
onPress={() => appWindow.minimize()}
/>
<NativeWindowTitleBarButtons
title={t("maximize")}
image={images.icons.windowMaximize}
onPress={() => appWindow.toggleMaximize()}
/>
</>
)}
<NativeWindowTitleBarButtons
title={t("close")}
image={images.icons.windowClose}
Expand Down

0 comments on commit 493c11a

Please sign in to comment.