--- import Base from "../layouts/Base.astro"; import { fetchAllFragments, blobUrl, DID, fetchBskyPosts, fetchBskyFeed, parseBskyUrl, } from "../lib/atproto"; import type { Fragment, BskyPost } from "../lib/types"; // 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; function excerpt(text: string, len: number = 120): string { return text .replace(/[#*_\[\]()>`~\-]/g, "") .replace(/\n+/g, " ") .trim() .slice(0, len); } function extractListItems(content: string, max: number = 5): string[] { const items: string[] = []; for (const line of content.split("\n")) { if (items.length >= max) break; const h = line.match(/^##\s+(.+)/); if (h) { items.push(h[1].replace(/\*\*/g, "")); continue; } const b = line.match(/^[-*]\s+(.+)/); if (b && !line.startsWith(" ")) { items.push( b[1] .replace(/\[([^\]]+)\]\([^)]+\)/g, "$1") .replace(/\*\*/g, "") .trim(), ); } } return items; } function countListItems(content: string): number { return content.split("\n").filter((l) => l.match(/^(##\s|[-*]\s)/)).length; } const SHOT_VARIANTS = ["viewfinder", "evidence", "hud"] as const; type ShotVariant = (typeof SHOT_VARIANTS)[number]; function shotMeta( i: number, imgCount: number, ): { cls: string; isHero: boolean; variant: ShotVariant } { const variant = SHOT_VARIANTS[i % 3]; // Shots are visual — never 1x1, always at least 2-wide if (imgCount >= 3 && i % 6 === 0) return { cls: "tile-hero-wide", isHero: true, variant }; // 3x2 hero if (i % 7 === 0) return { cls: "tile-3w", isHero: false, variant }; // 3-wide if (i % 4 === 0) return { cls: "tile-w tile-t", isHero: false, variant }; // 2x2 feature return { cls: "tile-w", isHero: false, variant }; // default 2-wide } function postMeta( i: number, contentLen: number, ): { cls: string; showExcerpt: boolean } { // More variety — roughly half of posts get bigger treatment if (contentLen > 2000 && i % 4 === 0) return { cls: "tile-text-lg", showExcerpt: true }; // 2-wide featured if (i % 7 === 0) return { cls: "tile-text-tall", showExcerpt: true }; // tall with excerpt if (i % 3 === 0) return { cls: "tile-w", showExcerpt: true }; // 2-wide with excerpt return { cls: "", showExcerpt: false }; // 1x1 } // Bsky tiles — visual-first, generous sizing function bskySize(p: BskyPost, i: number): string { if (p.video) return "tile-bsky-hero"; // videos 3x2 if (p.images && p.images.length >= 2) return "tile-bsky-hero"; // multi-image 3x2 if (p.images?.length === 1) return i % 3 === 0 ? "tile-bsky-hero" : "tile-w"; // single image: some hero, rest 2-wide if (p.hasMedia) return "tile-w"; // link thumb 2-wide return ""; // text-only 1x1 } // 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" }); // Format relative time for bsky posts function relTime(iso: string): string { const d = new Date(iso); const now = Date.now(); const diff = now - d.getTime(); const days = Math.floor(diff / 86400000); if (days < 1) return "today"; if (days < 30) return `${days}d ago`; if (days < 365) return `${Math.floor(days / 30)}mo ago`; return d.toISOString().slice(0, 10); } --- 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 && ( <> > <> > shot #{hero.f.id} {hero.f.title} ) } { 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 — comm ping style if (e.kind === "bsky") { const p = e.p; const sizeCls = bskySize(p, i); const bskyUrl = `https://bsky.app/profile/${p.author.handle}/post/${p.rkey}`; const hasMedia = !!(p.video || p.images?.length || p.externalEmbed?.thumb); const mediaSrc = p.video ? null : p.images?.[0]?.fullsize ?? p.externalEmbed?.thumb ?? null; const mediaAlt = p.images?.[0]?.alt ?? p.externalEmbed?.title ?? ""; // Media ping — telemetry + media fill + overlay if (hasMedia) { return ( {p.video ? ( ) : ( )} rx {p.text.length > 80 ? p.text.slice(0, 80) + "..." : p.text} ); } // Text-only ping — telemetry + body + meta return ( rx {p.text.length > 180 ? p.text.slice(0, 180) + "..." : p.text} {relTime(p.createdAt)} {p.likeCount > 0 && ( {p.likeCount} likes )} ); } // Fragment entries (same as before) const f = e.f; const isShot = f.type === "shot" && f.images?.length; const isList = f.type === "list"; if (isShot) { const { cls, isHero: promoted, variant } = shotMeta( i, f.images!.length, ); if (promoted) { return ( <> > <> > shot #{f.id} {f.title} ); } // Viewfinder variant — crosshairs + ticks + exposure if (variant === "viewfinder") { return ( f/{f.id} • {new Date(f.createdAt).toISOString().slice(0, 10)} ); } // Evidence variant — film holder notches + marker badge if (variant === "evidence") { return ( {f.id} ); } // HUD variant — broken corner frame + scan line + data overlay return ( REC{String(f.id).padStart(3, "0")} ); } if (isList) { const items = extractListItems(f.content ?? ""); const total = countListItems(f.content ?? ""); return ( list {f.title} {items.map((li) => ( {li} ))} {total > items.length && ( +{total - items.length} more )} {new Date(f.createdAt) .toISOString() .slice(0, 10)} ); } // Links — relay card: intercepted transmission from elsewhere if (f.type === "link" && f.url) { const domain = new URL(f.url).hostname.replace( /^www\./, "", ); return ( ↗ relay {domain} {f.title} {f.content && ( {f.content} )} {new Date(f.createdAt) .toISOString() .slice(0, 10)} ); } // Posts const { cls, showExcerpt } = postMeta( i, f.content?.length ?? 0, ); const padCls = !cls && i % 5 === 1 ? "tile-airy" : ""; return ( {f.id} post {f.title} {showExcerpt && f.content && ( {excerpt(f.content, 160)} )} {new Date(f.createdAt).toISOString().slice(0, 10)} ); }) }
{p.text.length > 80 ? p.text.slice(0, 80) + "..." : p.text}
{p.text.length > 180 ? p.text.slice(0, 180) + "..." : p.text}
{f.content}
{excerpt(f.content, 160)}