diff --git a/package-lock.json b/package-lock.json
index a53e2ff..28164de 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,6 +9,7 @@
"version": "0.1.0",
"dependencies": {
"@heroicons/react": "^2.0.18",
+ "@prisma/client": "^5.6.0",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-scroll-area": "^1.0.5",
"@radix-ui/react-select": "^2.0.0",
@@ -17,6 +18,7 @@
"next": "14.0.2",
"react": "^18",
"react-dom": "^18",
+ "swr": "^2.2.4",
"tailwind-merge": "^2.0.0"
},
"devDependencies": {
@@ -427,6 +429,31 @@
"node": ">= 8"
}
},
+ "node_modules/@prisma/client": {
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.6.0.tgz",
+ "integrity": "sha512-mUDefQFa1wWqk4+JhKPYq8BdVoFk9NFMBXUI8jAkBfQTtgx8WPx02U2HB/XbAz3GSUJpeJOKJQtNvaAIDs6sug==",
+ "hasInstallScript": true,
+ "dependencies": {
+ "@prisma/engines-version": "5.6.0-32.e95e739751f42d8ca026f6b910f5a2dc5adeaeee"
+ },
+ "engines": {
+ "node": ">=16.13"
+ },
+ "peerDependencies": {
+ "prisma": "*"
+ },
+ "peerDependenciesMeta": {
+ "prisma": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@prisma/engines-version": {
+ "version": "5.6.0-32.e95e739751f42d8ca026f6b910f5a2dc5adeaeee",
+ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.6.0-32.e95e739751f42d8ca026f6b910f5a2dc5adeaeee.tgz",
+ "integrity": "sha512-UoFgbV1awGL/3wXuUK3GDaX2SolqczeeJ5b4FVec9tzeGbSWJboPSbT0psSrmgYAKiKnkOPFSLlH6+b+IyOwAw=="
+ },
"node_modules/@radix-ui/number": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.0.1.tgz",
@@ -4642,6 +4669,18 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/swr": {
+ "version": "2.2.4",
+ "resolved": "https://registry.npmjs.org/swr/-/swr-2.2.4.tgz",
+ "integrity": "sha512-njiZ/4RiIhoOlAaLYDqwz5qH/KZXVilRLvomrx83HjzCWTfa+InyfAjv05PSFxnmLzZkNO9ZfvgoqzAaEI4sGQ==",
+ "dependencies": {
+ "client-only": "^0.0.1",
+ "use-sync-external-store": "^1.2.0"
+ },
+ "peerDependencies": {
+ "react": "^16.11.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/tailwind-merge": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.0.0.tgz",
@@ -4986,6 +5025,14 @@
}
}
},
+ "node_modules/use-sync-external-store": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz",
+ "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==",
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
diff --git a/package.json b/package.json
index bd18dcd..634bbc8 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
"dependencies": {
"@heroicons/react": "^2.0.18",
"@radix-ui/react-icons": "^1.3.0",
+ "@prisma/client": "^5.6.0",
"@radix-ui/react-scroll-area": "^1.0.5",
"@radix-ui/react-select": "^2.0.0",
"clsx": "^2.0.0",
@@ -18,7 +19,8 @@
"next": "14.0.2",
"react": "^18",
"react-dom": "^18",
- "tailwind-merge": "^2.0.0"
+ "tailwind-merge": "^2.0.0",
+ "swr": "^2.2.4"
},
"devDependencies": {
"@types/node": "^20",
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
new file mode 100644
index 0000000..32acbca
--- /dev/null
+++ b/prisma/schema.prisma
@@ -0,0 +1,18 @@
+generator client {
+ provider = "prisma-client-js"
+}
+
+datasource db {
+ provider = "sqlite"
+ url = "file:./dev.db"
+}
+
+model Article {
+ id Int @id @default(autoincrement())
+ title String
+ slug String
+ url String
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ siteKey String
+}
diff --git a/src/app/globals.css b/src/app/globals.css
index 995bab6..960f26d 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -3,80 +3,74 @@
@tailwind utilities;
@layer base {
- :root {
- --background: 0 0% 100%;
- --foreground: 222.2 84% 4.9%;
+ :root {
+ --background: 0 0% 100%;
+ --foreground: 222.2 84% 4.9%;
- --card: 0 0% 100%;
- --card-foreground: 222.2 84% 4.9%;
+ --card: 0 0% 100%;
+ --card-foreground: 222.2 84% 4.9%;
- --popover: 0 0% 100%;
- --popover-foreground: 222.2 84% 4.9%;
+ --popover: 0 0% 100%;
+ --popover-foreground: 222.2 84% 4.9%;
- --primary: 136, 87%, 83%;
- --primary-foreground: black;
+ --primary: 136, 87%, 83%;
+ --primary-foreground: black;
- --secondary: 169 46% 37%;
- --secondary-foreground: 222.2 47.4% 11.2%;
+ --secondary: 169 46% 37%;
+ --secondary-foreground: 222.2 47.4% 11.2%;
- --muted: 0 0% 32%;
- --muted-foreground: 0 0% 32%;
+ --muted: 0 0% 32%;
+ --muted-foreground: 0 0% 32%;
- --accent: 210 40% 96.1%;
- --accent-foreground: 222.2 47.4% 11.2%;
+ --accent: 210 40% 96.1%;
+ --accent-foreground: 222.2 47.4% 11.2%;
- --destructive: 0 84.2% 60.2%;
- --destructive-foreground: 210 40% 98%;
+ --destructive: 0 84.2% 60.2%;
+ --destructive-foreground: 210 40% 98%;
- --border: 0 0% 32%;
- --input: 0 0% 32%;
- --ring: 222.2 84% 4.9%;
+ --border: 0 0% 32%;
+ --input: 0 0% 32%;
+ --ring: 222.2 84% 4.9%;
- --radius: 0.5rem;
- }
+ --radius: 0.5rem;
+ }
- .dark {
- --background: 222.2 84% 4.9%;
- --foreground: 210 40% 98%;
+ .dark {
+ --background: 222.2 84% 4.9%;
+ --foreground: 210 40% 98%;
- --card: 222.2 84% 4.9%;
- --card-foreground: 210 40% 98%;
+ --card: 222.2 84% 4.9%;
+ --card-foreground: 210 40% 98%;
- --popover: 222.2 84% 4.9%;
- --popover-foreground: 210 40% 98%;
+ --popover: 222.2 84% 4.9%;
+ --popover-foreground: 210 40% 98%;
- --primary: 210 40% 98%;
- --primary-foreground: 222.2 47.4% 11.2%;
+ --primary: 210 40% 98%;
+ --primary-foreground: 222.2 47.4% 11.2%;
- --secondary: 217.2 32.6% 17.5%;
- --secondary-foreground: 210 40% 98%;
+ --secondary: 217.2 32.6% 17.5%;
+ --secondary-foreground: 210 40% 98%;
- --muted: 217.2 32.6% 17.5%;
- --muted-foreground: 215 20.2% 65.1%;
+ --muted: 217.2 32.6% 17.5%;
+ --muted-foreground: 215 20.2% 65.1%;
- --accent: 217.2 32.6% 17.5%;
- --accent-foreground: 210 40% 98%;
+ --accent: 217.2 32.6% 17.5%;
+ --accent-foreground: 210 40% 98%;
- --destructive: 0 62.8% 30.6%;
- --destructive-foreground: 210 40% 98%;
+ --destructive: 0 62.8% 30.6%;
+ --destructive-foreground: 210 40% 98%;
- --border: 217.2 32.6% 17.5%;
- --input: 217.2 32.6% 17.5%;
- --ring: 212.7 26.8% 83.9%;
- }
+ --border: 217.2 32.6% 17.5%;
+ --input: 217.2 32.6% 17.5%;
+ --ring: 212.7 26.8% 83.9%;
+ }
}
@layer base {
- * {
- @apply border-border;
- }
- body {
- @apply bg-background text-foreground;
- }
-}
-
-main astro-island {
- display: flex;
- flex-direction: column;
- height: 100vh;
+ * {
+ @apply border-border;
+ }
+ body {
+ @apply bg-background text-foreground;
+ }
}
diff --git a/src/app/page.tsx b/src/app/page.tsx
index d141f6f..ff44935 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -1,22 +1,25 @@
-import {redirect} from "next/navigation"
-import { headers } from 'next/headers'
-import Feed from "@/components/Feed"
-import SearchBar from "@/components/SearchBar"
+import { redirect } from "next/navigation";
+import { headers } from "next/headers";
+import Feed from "@/components/Feed";
+import SearchBar from "@/components/SearchBar";
+import { fetchFeedData } from "@/lib/feed.ts";
type Props = {
- searchParams?: {
- q?: string | undefined
- };
-}
+ searchParams?: {
+ q?: string | undefined;
+ };
+};
-export default function Home({searchParams}: Props) {
- const headerList = headers()
- const referer = headerList.get("referer")
+export default async function Home({ searchParams }: Props) {
+ const headerList = headers();
+ const referer = headerList.get("referer");
- if(!referer && searchParams?.q) {
- redirect(`/search?q=${searchParams.q}`)
+ if (!referer && searchParams?.q) {
+ redirect(`/search?q=${searchParams.q}`);
}
-
+
+ const data = await fetchFeedData({});
+
return (
<>
- {item.content} + {item.title}
- ) + ); })} - {dataResponse?.next ? : null} + {dataResponse?.next ? ( + + ) : null}