From 3ec10492626338977bfc6f8523c51edb669e7ee4 Mon Sep 17 00:00:00 2001 From: teabyte Date: Sun, 7 Jan 2024 15:14:11 +0300 Subject: [PATCH] updating --- components/CourseCard.tsx | 2 +- components/Nav.tsx | 5 ++++- fresh.gen.ts | 8 ++++---- main.ts | 3 ++- routes/{[slug].tsx => [...slug].tsx} | 3 +-- routes/api/joke.ts | 21 --------------------- routes/api/test.ts | 5 +++++ static/resizer.js | 8 ++++---- static/styles.css | 4 ++-- 9 files changed, 23 insertions(+), 36 deletions(-) rename routes/{[slug].tsx => [...slug].tsx} (97%) delete mode 100644 routes/api/joke.ts create mode 100644 routes/api/test.ts diff --git a/components/CourseCard.tsx b/components/CourseCard.tsx index bc971a6..70c35d8 100644 --- a/components/CourseCard.tsx +++ b/components/CourseCard.tsx @@ -7,7 +7,7 @@ export default function CourseCard(props: { course: Course }) { class="py-4 gray-200 hover:opacity-75" style={{ order: course.order }} > - +

{course.title}

diff --git a/components/Nav.tsx b/components/Nav.tsx index 4bbf1d7..7fd6fd5 100644 --- a/components/Nav.tsx +++ b/components/Nav.tsx @@ -19,7 +19,10 @@ export default function NavBar() { title="نخله جي اس" class="text-2xl ml-1 font-bold hover:animate-pulse" > - NakhlahJS +
+ JS + نخلة +
diff --git a/fresh.gen.ts b/fresh.gen.ts index 93ec628..83c1626 100644 --- a/fresh.gen.ts +++ b/fresh.gen.ts @@ -2,20 +2,20 @@ // This file SHOULD be checked into source version control. // This file is automatically updated during development when running `dev.ts`. -import * as $_slug_ from "./routes/[slug].tsx"; +import * as $_slug_ from "./routes/[...slug].tsx"; import * as $_404 from "./routes/_404.tsx"; import * as $_app from "./routes/_app.tsx"; -import * as $api_joke from "./routes/api/joke.ts"; +import * as $api_test from "./routes/api/test.ts"; import * as $index from "./routes/index.tsx"; import * as $Editor from "./islands/Editor.tsx"; import { type Manifest } from "$fresh/server.ts"; const manifest = { routes: { - "./routes/[slug].tsx": $_slug_, + "./routes/[...slug].tsx": $_slug_, "./routes/_404.tsx": $_404, "./routes/_app.tsx": $_app, - "./routes/api/joke.ts": $api_joke, + "./routes/api/test.ts": $api_test, "./routes/index.tsx": $index, }, islands: { diff --git a/main.ts b/main.ts index e0966da..f0f33a9 100644 --- a/main.ts +++ b/main.ts @@ -22,7 +22,8 @@ async function getAllPaths(directory: string): Promise { "", ); if (!relativePath.endsWith(".json")) { - paths.push(btoa(relativePath)); + const normalizedPath = relativePath.replace(/\\/g, "/"); + paths.push(normalizedPath); } } } diff --git a/routes/[slug].tsx b/routes/[...slug].tsx similarity index 97% rename from routes/[slug].tsx rename to routes/[...slug].tsx index c0fb04f..7b43f52 100644 --- a/routes/[slug].tsx +++ b/routes/[...slug].tsx @@ -10,8 +10,7 @@ import EditButton from "../components/EditButton.tsx"; export const handler: Handlers = { async GET(_req, ctx) { try { - const slug = atob(ctx.params.slug); - const course = await getCourse(slug); + const course = await getCourse(ctx.params.slug); if (course === null) return ctx.renderNotFound(); return ctx.render(course); } catch { diff --git a/routes/api/joke.ts b/routes/api/joke.ts deleted file mode 100644 index db17edd..0000000 --- a/routes/api/joke.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { FreshContext } from "$fresh/server.ts"; - -// Jokes courtesy of https://punsandoneliners.com/randomness/programmer-jokes/ -const JOKES = [ - "Why do Java developers often wear glasses? They can't C#.", - "A SQL query walks into a bar, goes up to two tables and says “can I join you?”", - "Wasn't hard to crack Forrest Gump's password. 1forrest1.", - "I love pressing the F5 key. It's refreshing.", - "Called IT support and a chap from Australia came to fix my network connection. I asked “Do you come from a LAN down under?”", - "There are 10 types of people in the world. Those who understand binary and those who don't.", - "Why are assembly programmers often wet? They work below C level.", - "My favourite computer based band is the Black IPs.", - "What programme do you use to predict the music tastes of former US presidential candidates? An Al Gore Rhythm.", - "An SEO expert walked into a bar, pub, inn, tavern, hostelry, public house.", -]; - -export const handler = (_req: Request, _ctx: FreshContext): Response => { - const randomIndex = Math.floor(Math.random() * JOKES.length); - const body = JOKES[randomIndex]; - return new Response(body); -}; diff --git a/routes/api/test.ts b/routes/api/test.ts new file mode 100644 index 0000000..b880e79 --- /dev/null +++ b/routes/api/test.ts @@ -0,0 +1,5 @@ +import { FreshContext } from "$fresh/server.ts"; + +export const handler = (_req: Request, _ctx: FreshContext): Response => { + return new Response("200"); +}; diff --git a/static/resizer.js b/static/resizer.js index 3d909da..59af55a 100644 --- a/static/resizer.js +++ b/static/resizer.js @@ -7,15 +7,15 @@ document.addEventListener("DOMContentLoaded", function () { if (isMobile()) { Split(["#split-0", "#split-1"], { - sizes: [0, 100], + sizes: [2, 100], gutterAlign: "start", - minSize: 0, - gutterSize: 13, + minSize: 1, + gutterSize: 15, }); } else { Split(["#split-0", "#split-1"], { sizes: [50, 50], - gutterAlign: "start", + gutterAlign: "end", minSize: 0, gutterSize: 13, }); diff --git a/static/styles.css b/static/styles.css index 12faf93..557acf3 100644 --- a/static/styles.css +++ b/static/styles.css @@ -20,8 +20,8 @@ body .markdown-body { } .gutter { - z-index: 99; - background-color: #796666; + z-index: 2; + background-color: var(--fallback-bc,oklch(var(--bc)/.2)); background-repeat: no-repeat; background-position: 50%; }