simo 3 tuần trước cách đây
mục cha
commit
76f3ca353c
8 tập tin đã thay đổi với 141 bổ sung20 xóa
  1. 4 2
      astro.config.mjs
  2. 2 1
      package.json
  3. 36 0
      pnpm-lock.yaml
  4. 63 0
      src/components/nav.astro
  5. 22 0
      src/layouts/layout.astro
  6. 6 0
      src/pages/[...cat].astro
  7. 0 16
      src/pages/index.astro
  8. 8 1
      tsconfig.json

+ 4 - 2
astro.config.mjs

@@ -1,5 +1,7 @@
 // @ts-check
-import { defineConfig } from 'astro/config';
+import { defineConfig } from "astro/config";
 
 // https://astro.build/config
-export default defineConfig({});
+export default defineConfig({
+  output: "server",
+});

+ 2 - 1
package.json

@@ -9,6 +9,7 @@
     "astro": "astro"
   },
   "dependencies": {
-    "astro": "^5.15.5"
+    "astro": "^5.15.5",
+    "rss-parser": "^3.13.0"
   }
 }

+ 36 - 0
pnpm-lock.yaml

@@ -11,6 +11,9 @@ importers:
       astro:
         specifier: ^5.15.5
         version: 5.15.5(@types/node@24.10.0)(rollup@4.53.2)(typescript@5.9.3)
+      rss-parser:
+        specifier: ^3.13.0
+        version: 3.13.0
 
 packages:
 
@@ -707,6 +710,9 @@ packages:
   emoji-regex@8.0.0:
     resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
 
+  entities@2.2.0:
+    resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==}
+
   entities@6.0.1:
     resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==}
     engines: {node: '>=0.12'}
@@ -1146,6 +1152,12 @@ packages:
     engines: {node: '>=18.0.0', npm: '>=8.0.0'}
     hasBin: true
 
+  rss-parser@3.13.0:
+    resolution: {integrity: sha512-7jWUBV5yGN3rqMMj7CZufl/291QAhvrrGpDNE4k/02ZchL0npisiYYqULF71jCEKoIiHvK/Q2e6IkDwPziT7+w==}
+
+  sax@1.4.3:
+    resolution: {integrity: sha512-yqYn1JhPczigF94DMS+shiDMjDowYO6y9+wB/4WgO0Y19jWYk0lQ4tuG5KI7kj4FTp1wxPj5IFfcrz/s1c3jjQ==}
+
   semver@7.7.3:
     resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==}
     engines: {node: '>=10'}
@@ -1415,6 +1427,14 @@ packages:
     resolution: {integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==}
     engines: {node: '>=18'}
 
+  xml2js@0.5.0:
+    resolution: {integrity: sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==}
+    engines: {node: '>=4.0.0'}
+
+  xmlbuilder@11.0.1:
+    resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==}
+    engines: {node: '>=4.0'}
+
   xxhash-wasm@1.1.0:
     resolution: {integrity: sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA==}
 
@@ -2072,6 +2092,8 @@ snapshots:
 
   emoji-regex@8.0.0: {}
 
+  entities@2.2.0: {}
+
   entities@6.0.1: {}
 
   es-module-lexer@1.7.0: {}
@@ -2827,6 +2849,13 @@ snapshots:
       '@rollup/rollup-win32-x64-msvc': 4.53.2
       fsevents: 2.3.3
 
+  rss-parser@3.13.0:
+    dependencies:
+      entities: 2.2.0
+      xml2js: 0.5.0
+
+  sax@1.4.3: {}
+
   semver@7.7.3: {}
 
   sharp@0.34.5:
@@ -3060,6 +3089,13 @@ snapshots:
       string-width: 7.2.0
       strip-ansi: 7.1.2
 
+  xml2js@0.5.0:
+    dependencies:
+      sax: 1.4.3
+      xmlbuilder: 11.0.1
+
+  xmlbuilder@11.0.1: {}
+
   xxhash-wasm@1.1.0: {}
 
   yargs-parser@21.1.1: {}

+ 63 - 0
src/components/nav.astro

@@ -0,0 +1,63 @@
+---
+const catagories = {
+    All: "/",
+    Tech: "tech",
+    "USA News": "usa-news",
+    "World News": "world-news",
+};
+
+let { cat } = Astro.params;
+
+cat = !cat ? "/" : cat;
+
+console.log(catagories["USA News"]);
+console.log(cat);
+---
+
+<div class="container">
+    <div class="navbar">
+        {
+            Object.keys(catagories).map((c) => (
+                <a
+                    class={cat == catagories[c] ? "selected" : ""}
+                    href={catagories[c]}
+                >
+                    {c}
+                </a>
+            ))
+        }
+    </div>
+</div>
+
+<style>
+    .container {
+        width: 100%;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        margin: 0;
+
+        flex-grow: 2;
+    }
+
+    .navbar {
+        display: flex;
+        width: fit-content;
+        gap: 10%;
+
+        width: 50%;
+
+        justify-content: center;
+        align-items: center;
+    }
+
+    a {
+        text-decoration: none;
+        font-size: 22px;
+        color: white;
+    }
+
+    .selected {
+        text-decoration: underline;
+    }
+</style>

+ 22 - 0
src/layouts/layout.astro

@@ -0,0 +1,22 @@
+<!doctype html>
+<html lang="en">
+    <head>
+        <meta charset="UTF-8" />
+        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+        <title>Simo Reader</title>
+    </head>
+    <body>
+        <slot />
+    </body>
+    <style>
+        body {
+            background-color: black;
+            height: 100%
+            width: 100%;
+
+            font-family: Monospace;
+
+            color: white;
+        }
+    </style>
+</html>

+ 6 - 0
src/pages/[...cat].astro

@@ -0,0 +1,6 @@
+---
+import Nav from "@components/nav.astro";
+import Layout from "@layouts/layout.astro";
+---
+
+<Layout> <Nav /> </Layout>

+ 0 - 16
src/pages/index.astro

@@ -1,16 +0,0 @@
----
-
----
-
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
-		<meta name="viewport" content="width=device-width" />
-		<meta name="generator" content={Astro.generator} />
-		<title>Astro</title>
-	</head>
-	<body>
-		<h1>Astro</h1>
-	</body>
-</html>

+ 8 - 1
tsconfig.json

@@ -1,5 +1,12 @@
 {
   "extends": "astro/tsconfigs/strict",
   "include": [".astro/types.d.ts", "**/*"],
-  "exclude": ["dist"]
+  "exclude": ["dist"],
+  "compilerOptions": {
+    "baseUrl": "./src",
+    "paths": {
+      "@layouts/*": ["layouts/*"],
+      "@components/*": ["components/*"]
+    }
+  }
 }