- {post.data.title} -
-- {new Date( - post.data.pubDate, - ).toLocaleDateString("en-US", { - year: "numeric", - month: "long", - day: "numeric", - })} -
-- {post.data.description} -
-From 2ad5ce929f6d69c9aaca71573744b30e02ab8bed Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Fri, 27 Jun 2025 10:10:56 +0200 Subject: Add cloudflare basic impl --- src/components/SimpleTest.tsx | 32 +++++++ src/components/TaskManager.tsx | 202 +++++++++++++++++++++++++++++++++++++++++ src/env.d.ts | 13 +++ src/pages/api/tasks.ts | 66 ++++++++++++++ src/pages/api/tasks/[id].ts | 57 ++++++++++++ src/pages/index.astro | 71 ++------------- 6 files changed, 376 insertions(+), 65 deletions(-) create mode 100644 src/components/SimpleTest.tsx create mode 100644 src/components/TaskManager.tsx create mode 100644 src/env.d.ts create mode 100644 src/pages/api/tasks.ts create mode 100644 src/pages/api/tasks/[id].ts (limited to 'src') diff --git a/src/components/SimpleTest.tsx b/src/components/SimpleTest.tsx new file mode 100644 index 0000000..cfabeab --- /dev/null +++ b/src/components/SimpleTest.tsx @@ -0,0 +1,32 @@ +import { useState } from 'react'; + +export default function SimpleTest() { + const [count, setCount] = useState(0); + + return ( +
This is a simple React component to test if the infinite refresh is caused by the API calls.
++ If this component works without refreshing, the issue is in the TaskManager API calls. +
+Error: {error}
+ +No tasks yet. Create your first task above!
+ ) : ( + tasks.map((task) => ( ++ {task.description} +
+ )} + {task.created_at && ( ++ Created: {new Date(task.created_at).toLocaleString()} +
+ )} +- A modern framework for building fast, content-focused websites. + Powered by Cloudflare Workers and D1 Database
-