--- import Base from "../layouts/Base.astro"; import { fetchAllFragments, DID, fetchBskyPosts, fetchBskyFeed, parseBskyUrl, } from "../lib/atproto"; import type { Fragment, BskyPost } from "../lib/types"; import { postMeta, shotMeta, linkVariant, bskySize, bskyTextVariant, relTime, } from "../lib/variants"; // Tile components — posts import PostCassette from "../components/tiles/PostCassette.astro"; import PostCircuit from "../components/tiles/PostCircuit.astro"; import PostBlast from "../components/tiles/PostBlast.astro"; import PostTerminal from "../components/tiles/PostTerminal.astro"; // shots import ShotViewfinder from "../components/tiles/ShotViewfinder.astro"; import ShotEvidence from "../components/tiles/ShotEvidence.astro"; import ShotHud from "../components/tiles/ShotHud.astro"; import ShotHero from "../components/tiles/ShotHero.astro"; // bsky import BskyText from "../components/tiles/BskyText.astro"; import BskyMedia from "../components/tiles/BskyMedia.astro"; // links + lists import LinkRelay from "../components/tiles/LinkRelay.astro"; import LinkDispatch from "../components/tiles/LinkDispatch.astro"; import ListTile from "../components/tiles/ListTile.astro"; // Pinned bsky post URLs const PINNED_BSKY_URLS = [ "https://bsky.app/profile/nate.rip/post/3mcs53dio3c2s", "https://bsky.app/profile/nate.rip/post/3malzuto3x22s", "https://bsky.app/profile/nate.rip/post/3lxqjbta66k2k", "https://bsky.app/profile/nate.rip/post/3ltkowbdsuk2g", "https://bsky.app/profile/nate.rip/post/3ljqadka7qk2r", "https://bsky.app/profile/nate.rip/post/3ljixbqlta22z", "https://bsky.app/profile/nate.rip/post/3li2ujkthr22x", "https://bsky.app/profile/nate.rip/post/3lggjq25c6k2w", "https://bsky.app/profile/nate.rip/post/3lbulbyvexk2v", "https://bsky.app/profile/nate.rip/post/3ju4vkv7esa2p", ]; const pinnedRkeys = PINNED_BSKY_URLS.map((u) => parseBskyUrl(u)!).filter( Boolean, ); // Fetch everything in parallel const [fragments, pinnedPosts, feedPosts] = await Promise.all([ fetchAllFragments(), fetchBskyPosts(pinnedRkeys), fetchBskyFeed(25, new Set(pinnedRkeys)), ]); // Build a unified timeline: fragments + pinned bsky posts, sorted by date desc type GridEntry = | { kind: "fragment"; f: Fragment } | { kind: "bsky"; p: BskyPost }; const allEntries: GridEntry[] = [ ...fragments.map((f) => ({ kind: "fragment" as const, f })), ...pinnedPosts.map((p) => ({ kind: "bsky" as const, p })), ]; allEntries.sort((a, b) => { const da = new Date( a.kind === "fragment" ? a.f.createdAt : a.p.createdAt, ).getTime(); const db = new Date( b.kind === "fragment" ? b.f.createdAt : b.p.createdAt, ).getTime(); return db - da; // newest first }); const hero = allEntries.find( (e) => e.kind === "fragment" && e.f.type === "shot" && e.f.images?.length, ); const grid = allEntries.filter((e) => e !== hero); const totalFragments = fragments.length; const myAvatar = 'https://github.com/iamnbutler.png'; // Build render sequence with log + feed injected type RenderItem = | { kind: "log" } | { kind: "feed" } | { kind: "entry"; e: GridEntry; i: number }; const renderItems: RenderItem[] = []; grid.forEach((e, i) => { if (i === 5) renderItems.push({ kind: "log" }); if (i === 12) renderItems.push({ kind: "feed" }); renderItems.push({ kind: "entry", e, i }); }); if (grid.length <= 5) renderItems.push({ kind: "log" }); if (grid.length <= 12) renderItems.push({ kind: "feed" }); --- nate.rip {totalFragments} {fragments.filter((f) => f.type === "post").length} posts {fragments.filter((f) => f.type === "shot").length} shots {fragments.filter((f) => f.type === "list").length} lists {fragments.filter((f) => f.type === "link").length} links {pinnedPosts.length} bsky {hero && hero.kind === "fragment" && hero.f.images && ( )} { renderItems.map((item) => { // Log tile — tactical data terminal if (item.kind === "log") { return ( <> > log {allEntries.length} {allEntries.map((e) => { if (e.kind === "fragment") { return ( {String( e.f.id, ).padStart(2, "0")} {e.f.type} {e.f.title} {new Date( e.f.createdAt, ) .toISOString() .slice(0, 10)} ); } return ( bs bsky {e.p.text.slice(0, 60)} {new Date(e.p.createdAt) .toISOString() .slice(0, 10)} ); })} <> > ); } // Feed tile — comms terminal with CRT effect if (item.kind === "feed") { return ( @ nate.rip on bsky <> > {feedPosts.slice(0, 15).map((p) => ( {p.text.length > 120 ? p.text.slice(0, 120) + "..." : p.text} {relTime(p.createdAt)} {p.isRepost && ( repost )} {p.images?.length ? ( {p.images.length}{" "} img ) : null} ))} {feedPosts.length} posts ); } // Grid entries const { e, i } = item; // Bsky pinned post tile if (e.kind === "bsky") { const p = e.p; const sizeCls = bskySize(p, i); const hasMedia = !!(p.video || p.images?.length || p.externalEmbed?.thumb); if (hasMedia) { return ; } return ; } // Fragment entries const f = e.f; // Shots if (f.type === "shot" && f.images?.length) { const { cls, isHero: promoted, variant } = shotMeta(i, f.images!.length); if (promoted) { return ; } if (variant === "viewfinder") return ; if (variant === "evidence") return ; return ; } // Lists if (f.type === "list") { return ; } // Links if (f.type === "link" && f.url) { const v = linkVariant(f); if (v === "dispatch") { return ; } return ; } // Posts const { cls, showExcerpt, variant: postVariant } = postMeta(i, f.content?.length ?? 0); if (postVariant === "cassette") return ; if (postVariant === "circuit") return ; if (postVariant === "terminal") return ; return ; }) }