diff --git a/app/explore/page.tsx b/app/explore/page.tsx
new file mode 100644
index 0000000..45a9f60
--- /dev/null
+++ b/app/explore/page.tsx
@@ -0,0 +1,8 @@
+'use client';
+import { SearchBox } from "./searchBox";
+
+export default function ExplorePage() {
+ return
-
Bão số 3 Yagi
+ return
+
Bão số 3 Yagi
- Trang chủ
- Thống kê
+ Trang chủ
+ Thống kê
}
\ No newline at end of file
diff --git a/app/page.tsx b/app/page.tsx
deleted file mode 100644
index 50360e8..0000000
--- a/app/page.tsx
+++ /dev/null
@@ -1,118 +0,0 @@
-"use client";
-
-import "./layout.css";
-
-import { useEffect, useState } from "react";
-
-import { Container, Typography } from "@material-ui/core";
-import { NextUIProvider } from "@nextui-org/react";
-
-import type { Row } from "./row";
-
-import { RowSchemaZod } from "./row";
-import TransactionTable from "./TransactionTable";
-
-const packageManagers = {
- bun: "bunx",
- pnpm: "pnpx",
- npm: "npx",
- yarn: "yarn dlx",
-};
-
-const toCacheKey = (index: number) =>
- `mttq0011001932418VCB/${index.toString().padStart(2, "0")}.csv`;
-
-const parseCSV = (csv: string) => {
- const lines = csv.split("\n");
- const headers = lines[0].split(",");
-
- const data = lines.slice(1).map((line) => {
- const obj = {};
- const splittedLine = line.split(",");
- const lineCells = splittedLine
- .slice(0, 5)
- .concat(splittedLine.slice(5).join(","));
-
- lineCells.forEach((value, i) => {
- obj[headers[i]] = value;
- });
- return obj;
- });
- return data;
-};
-
-export default function Home() {
- const [allRows, setAllRows] = useState
>([]);
-
- // load static csv files on page load and cache to local storage
- useEffect(() => {
- // load all 10 csv files in /mttq0011001932418VCB from 01092024.csv to 10092024.csv
- // if some of them are already cached, skip them
- if (typeof window === "undefined") return;
-
- console.log("Start loading data set");
-
- const todos = Array.from({ length: 25 }, (_, i) => i).map((i) => {
- const key = toCacheKey(i);
- if (localStorage.getItem(key)) {
- return Promise.resolve(parseCSV(localStorage.getItem(key)));
- } else {
- return fetch(`/${key}`)
- .then((res) => res.text())
- .then((data) => {
- if (i < 5) {
- localStorage.setItem(key, data);
- console.log(`Fetched and cached ${key}`, data);
- }
-
- return parseCSV(data);
- });
- // .catch((err) => console.error(`Failed to fetch ${key}: `, err));
- }
- });
-
- if (todos.length === 0) return;
- Promise.all(todos).then((res) => {
- const rows = res
- .reduce((acc, val) => acc.concat(val), [])
- .map((row, i) => ({
- id: i,
- ...row,
- }));
-
- console.log(rows.slice(0, 20));
- setAllRows(
- rows
- .map((row) => RowSchemaZod.safeParse(row))
- .filter((r) => r.success)
- .map((r) => r.data),
- );
- console.log("All csv files loaded");
- });
- }, []);
-
- return (
-
-
-
-
-
- Tra cứu thông tin sao kê từ thiện
-
-
-
-
- {/* */}
-