Skip to content

Commit 9c36d84

Browse files
committed
BREAKING CHANGE: Add license and disclaimer to first start
1 parent e7b4967 commit 9c36d84

File tree

2 files changed

+128
-49
lines changed

2 files changed

+128
-49
lines changed

src/App.tsx

Lines changed: 108 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
POKER_SETTINGS_STATE,
1111
SETTINGS_STATE,
1212
} from "@/Root";
13-
import { AppShell, Container, Divider, Modal, Text, useMantineTheme } from "@mantine/core";
13+
import { AppShell, Container, Divider, Modal, Text, Title, useMantineTheme } from "@mantine/core";
1414
import { useEffect, useState } from "react";
1515
import { atom, useRecoilState } from "recoil";
1616
import { TAURI_STORE } from "./Root";
@@ -27,6 +27,8 @@ import { useHotkeys } from "react-hotkeys-hook";
2727
import { notifications } from "@mantine/notifications";
2828
import TouchscreenMenu from "./components/TouchscreenMenu";
2929
import ChipBreakdown, { CHIP_BREAKDOWN_OPEN } from "./components/ChipBreakdown";
30+
import { useLocalStorage } from "@mantine/hooks";
31+
import { modals } from "@mantine/modals";
3032

3133
export const HOTKEY_SELECTOR_A_ENABLED = atom({
3234
key: "hotkeySelectorA",
@@ -65,6 +67,61 @@ export default function App() {
6567
const [chips] = useRecoilState(CHIPS_STATE);
6668
const [chipsLastSaved, setChipsLastSaved] = useState(0);
6769

70+
const [firstTime, setFirstTime] = useLocalStorage({
71+
key: "first-time",
72+
defaultValue: true,
73+
});
74+
75+
if (firstTime) {
76+
modals.openConfirmModal({
77+
title: "Notice",
78+
size: "xl",
79+
children: (
80+
<>
81+
<Title order={3}>License</Title>
82+
<Text>
83+
Card Games Manager is NOT free software. All rights reserved. This project is not open
84+
source. You may not use, modify, or distribute this project without explicit permission
85+
from the creator. Licenses may be purchased for commercial uses. Please contact the
86+
creator for more information.
87+
</Text>
88+
<Title mt="sm" order={3}>
89+
Disclaimer
90+
</Title>
91+
<Text>
92+
This tool is intended for entertainment purposes only and does not endorse or promote
93+
gambling. The use of this tool for gambling, especially where money is involved, is
94+
strictly prohibited and may be illegal in certain jurisdictions. The creators of this
95+
tool are not responsible for any misuse or illegal activities associated with its use.
96+
Please use this tool responsibly and in accordance with applicable laws and regulations.
97+
Additionally, this tool should not be the single source of truth for any card games. It
98+
is recommended to use physical cards or other trusted sources to verify the results of
99+
any games played with this tool. Any random number generation in this tool is not
100+
guaranteed to be truly random and should not be used for any serious or high-stakes
101+
games. This tool is provided as-is and without any warranty. The creators of this tool
102+
are not responsible for any damages or losses incurred from the use of this tool.
103+
</Text>
104+
<Divider my="sm" />
105+
<Text>
106+
By clicking "I agree" you acknowledge that you have read and agree to the terms and
107+
conditions outlined in the license and disclaimer above. If you do not agree to these
108+
terms, please close this window and do not use this tool. If you have previously agreed,
109+
you can not revoke your agreement. To view this notice again, scroll to the buttom of
110+
the Settings page. You can email the creator at auro@mrauro.dev
111+
</Text>
112+
</>
113+
),
114+
labels: { confirm: "I Agree", cancel: "I Disagree" },
115+
onConfirm: () => {
116+
setFirstTime(false);
117+
modals.closeAll();
118+
},
119+
onCancel: async () => {
120+
window.close();
121+
},
122+
});
123+
}
124+
68125
const [chipBreakdownOpen, setChipBreakdownOpen] = useRecoilState(CHIP_BREAKDOWN_OPEN);
69126

70127
const [hotkeySelectorAEnabled, setHotkeySelectorAEnabled] =
@@ -300,52 +357,54 @@ export default function App() {
300357
}
301358
}
302359

303-
return (
304-
<>
305-
<Modal
306-
title="Chip Breakdown"
307-
opened={chipBreakdownOpen}
308-
onClose={() => setChipBreakdownOpen(false)}
309-
>
310-
<ChipBreakdown />
311-
</Modal>
312-
<AppShell
313-
aside={{
314-
width: asideWidth,
315-
breakpoint: 0,
316-
}}
317-
navbar={{
318-
width: navbarWidth,
319-
breakpoint: 0,
320-
}}
321-
>
322-
<AppShell.Main>
323-
<Header
324-
active={settings.activeTab}
325-
setActive={(tab) => {
326-
setSettings({ ...settings, activeTab: tab });
327-
}}
328-
/>
329-
<Divider my="xs" />
330-
{settings.debug ? (
331-
<>
332-
<DevTools />
333-
<Divider my="xs" />
334-
</>
335-
) : null}
336-
<Container>{content}</Container>
337-
</AppShell.Main>
338-
{settings?.touchscreenMenu &&
339-
(settings?.touchscreenMenuPosition == "left" ? (
340-
<AppShell.Navbar>
341-
<TouchscreenMenu />
342-
</AppShell.Navbar>
343-
) : (
344-
<AppShell.Aside>
345-
<TouchscreenMenu />
346-
</AppShell.Aside>
347-
))}
348-
</AppShell>
349-
</>
350-
);
360+
if (firstTime) return null;
361+
else
362+
return (
363+
<>
364+
<Modal
365+
title="Chip Breakdown"
366+
opened={chipBreakdownOpen}
367+
onClose={() => setChipBreakdownOpen(false)}
368+
>
369+
<ChipBreakdown />
370+
</Modal>
371+
<AppShell
372+
aside={{
373+
width: asideWidth,
374+
breakpoint: 0,
375+
}}
376+
navbar={{
377+
width: navbarWidth,
378+
breakpoint: 0,
379+
}}
380+
>
381+
<AppShell.Main>
382+
<Header
383+
active={settings.activeTab}
384+
setActive={(tab) => {
385+
setSettings({ ...settings, activeTab: tab });
386+
}}
387+
/>
388+
<Divider my="xs" />
389+
{settings.debug ? (
390+
<>
391+
<DevTools />
392+
<Divider my="xs" />
393+
</>
394+
) : null}
395+
<Container>{content}</Container>
396+
</AppShell.Main>
397+
{settings?.touchscreenMenu &&
398+
(settings?.touchscreenMenuPosition == "left" ? (
399+
<AppShell.Navbar>
400+
<TouchscreenMenu />
401+
</AppShell.Navbar>
402+
) : (
403+
<AppShell.Aside>
404+
<TouchscreenMenu />
405+
</AppShell.Aside>
406+
))}
407+
</AppShell>
408+
</>
409+
);
351410
}

src/pages/Settings/index.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,35 @@ import GeneralSettings from "./components/GeneralSettings";
22
import PokerSettings from "./components/PokerSettings";
33
import BlackjackSettings from "./components/BlackjackSettings";
44
import { Divider } from "@mantine/core";
5+
import { useLocalStorage } from "@mantine/hooks";
6+
import { Text } from "@mantine/core";
57

68
export default function Settings() {
9+
const [firstTime, setFirstTime] = useLocalStorage({
10+
key: "first-time",
11+
defaultValue: true,
12+
});
13+
714
return (
815
<>
916
<GeneralSettings />
1017
<Divider my="sm" />
1118
<BlackjackSettings />
1219
<Divider my="sm" />
1320
<PokerSettings />
21+
<Divider my="sm" />
22+
{!firstTime && (
23+
<Text
24+
mb="md"
25+
style={{
26+
cursor: "pointer",
27+
}}
28+
onClick={() => setFirstTime(true)}
29+
>
30+
You have agreed to the Terms of Service. Click to view again (this will NOT void your
31+
agreement, it's just for your reference).
32+
</Text>
33+
)}
1434
</>
1535
);
1636
}

0 commit comments

Comments
 (0)