Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 941ae29

Browse files
committed
feat: add error diagnostics
1 parent 9e7d635 commit 941ae29

File tree

5 files changed

+104
-18
lines changed

5 files changed

+104
-18
lines changed

apps/client/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "client",
3-
"version": "1.7.1-beta",
3+
"version": "1.7.2-beta",
44
"scripts": {
55
"dev": "npm-run-all --parallel dev:*",
66
"dev:run": "FORCE_COLOR=1 vite",
@@ -26,6 +26,7 @@
2626
"@emotion/styled": "^11.8.1",
2727
"@fontsource/poppins": "^4.5.8",
2828
"@formspree/react": "^2.4.1",
29+
"@highlight-run/react": "^3.2.1",
2930
"@nikolovlazar/chakra-ui-prose": "^1.2.1",
3031
"@rollup/plugin-replace": "^4.0.0",
3132
"@tanstack/query-sync-storage-persister": "^4.0.10",
@@ -37,6 +38,7 @@
3738
"dayzed": "^3.2.3",
3839
"dompurify": "^2.4.0",
3940
"framer-motion": "^10.12.18",
41+
"highlight.run": "^7.4.0",
4042
"immer": "^9.0.19",
4143
"jsbarcode": "^3.11.5",
4244
"linkify-html": "^4.0.2",

apps/client/src/main.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,22 @@ import { createRouter } from "./createRouter";
1515
import { persister, queryClient } from "./createQueryClient";
1616
import { authActions, useAuthStore } from "./stores/auth";
1717
import { useSettingsStore } from "./stores/settings";
18+
import { H } from "highlight.run";
19+
import { version } from "../package.json";
1820

1921
// Redirect to new domain if using old domain
2022
if (window.location.host === "timetabl.vercel.app") {
2123
window.location.href = "https://www.timetabl.app";
2224
}
2325

26+
// Initialise analytics if consented
27+
if (localStorage.getItem("consentedToWelcomeMessage")) {
28+
H.init("zg092lg9", {
29+
enableStrictPrivacy: true,
30+
version,
31+
});
32+
}
33+
2434
// ===========
2535
// RENDER ROOT
2636
// ===========
Lines changed: 70 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
import { useEffect } from "react";
22
import { Outlet, useNavigate } from "react-router-dom";
3-
import { Flex, useBreakpointValue } from "@chakra-ui/react";
3+
import {
4+
Flex,
5+
useBreakpointValue,
6+
useDisclosure,
7+
Modal,
8+
ModalOverlay,
9+
ModalContent,
10+
ModalHeader,
11+
ModalFooter,
12+
ModalBody,
13+
ModalCloseButton,
14+
Button,
15+
Heading,
16+
} from "@chakra-ui/react";
417
import Sidebar from "../../components/Sidebar";
518
import { BottomNav } from "../../components/BottomNav";
619
import { useIsLoggedIn } from "../../stores/auth";
@@ -9,34 +22,75 @@ export default function Main() {
922
const navigate = useNavigate();
1023
const loggedIn = useIsLoggedIn();
1124
const isLargerThanMd = useBreakpointValue({ base: false, md: true });
25+
const { isOpen, onOpen } = useDisclosure();
1226

1327
useEffect(() => {
1428
if (!loggedIn) {
1529
navigate("/");
1630
}
1731
}, [loggedIn, navigate]);
1832

33+
useEffect(() => {
34+
if (!localStorage.getItem("consentedToWelcomeMessage")) {
35+
onOpen();
36+
}
37+
});
38+
39+
const consent = () => {
40+
localStorage.setItem("consentedToWelcomeMessage", "true");
41+
window.location.reload(); // We reload instead of just closing the dialog so that the analytics can be initialised
42+
};
43+
1944
return (
20-
<Flex
21-
align={"center"}
22-
width={"full"}
23-
height={"full"}
24-
direction={{ base: "column-reverse", md: "row" }}
25-
>
26-
{isLargerThanMd ? <Sidebar /> : <BottomNav />}
45+
<>
2746
<Flex
28-
direction={"column"}
2947
align={"center"}
3048
width={"full"}
3149
height={"full"}
32-
maxH={{ base: "calc(100% - 64px)", md: "100%" }}
33-
mb={{ base: "64px", md: 0 }}
34-
maxW={{ base: "100%", md: "calc(100% - 100px)" }}
35-
ml={{ base: 0, md: "100px" }}
36-
overflowY={"auto"}
50+
direction={{ base: "column-reverse", md: "row" }}
3751
>
38-
<Outlet />
52+
{isLargerThanMd ? <Sidebar /> : <BottomNav />}
53+
<Flex
54+
direction={"column"}
55+
align={"center"}
56+
width={"full"}
57+
height={"full"}
58+
maxH={{ base: "calc(100% - 64px)", md: "100%" }}
59+
mb={{ base: "64px", md: 0 }}
60+
maxW={{ base: "100%", md: "calc(100% - 100px)" }}
61+
ml={{ base: 0, md: "100px" }}
62+
overflowY={"auto"}
63+
>
64+
<Outlet />
65+
</Flex>
66+
<Modal closeOnOverlayClick={false} isOpen={isOpen} onClose={consent}>
67+
<ModalOverlay />
68+
<ModalContent>
69+
<ModalHeader fontFamily="Poppins, sans-serif">
70+
Welcome to Timetabl!
71+
</ModalHeader>
72+
<ModalCloseButton />
73+
<ModalBody pb={6}>
74+
<Heading size="xs" pb={4} fontWeight="regular">
75+
By continuing, you consent to Timetabl sending anonymous error
76+
diagnostics and usage metrics.
77+
</Heading>
78+
Timetabl is a blazing fast, offline-enabled, installable timetable
79+
app for Sydney Boys High School, made by Hamzah Ahmed. It is
80+
currently in beta, meaning that some features may not work as
81+
expected and there may be bugs. It is in active development, with
82+
new features being added and bugs being fixed regularly. If there
83+
is a feature you&apos;d like to see, or a bug that needs to be
84+
fixed, send feedback by clicking on Feedback in the left panel on
85+
desktop or by clicking on More {">"} Feedback on mobile.
86+
</ModalBody>
87+
88+
<ModalFooter>
89+
<Button onClick={consent}>Continue</Button>
90+
</ModalFooter>
91+
</ModalContent>
92+
</Modal>
3993
</Flex>
40-
</Flex>
94+
</>
4195
);
4296
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "timetabl",
3-
"version": "1.7.1-beta",
3+
"version": "1.7.2-beta",
44
"author": "Hamzah Ahmed",
55
"license": "MIT",
66
"bugs": {

pnpm-lock.yaml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)