diff options
| -rw-r--r-- | server/data/startDate.ts | 1 | ||||
| -rw-r--r-- | server/index.ts | 5 | ||||
| -rw-r--r-- | src/components/Player/index.tsx | 2 | ||||
| -rw-r--r-- | src/helpers/fetchInfo.ts | 9 | ||||
| -rw-r--r-- | src/helpers/scoreToEmoji.ts | 4 |
5 files changed, 2 insertions, 19 deletions
diff --git a/server/data/startDate.ts b/server/data/startDate.ts deleted file mode 100644 index bb49bfe..0000000 --- a/server/data/startDate.ts +++ /dev/null @@ -1 +0,0 @@ -export const startDate = new Date('6/3/2026'); diff --git a/server/index.ts b/server/index.ts index 54b3c18..c223861 100644 --- a/server/index.ts +++ b/server/index.ts @@ -1,6 +1,5 @@ import express from 'express'; import { songs } from './data/songs'; -import { startDate } from './data/startDate'; import cors from 'cors'; import dotenv from 'dotenv'; dotenv.config(); @@ -63,9 +62,5 @@ app.get('/songs', (_req, res) => { res.json(songs.map(({ artist, name }) => ({ artist, name }))); }); -app.get('/info', (_req, res) => { - res.json({ startDate: startDate.toISOString() }); -}); - app.listen(SERVER_PORT, () => console.log(`Server running on :${SERVER_PORT}`)); diff --git a/src/components/Player/index.tsx b/src/components/Player/index.tsx index e4dfd9e..6a947d4 100644 --- a/src/components/Player/index.tsx +++ b/src/components/Player/index.tsx @@ -20,7 +20,7 @@ export function Player({ currentTry }: Props) { const [isReady, setIsReady] = React.useState(false); const CDN_URL = - import.meta.env.VITE_CDN_URL || "https://yena.pinapelz.com/kheardle"; + import.meta.env.VITE_CDN_URL || "localhost"; const dateString = new Date().toISOString().split("T")[0]; diff --git a/src/helpers/fetchInfo.ts b/src/helpers/fetchInfo.ts deleted file mode 100644 index 15cf963..0000000 --- a/src/helpers/fetchInfo.ts +++ /dev/null @@ -1,9 +0,0 @@ - -import { Info } from "../types/info"; - -export const fetchInfo = async (): Promise<Info> => { - const API_URL = import.meta.env.VITE_APP_HEARDLE_API_URL || "http://localhost:3000"; - const response = await fetch(`${API_URL}/info`); - const data = await response.json(); - return data as Info; -}; diff --git a/src/helpers/scoreToEmoji.ts b/src/helpers/scoreToEmoji.ts index 5af1026..af19194 100644 --- a/src/helpers/scoreToEmoji.ts +++ b/src/helpers/scoreToEmoji.ts @@ -1,12 +1,10 @@ import { GuessType, GuessState } from "../types/guess"; import { appName } from "../constants"; -import { fetchInfo } from "./fetchInfo"; export async function scoreToEmoji(guesses: GuessType[]): Promise<string> { const msInDay = 86400000; const todaysDate = new Date(); - const info = await fetchInfo(); - const startDate = new Date(info.startDate); + const startDate = new Date(import.meta.env.VITE_START_DATE); const index = Math.floor((todaysDate.getTime() - startDate.getTime() )/msInDay) + 1 const emojis = { incorrect: "🟥", |
