diff --git a/src/App.tsx b/src/App.tsx index 53aa1ec..9e342e8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,6 +8,7 @@ import Legend from "./components/Legend"; import QRCode from "./components/QRCode"; import { WaffleChart } from "./components/WaffleChart"; +import { config } from "./config"; import { getSampleData } from "./lib/data"; import "./styles/App.scss"; @@ -20,7 +21,7 @@ function App() { queryKey: ["responses"], // queryFn: fetchGoogleSheet, queryFn: getSampleData, - refetchInterval: 1 * 1000, // Refresh every 5 seconds + refetchInterval: config.refreshIntervalSeconds * 1000, }); if (metadataQuery.isPending || responseQuery.isPending) diff --git a/src/config.ts b/src/config.ts index 7c5fefc..ad31c61 100644 --- a/src/config.ts +++ b/src/config.ts @@ -11,6 +11,7 @@ export const config = { chartHeight: 50, dotShape: "rect", // "circle" or "rect" renderXAxis: true, // Whether to render the x-axis + refreshIntervalSeconds: 1, // Refresh interval for response data in seconds }; // Color scheme for Likert scale responses diff --git a/src/lib/data.ts b/src/lib/data.ts index 4027c80..0240def 100644 --- a/src/lib/data.ts +++ b/src/lib/data.ts @@ -22,8 +22,5 @@ export async function getSampleData(): Promise { }); }); } - // Simulate a delay to mimic fetching actual data - return new Promise((resolve) => { - setTimeout(() => resolve(sampleData), 500); - }); + return Promise.resolve(sampleData); }