From 7e619d33b53a40d069aba08fbcc0cce157d7a3de Mon Sep 17 00:00:00 2001 From: Chad Miller Date: Fri, 9 May 2025 16:22:01 -0700 Subject: [PATCH 1/4] update timeline styles --- main.tsx | 73 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/main.tsx b/main.tsx index aa470ad..76d4374 100644 --- a/main.tsx +++ b/main.tsx @@ -1070,7 +1070,9 @@ function Root(props: Readonly>) { heading={

grain - beta + + beta +

} profile={profile} @@ -1153,39 +1155,16 @@ function Timeline({ items }: Readonly<{ items: TimelineItem[] }>) { function TimelineItem({ item }: Readonly<{ item: TimelineItem }>) { return (
  • -
    - - @{item.actor.handle} - {" "} - {item.itemType === "favorite" ? "favorited" : "created"}{" "} - - {(item.gallery.record as Gallery).title} - - - {formatDistanceStrict(item.createdAt, new Date(), { - addSuffix: true, - })} - -
    - + + ) : null} - +

    + + @{item.actor.handle} + {" "} + {item.itemType === "favorite" ? "favorited" : "created"}{" "} + + {(item.gallery.record as Gallery).title} + + + {formatDistanceStrict(item.createdAt, new Date(), { + addSuffix: true, + })} + +

    +
  • ); } @@ -1391,7 +1393,8 @@ function ProfilePage({ {gallery.items?.length ? ( {gallery.items?.filter(isPhotoView)?.[0]?.alt} -- 2.51.2 From ec2587c333e85e92b11505c88d6d404f983af969 Mon Sep 17 00:00:00 2001 From: Chad Miller Date: Tue, 13 May 2025 12:26:43 -0700 Subject: [PATCH 2/4] various style changes, add share gallery button, move alt dialog to upload page --- deno.json | 2 +- deno.lock | 34 +++---- main.tsx | 237 +++++++++++++++++++++++++++------------------- static/masonry.js | 2 +- static/styles.css | 55 +++++++++-- 5 files changed, 204 insertions(+), 126 deletions(-) diff --git a/deno.json b/deno.json index ba90ae0..d3eb0e4 100644 --- a/deno.json +++ b/deno.json @@ -2,7 +2,7 @@ "imports": { "$lexicon/": "./__generated__/", "@atproto/syntax": "npm:@atproto/syntax@^0.4.0", - "@bigmoves/bff": "jsr:@bigmoves/bff@0.3.0-beta.11", + "@bigmoves/bff": "jsr:@bigmoves/bff@0.3.0-beta.12", "@gfx/canvas": "jsr:@gfx/canvas@^0.5.8", "@std/path": "jsr:@std/path@^1.0.9", "@tailwindcss/cli": "npm:@tailwindcss/cli@^4.1.4", diff --git a/deno.lock b/deno.lock index 4f6a181..5f49eb6 100644 --- a/deno.lock +++ b/deno.lock @@ -2,7 +2,7 @@ "version": "4", "specifiers": { "jsr:@bigmoves/atproto-oauth-client@0.1": "0.1.0", - "jsr:@bigmoves/bff@0.3.0-beta.11": "0.3.0-beta.11", + "jsr:@bigmoves/bff@0.3.0-beta.12": "0.3.0-beta.12", "jsr:@denosaurs/plug@1": "1.0.5", "jsr:@denosaurs/plug@1.0.5": "1.0.5", "jsr:@gfx/canvas@~0.5.8": "0.5.8", @@ -15,12 +15,12 @@ "jsr:@std/encoding@0.217.0": "0.217.0", "jsr:@std/encoding@^1.0.10": "1.0.10", "jsr:@std/fmt@0.214": "0.214.0", - "jsr:@std/fmt@^1.0.7": "1.0.7", + "jsr:@std/fmt@^1.0.8": "1.0.8", "jsr:@std/fs@0.214": "0.214.0", "jsr:@std/fs@0.217.0": "0.217.0", - "jsr:@std/html@^1.0.3": "1.0.3", - "jsr:@std/http@^1.0.13": "1.0.15", - "jsr:@std/internal@^1.0.6": "1.0.6", + "jsr:@std/html@^1.0.4": "1.0.4", + "jsr:@std/http@^1.0.13": "1.0.16", + "jsr:@std/internal@^1.0.6": "1.0.7", "jsr:@std/media-types@^1.1.0": "1.1.0", "jsr:@std/net@^1.0.4": "1.0.4", "jsr:@std/path@0.214": "0.214.0", @@ -70,8 +70,8 @@ "npm:jose" ] }, - "@bigmoves/bff@0.3.0-beta.11": { - "integrity": "1bcdf36eaa440d2cafbf834b37852b4b3f49c97d9802b2307d077cb2f507db5f", + "@bigmoves/bff@0.3.0-beta.12": { + "integrity": "26d404d3db39d2fa187e36a97ebd244ff648152d0820e17b1a2b993da4fbf34b", "dependencies": [ "jsr:@bigmoves/atproto-oauth-client", "jsr:@std/assert@^1.0.13", @@ -140,8 +140,8 @@ "@std/fmt@0.214.0": { "integrity": "40382cff88a0783b347b4d69b94cf931ab8e549a733916718cb866c08efac4d4" }, - "@std/fmt@1.0.7": { - "integrity": "2a727c043d8df62cd0b819b3fb709b64dd622e42c3b1bb817ea7e6cc606360fb" + "@std/fmt@1.0.8": { + "integrity": "71e1fc498787e4434d213647a6e43e794af4fd393ef8f52062246e06f7e372b7" }, "@std/fs@0.214.0": { "integrity": "bc880fea0be120cb1550b1ed7faf92fe071003d83f2456a1e129b39193d85bea", @@ -157,15 +157,15 @@ "jsr:@std/path@0.217" ] }, - "@std/html@1.0.3": { - "integrity": "7a0ac35e050431fb49d44e61c8b8aac1ebd55937e0dc9ec6409aa4bab39a7988" + "@std/html@1.0.4": { + "integrity": "eff3497c08164e6ada49b7f81a28b5108087033823153d065e3f89467dd3d50e" }, - "@std/http@1.0.15": { - "integrity": "435a4934b4e196e82a8233f724da525f7b7112f3566502f28815e94764c19159", + "@std/http@1.0.16": { + "integrity": "80c8d08c4bfcf615b89978dcefb84f7e880087cf3b6b901703936f3592a06933", "dependencies": [ "jsr:@std/cli", "jsr:@std/encoding@^1.0.10", - "jsr:@std/fmt@^1.0.7", + "jsr:@std/fmt@^1.0.8", "jsr:@std/html", "jsr:@std/media-types", "jsr:@std/net", @@ -173,8 +173,8 @@ "jsr:@std/streams" ] }, - "@std/internal@1.0.6": { - "integrity": "9533b128f230f73bd209408bb07a4b12f8d4255ab2a4d22a1fd6d87304aca9a4" + "@std/internal@1.0.7": { + "integrity": "39eeb5265190a7bc5d5591c9ff019490bd1f2c3907c044a11b0d545796158a0f" }, "@std/media-types@1.1.0": { "integrity": "c9d093f0c05c3512932b330e3cc1fe1d627b301db33a4c2c2185c02471d6eaa4" @@ -1608,7 +1608,7 @@ }, "workspace": { "dependencies": [ - "jsr:@bigmoves/bff@0.3.0-beta.11", + "jsr:@bigmoves/bff@0.3.0-beta.12", "jsr:@gfx/canvas@~0.5.8", "jsr:@std/path@^1.0.9", "npm:@atproto/syntax@0.4", diff --git a/main.tsx b/main.tsx index 76d4374..a8750ad 100644 --- a/main.tsx +++ b/main.tsx @@ -46,7 +46,12 @@ import { } from "@bigmoves/bff/components"; import { createCanvas, Image } from "@gfx/canvas"; import { join } from "@std/path"; -import { formatDistanceStrict } from "date-fns"; +import { + differenceInDays, + differenceInHours, + differenceInMinutes, + differenceInWeeks, +} from "date-fns"; import { wrap } from "popmotion"; import { ComponentChildren, JSX, VNode } from "preact"; @@ -308,21 +313,15 @@ bff({ />, ); }), - route("/dialogs/image-alt", (req, _params, ctx) => { - const url = new URL(req.url); - const galleryUri = url.searchParams.get("galleryUri"); - const imageCid = url.searchParams.get("imageCid"); - if (!galleryUri || !imageCid) return ctx.next(); - const atUri = new AtUri(galleryUri); - const galleryDid = atUri.hostname; - const galleryRkey = atUri.rkey; - const gallery = getGallery(galleryDid, galleryRkey, ctx); - const photo = gallery?.items?.filter(isPhotoView).find((photo) => { - return photo.cid === imageCid; - }); - if (!photo || !gallery) return ctx.next(); + route("/dialogs/photo/:rkey/alt", (_req, params, ctx) => { + requireAuth(ctx); + const photoRkey = params.rkey; + const photoUri = + `at://${ctx.currentUser.did}/social.grain.photo/${photoRkey}`; + const photo = ctx.indexService.getRecord>(photoUri); + if (!photo) return ctx.next(); return ctx.html( - , + , ); }), route("/dialogs/photo-select/:galleryRkey", (_req, params, ctx) => { @@ -430,8 +429,6 @@ bff({ key={photo.cid} photo={photoToView(photo.did, photo)} gallery={gallery} - isCreator={ctx.currentUser.did === gallery.creator.did} - isLoggedIn={!!ctx.currentUser.did} /> { + requireAuth(ctx); + ctx.deleteRecord( + `at://${ctx.currentUser.did}/social.grain.photo/${params.rkey}`, + ); + return new Response(null, { status: 200 }); + }), route("/actions/favorite", ["POST"], async (req, _params, ctx) => { requireAuth(ctx); const url = new URL(req.url); @@ -566,13 +570,6 @@ bff({ return ctx.redirect(`/profile/${ctx.currentUser.handle}`); }), - route("/actions/photo/:rkey", ["DELETE"], (_req, params, ctx) => { - requireAuth(ctx); - ctx.deleteRecord( - `at://${ctx.currentUser.did}/social.grain.photo/${params.rkey}`, - ); - return new Response(null, { status: 200 }); - }), ...photoUploadRoutes(), ...avatarUploadRoutes(), ], @@ -1065,18 +1062,18 @@ function Root(props: Readonly>) { {scripts?.map((file) =>