= {
- 1836104: "Gruber",
- 1836101: "Darius",
- 1593610: "Arif",
- 1860060: "Rishab",
+ 1836104: "Gruber",
+ 1836101: "Darius",
+ 1593610: "Arif",
+ 1860060: "Rishab",
};
export default function Flatastic() {
- const fetchChores = useFlatasticStore((state) => state.fetch);
- const chores = useFlatasticStore((state) => state.chores);
+ const fetchChores = useFlatasticStore((state) => state.fetch);
+ const chores = useFlatasticStore((state) => state.chores);
- useEffect(() => {
- fetchChores();
- const interval = setInterval(() => {
- fetchChores();
- }, 60000);
- return () => clearInterval(interval);
- }, [fetchChores]);
+ useEffect(() => {
+ fetchChores();
+ const interval = setInterval(() => {
+ fetchChores();
+ }, 60000);
+ return () => clearInterval(interval);
+ }, [fetchChores]);
- return (
-
-
Flatastic Chores
-
- {chores.map((chore: FlatasticChore) => (
- -
- {idToNameMap[chore.currentUser]}: {chore.title} - Points:{" "}
- {chore.points}
-
- ))}
-
-
- );
+ return (
+
+
Flatastic Chores
+
+ {chores.map((chore: FlatasticChore) => (
+ -
+ {idToNameMap[chore.currentUser]}: {chore.title} -
+ Points: {chore.points}
+
+ ))}
+
+
+ );
}
diff --git a/src/components/Timetable/Timetable.tsx b/src/components/Timetable/Timetable.tsx
index 99dd727..56dd10f 100644
--- a/src/components/Timetable/Timetable.tsx
+++ b/src/components/Timetable/Timetable.tsx
@@ -6,52 +6,52 @@ import { useKVVStore } from "@/store/kvv";
import type { DepartureType } from "@/types/departureType";
function parseTimetableData(data: DepartureType[]) {
- const result = data.map((item) => {
- return {
- ...item,
- };
- });
+ const result = data.map((item) => {
+ return {
+ ...item,
+ };
+ });
- return result;
+ return result;
}
export default function Timetable() {
- const fetchTimetable = useKVVStore((state) => state.fetch);
- const pStreet = useKVVStore((state) => state.pStreet);
- const hStreet = useKVVStore((state) => state.hStreet);
+ const fetchTimetable = useKVVStore((state) => state.fetch);
+ const pStreet = useKVVStore((state) => state.pStreet);
+ const hStreet = useKVVStore((state) => state.hStreet);
- useEffect(() => {
- fetchTimetable();
- const interval = setInterval(() => {
- fetchTimetable();
- }, 60000);
- return () => clearInterval(interval);
- }, [fetchTimetable]);
+ useEffect(() => {
+ fetchTimetable();
+ const interval = setInterval(() => {
+ fetchTimetable();
+ }, 60000);
+ return () => clearInterval(interval);
+ }, [fetchTimetable]);
- const hStreetData = parseTimetableData(hStreet.departureList || []);
- const pStreetData = parseTimetableData(pStreet.departureList || []);
+ const hStreetData = parseTimetableData(hStreet.departureList || []);
+ const pStreetData = parseTimetableData(pStreet.departureList || []);
- return (
-
-
Timetable
-
H-Street Departures
-
-
- {hStreetData.map((departure, index) => (
- // biome-ignore lint/suspicious/noArrayIndexKey: there is no id
-
- ))}
-
-
-
P-Street Departures
-
-
- {pStreetData.map((departure, index) => (
- // biome-ignore lint/suspicious/noArrayIndexKey: there is no id
-
- ))}
-
-
-
- );
+ return (
+
+
Timetable
+
H-Street Departures
+
+
+ {hStreetData.map((departure, index) => (
+ // biome-ignore lint/suspicious/noArrayIndexKey: there is no id
+
+ ))}
+
+
+
P-Street Departures
+
+
+ {pStreetData.map((departure, index) => (
+ // biome-ignore lint/suspicious/noArrayIndexKey: there is no id
+
+ ))}
+
+
+
+ );
}
diff --git a/src/components/TimetableRow/TimetableRow.tsx b/src/components/TimetableRow/TimetableRow.tsx
index 94342b1..ac5efa7 100644
--- a/src/components/TimetableRow/TimetableRow.tsx
+++ b/src/components/TimetableRow/TimetableRow.tsx
@@ -3,20 +3,20 @@ import type { DepartureType } from "@/types/departureType";
import styles from "./style.module.css";
export default function TimetableRow({
- departure,
+ departure,
}: {
- departure: DepartureType;
+ departure: DepartureType;
}) {
- const hour = String(departure.dateTime.hour).padStart(2, "0");
- const minute = String(departure.dateTime.minute).padStart(2, "0");
- const dateTimeString = `${hour}:${minute}`;
+ const hour = String(departure.dateTime.hour).padStart(2, "0");
+ const minute = String(departure.dateTime.minute).padStart(2, "0");
+ const dateTimeString = `${hour}:${minute}`;
- return (
-
- | {dateTimeString} |
- {departure.servingLine.name} |
- {departure.servingLine.number} |
- ({departure.servingLine.direction}) |
-
- );
+ return (
+
+ | {dateTimeString} |
+ {departure.servingLine.name} |
+ {departure.servingLine.number} |
+ ({departure.servingLine.direction}) |
+
+ );
}
diff --git a/src/components/TimetableRow/style.module.css b/src/components/TimetableRow/style.module.css
index bf73d63..a6f418f 100644
--- a/src/components/TimetableRow/style.module.css
+++ b/src/components/TimetableRow/style.module.css
@@ -1,3 +1,3 @@
.timetableRow {
- text-align: left;
+ text-align: left;
}
diff --git a/src/index.css b/src/index.css
index e543249..6e2bee0 100644
--- a/src/index.css
+++ b/src/index.css
@@ -1,68 +1,68 @@
:root {
- font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
- line-height: 1.5;
- font-weight: 400;
+ font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
+ line-height: 1.5;
+ font-weight: 400;
- color-scheme: light dark;
- color: rgba(255, 255, 255, 0.87);
- background-color: #242424;
+ color-scheme: light dark;
+ color: rgba(255, 255, 255, 0.87);
+ background-color: #242424;
- font-synthesis: none;
- text-rendering: optimizeLegibility;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
+ font-synthesis: none;
+ text-rendering: optimizeLegibility;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
}
a {
- font-weight: 500;
- color: #646cff;
- text-decoration: inherit;
+ font-weight: 500;
+ color: #646cff;
+ text-decoration: inherit;
}
a:hover {
- color: #535bf2;
+ color: #535bf2;
}
body {
- margin: 0;
- display: flex;
- place-items: center;
- min-width: 320px;
- min-height: 100vh;
+ margin: 0;
+ display: flex;
+ place-items: center;
+ min-width: 320px;
+ min-height: 100vh;
}
h1 {
- font-size: 3.2em;
- line-height: 1.1;
+ font-size: 3.2em;
+ line-height: 1.1;
}
button {
- border-radius: 8px;
- border: 1px solid transparent;
- padding: 0.6em 1.2em;
- font-size: 1em;
- font-weight: 500;
- font-family: inherit;
- background-color: #1a1a1a;
- cursor: pointer;
- transition: border-color 0.25s;
+ border-radius: 8px;
+ border: 1px solid transparent;
+ padding: 0.6em 1.2em;
+ font-size: 1em;
+ font-weight: 500;
+ font-family: inherit;
+ background-color: #1a1a1a;
+ cursor: pointer;
+ transition: border-color 0.25s;
}
button:hover {
- border-color: #646cff;
+ border-color: #646cff;
}
button:focus,
button:focus-visible {
- outline: 4px auto -webkit-focus-ring-color;
+ outline: 4px auto -webkit-focus-ring-color;
}
@media (prefers-color-scheme: light) {
- :root {
- color: #213547;
- background-color: #ffffff;
- }
- a:hover {
- color: #747bff;
- }
- button {
- background-color: #f9f9f9;
- }
+ :root {
+ color: #213547;
+ background-color: #ffffff;
+ }
+ a:hover {
+ color: #747bff;
+ }
+ button {
+ background-color: #f9f9f9;
+ }
}
diff --git a/src/main.tsx b/src/main.tsx
index 48c6758..5f86e7d 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -6,7 +6,7 @@ import App from "./App.tsx";
// biome-ignore lint/style/noNonNullAssertion: if the root element is not found, the app should not render
createRoot(document.getElementById("root")!).render(
-
-
- ,
+
+
+ ,
);
diff --git a/src/store/flatastic.ts b/src/store/flatastic.ts
index 2d9d6d2..f896c0c 100644
--- a/src/store/flatastic.ts
+++ b/src/store/flatastic.ts
@@ -4,26 +4,31 @@ import type { FlatasticChore } from "@/types/flatasticChore";
import { devtools } from "zustand/middleware";
interface FlatasticStore {
- chores: FlatasticChore[];
- fetch: () => Promise;
+ chores: FlatasticChore[];
+ fetch: () => Promise;
}
const useFlatasticStore = create(
- devtools((set) => ({
- chores: [],
- fetch: async () => {
- if (!import.meta.env.VITE_FLATTASTIC_API_KEY) {
- throw new Error("Flatastic API Key is not set");
- }
- const flatastic = new Flatastic(import.meta.env.VITE_FLATTASTIC_API_KEY);
- const data = await flatastic.getTaskList();
+ devtools(
+ (set) => ({
+ chores: [],
+ fetch: async () => {
+ if (!import.meta.env.VITE_FLATTASTIC_API_KEY) {
+ throw new Error("Flatastic API Key is not set");
+ }
+ const flatastic = new Flatastic(
+ import.meta.env.VITE_FLATTASTIC_API_KEY,
+ );
+ const data = await flatastic.getTaskList();
- console.log("Flatastic chores fetched:", data);
- set({ chores: data as FlatasticChore[] });
- },
- }), {
- name: "flatastic-store",
- }),
+ console.log("Flatastic chores fetched:", data);
+ set({ chores: data as FlatasticChore[] });
+ },
+ }),
+ {
+ name: "flatastic-store",
+ },
+ ),
);
export { useFlatasticStore };
diff --git a/src/store/kvv.ts b/src/store/kvv.ts
index 003547a..ed960ad 100644
--- a/src/store/kvv.ts
+++ b/src/store/kvv.ts
@@ -4,30 +4,33 @@ import type { DepartureType } from "@/types/departureType";
import { devtools } from "zustand/middleware";
const useKVVStore = create(
- devtools((set) => ({
- pStreet: [] as DepartureType[],
- hStreet: [] as DepartureType[],
- fetch: async () => {
- const hStreetStopId = 7000044;
- const pStreetStopId = 7000045;
- const hStreetData = await fetchKvvDepartures(hStreetStopId);
- const pStreetData = await fetchKvvDepartures(pStreetStopId);
- const hStreetJson = await hStreetData.json();
- const pStreetJson = await pStreetData.json();
+ devtools(
+ (set) => ({
+ pStreet: [] as DepartureType[],
+ hStreet: [] as DepartureType[],
+ fetch: async () => {
+ const hStreetStopId = 7000044;
+ const pStreetStopId = 7000045;
+ const hStreetData = await fetchKvvDepartures(hStreetStopId);
+ const pStreetData = await fetchKvvDepartures(pStreetStopId);
+ const hStreetJson = await hStreetData.json();
+ const pStreetJson = await pStreetData.json();
- console.log("KVV departures fetched:", {
- hStreet: hStreetJson,
- pStreet: pStreetJson,
- });
+ console.log("KVV departures fetched:", {
+ hStreet: hStreetJson,
+ pStreet: pStreetJson,
+ });
- set({
- hStreet: hStreetJson as DepartureType[],
- pStreet: pStreetJson as DepartureType[],
- });
- },
- }), {
- name: "kvv-store",
- }),
+ set({
+ hStreet: hStreetJson as DepartureType[],
+ pStreet: pStreetJson as DepartureType[],
+ });
+ },
+ }),
+ {
+ name: "kvv-store",
+ },
+ ),
);
export { useKVVStore };
diff --git a/src/types/departureType.ts b/src/types/departureType.ts
index 6b14cfd..1b29ea9 100644
--- a/src/types/departureType.ts
+++ b/src/types/departureType.ts
@@ -1,15 +1,15 @@
export type DepartureType = {
- dateTime: {
- year: number;
- month: number;
- day: number;
- hour: number;
- minute: number;
- };
- servingLine: {
- number: string;
- name: string;
- direction: string;
- };
- stopID: number;
+ dateTime: {
+ year: number;
+ month: number;
+ day: number;
+ hour: number;
+ minute: number;
+ };
+ servingLine: {
+ number: string;
+ name: string;
+ direction: string;
+ };
+ stopID: number;
};
diff --git a/src/types/flatasticChore.ts b/src/types/flatasticChore.ts
index 2a9966e..e5f02eb 100644
--- a/src/types/flatasticChore.ts
+++ b/src/types/flatasticChore.ts
@@ -1,13 +1,13 @@
interface FlatasticChore {
- id: number;
- title: string;
- details: string | null;
- users: Array;
- points: number;
- rotationTime: number;
- currentUser: number;
- lastDoneDate: string;
- timeLeftNext: number;
+ id: number;
+ title: string;
+ details: string | null;
+ users: Array;
+ points: number;
+ rotationTime: number;
+ currentUser: number;
+ lastDoneDate: string;
+ timeLeftNext: number;
}
export type { FlatasticChore };
diff --git a/tsconfig.app.json b/tsconfig.app.json
index 613f1c8..765e41b 100644
--- a/tsconfig.app.json
+++ b/tsconfig.app.json
@@ -1,33 +1,33 @@
{
- "compilerOptions": {
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
- "target": "ES2022",
- "useDefineForClassFields": true,
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
- "module": "ESNext",
- "skipLibCheck": true,
+ "compilerOptions": {
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
+ "target": "ES2022",
+ "useDefineForClassFields": true,
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
+ "module": "ESNext",
+ "skipLibCheck": true,
- /* Bundler mode */
- "moduleResolution": "bundler",
- "allowImportingTsExtensions": true,
- "verbatimModuleSyntax": true,
- "moduleDetection": "force",
- "noEmit": true,
- "jsx": "react-jsx",
- "baseUrl": ".",
- "paths": {
- "@/*": ["src/*"],
- "@components/*": ["src/components/*"],
- "@store/*": ["src/store/*"],
- "@api/*": ["src/api/*"],
- "@types/*": ["src/types/*"],
- "@thunks/*": ["src/store/thunks/*"],
- "@slices/*": ["src/store/slices/*"]
- },
+ /* Bundler mode */
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "verbatimModuleSyntax": true,
+ "moduleDetection": "force",
+ "noEmit": true,
+ "jsx": "react-jsx",
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["src/*"],
+ "@components/*": ["src/components/*"],
+ "@store/*": ["src/store/*"],
+ "@api/*": ["src/api/*"],
+ "@types/*": ["src/types/*"],
+ "@thunks/*": ["src/store/thunks/*"],
+ "@slices/*": ["src/store/slices/*"]
+ },
- /* Linting */
- "strict": true,
- "noUnusedLocals": true
- },
- "include": ["src"]
+ /* Linting */
+ "strict": true,
+ "noUnusedLocals": true
+ },
+ "include": ["src"]
}
diff --git a/tsconfig.json b/tsconfig.json
index e545e51..d13f7ec 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,30 +1,30 @@
{
- "files": [],
- "references": [
- { "path": "./tsconfig.app.json" },
- { "path": "./tsconfig.node.json" }
- ],
- "compilerOptions": {
- "baseUrl": ".",
- "paths": {
- "@/*": ["src/*"],
- "@components/*": ["src/components/*"],
- "@store/*": ["src/store/*"],
- "@api/*": ["src/api/*"],
- "@types/*": ["src/types/*"],
- "@thunks/*": ["src/store/thunks/*"],
- "@slices/*": ["src/store/slices/*"]
- },
- "module": "esnext",
- "moduleResolution": "node",
- "target": "esnext",
- "lib": ["dom", "dom.iterable", "esnext"],
- "jsx": "react-jsx",
- "strict": true,
- "esModuleInterop": true,
- "skipLibCheck": true,
- "forceConsistentCasingInFileNames": true,
- "noEmit": true,
- "resolveJsonModule": true
- }
+ "files": [],
+ "references": [
+ { "path": "./tsconfig.app.json" },
+ { "path": "./tsconfig.node.json" }
+ ],
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["src/*"],
+ "@components/*": ["src/components/*"],
+ "@store/*": ["src/store/*"],
+ "@api/*": ["src/api/*"],
+ "@types/*": ["src/types/*"],
+ "@thunks/*": ["src/store/thunks/*"],
+ "@slices/*": ["src/store/slices/*"]
+ },
+ "module": "esnext",
+ "moduleResolution": "node",
+ "target": "esnext",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "jsx": "react-jsx",
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "noEmit": true,
+ "resolveJsonModule": true
+ }
}
diff --git a/tsconfig.node.json b/tsconfig.node.json
index 1a5ed45..22b15d3 100644
--- a/tsconfig.node.json
+++ b/tsconfig.node.json
@@ -1,25 +1,25 @@
{
- "compilerOptions": {
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
- "target": "ES2023",
- "lib": ["ES2023"],
- "module": "ESNext",
- "skipLibCheck": true,
+ "compilerOptions": {
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
+ "target": "ES2023",
+ "lib": ["ES2023"],
+ "module": "ESNext",
+ "skipLibCheck": true,
- /* Bundler mode */
- "moduleResolution": "bundler",
- "allowImportingTsExtensions": true,
- "verbatimModuleSyntax": true,
- "moduleDetection": "force",
- "noEmit": true,
+ /* Bundler mode */
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "verbatimModuleSyntax": true,
+ "moduleDetection": "force",
+ "noEmit": true,
- /* Linting */
- "strict": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "erasableSyntaxOnly": true,
- "noFallthroughCasesInSwitch": true,
- "noUncheckedSideEffectImports": true
- },
- "include": ["vite.config.ts"]
+ /* Linting */
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "erasableSyntaxOnly": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedSideEffectImports": true
+ },
+ "include": ["vite.config.ts"]
}
diff --git a/vite.config.ts b/vite.config.ts
index 9300e3d..3d421f9 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -4,16 +4,16 @@ import path from "node:path";
// https://vite.dev/config/
export default defineConfig({
- plugins: [react()],
- resolve: {
- alias: {
- "@": path.resolve(__dirname, "src"),
- "@components": path.resolve(__dirname, "src/components"),
- "@store": path.resolve(__dirname, "src/store"),
- "@api": path.resolve(__dirname, "src/api"),
- "@types": path.resolve(__dirname, "src/types"),
- "@thunks": path.resolve(__dirname, "src/store/thunks"),
- "@slices": path.resolve(__dirname, "src/store/slices"),
- },
- },
+ plugins: [react()],
+ resolve: {
+ alias: {
+ "@": path.resolve(__dirname, "src"),
+ "@components": path.resolve(__dirname, "src/components"),
+ "@store": path.resolve(__dirname, "src/store"),
+ "@api": path.resolve(__dirname, "src/api"),
+ "@types": path.resolve(__dirname, "src/types"),
+ "@thunks": path.resolve(__dirname, "src/store/thunks"),
+ "@slices": path.resolve(__dirname, "src/store/slices"),
+ },
+ },
});