From 16b38e0bebaaaa00579ddfbe2eb269126ecaa4fc Mon Sep 17 00:00:00 2001 From: Chad Miller Date: Tue, 13 May 2025 16:43:23 -0700 Subject: [PATCH] add justified gallery layout, add toggle to switch between layouts --- input.css | 12 +---- main.tsx | 123 +++++++++++++++++++++++++++++++++++++++++++++- static/masonry.js | 86 +++++++++++++++++++++++++++++++- static/styles.css | 26 ++++++---- 4 files changed, 223 insertions(+), 24 deletions(-) diff --git a/input.css b/input.css index 972626a..cc30f36 100644 --- a/input.css +++ b/input.css @@ -1,12 +1,4 @@ @import "tailwindcss"; -.htmx-request.htmx-indicator { - display: inline; -} -.htmx-indicator { - display: none; -} -.htmx-request #submit-button { - opacity: 0.5; - pointer-events: none; -} +/* use to test light mode */ +/* @custom-variant dark (&:where(.dark, .dark *)); */ diff --git a/main.tsx b/main.tsx index a8750ad..cf8ee33 100644 --- a/main.tsx +++ b/main.tsx @@ -59,6 +59,7 @@ const PUBLIC_URL = Deno.env.get("BFF_PUBLIC_URL") ?? "http://localhost:8080"; const GOATCOUNTER_URL = Deno.env.get("GOATCOUNTER_URL"); let cssContentHash: string = ""; +const staticJsFiles = new Map(); bff({ appName: "Grain Social", @@ -80,6 +81,18 @@ bff({ cssContentHash = Array.from(new Uint8Array(hashBuffer)) .map((b) => b.toString(16).padStart(2, "0")) .join(""); + for (const entry of Deno.readDirSync(join(Deno.cwd(), "static"))) { + if (entry.isFile && entry.name.endsWith(".js")) { + const fileContent = await Deno.readFile( + join(Deno.cwd(), "static", entry.name), + ); + const hashBuffer = await crypto.subtle.digest("SHA-256", fileContent); + const hash = Array.from(new Uint8Array(hashBuffer)) + .map((b) => b.toString(16).padStart(2, "0")) + .join(""); + staticJsFiles.set(entry.name, hash); + } + } }, onError: (err) => { if (err instanceof UnauthorizedError) { @@ -1059,7 +1072,12 @@ function Root(props: Readonly>) { href="https://unpkg.com/@fortawesome/fontawesome-free@6.7.2/css/all.min.css" preload /> - {scripts?.map((file) =>