···3030 const profile = $derived(profiles.get(actor as Did));
3131 const displayName = $derived(profile?.displayName ?? '');
3232 const handle = $derived(isHandle(actor) ? actor : handles.get(actor as Did));
3333+ let did = $derived(isDid(actor) ? actor : null);
3334 let loading = $state(true);
3435 let error = $state<string | null>(null);
3535- let did = $state(isDid(actor) ? actor : null);
36363737 let userBlocked = $state(false);
3838 let blockedByTarget = $state(false);
+77
src/lib/post-height.ts
···11+import type { PostWithUri } from './at/fetch';
22+33+const LINE_HEIGHT = 20; // approx line height in px
44+const CHARS_PER_LINE = 66; // approx chars per line
55+const BASE_HEIGHT = 100; // header + footer + padding
66+const IMAGE_HEIGHT = 300; // constrained height for single images
77+const IMAGE_GRID_HEIGHT = 200; // height for grid of images
88+const VIDEO_HEIGHT = 300; // default video height
99+const LINK_CARD_HEIGHT = 100; // external link card
1010+const QUOTE_FALLBACK_HEIGHT = 100; // fallback for quote
1111+1212+// idk this is dumb idk i hate virtual lists and shit bleh
1313+export const estimatePostHeight = (post: PostWithUri | undefined | null, depth = 0): number => {
1414+ if (!post) return 150; // default fallback if post is missing
1515+ if (depth > 1) return 0; // prevent infinite recursion
1616+1717+ const record = post.record;
1818+ let height = BASE_HEIGHT;
1919+2020+ // 1. text height
2121+ if (record.text) {
2222+ const lines = Math.ceil(record.text.length / CHARS_PER_LINE) || 1;
2323+ // add a bit more for newlines if present
2424+ const newlines = (record.text.match(/\n/g) || []).length;
2525+ height += (Math.max(lines, newlines + 1) * LINE_HEIGHT);
2626+ }
2727+2828+ // 2. embeds
2929+ if (record.embed) {
3030+ const embed = record.embed;
3131+3232+ if (embed.$type === 'app.bsky.embed.images') {
3333+ // images
3434+ if (embed.images.length === 1) {
3535+ const aspect = embed.images[0].aspectRatio;
3636+ if (aspect) {
3737+ // w / h = a => h = w / a
3838+ // assuming max width of ~500px in feed
3939+ const calculatedHeight = 500 / (aspect.width / aspect.height);
4040+ height += Math.min(calculatedHeight, 500); // clamp max height
4141+ } else {
4242+ height += IMAGE_HEIGHT;
4343+ }
4444+ } else {
4545+ height += IMAGE_GRID_HEIGHT;
4646+ }
4747+ } else if (embed.$type === 'app.bsky.embed.video') {
4848+ // video
4949+ const aspect = embed.aspectRatio;
5050+ if (aspect) {
5151+ const calculatedHeight = 500 / (aspect.width / aspect.height);
5252+ height += Math.min(calculatedHeight, 500);
5353+ } else {
5454+ height += VIDEO_HEIGHT;
5555+ }
5656+ } else if (embed.$type === 'app.bsky.embed.record') {
5757+ // quote post
5858+ height += QUOTE_FALLBACK_HEIGHT;
5959+6060+ } else if (embed.$type === 'app.bsky.embed.recordWithMedia') {
6161+ // recordWithMedia
6262+ // media part
6363+ const media = embed.media;
6464+ if (media.$type === 'app.bsky.embed.images') {
6565+ height += (media.images.length === 1 ? IMAGE_HEIGHT : IMAGE_GRID_HEIGHT);
6666+ } else if (media.$type === 'app.bsky.embed.video') {
6767+ height += VIDEO_HEIGHT;
6868+ }
6969+ // quote part
7070+ height += QUOTE_FALLBACK_HEIGHT;
7171+ } else if (embed.$type === 'app.bsky.embed.external') {
7272+ height += LINK_CARD_HEIGHT;
7373+ }
7474+ }
7575+7676+ return Math.round(height);
7777+};
+4-4
src/lib/state.svelte.ts
···919919 const feed = followingFeed.get(userDid);
920920 if (!feed || feed.size === 0) return;
921921922922- let minTimestamp = Date.now();
922922+ let minTimestamp = Date.now() * 1000;
923923 let found = false;
924924925925 for (const uri of feed) {
926926 const post = getPostFromUri(uri);
927927 if (post) {
928928- const ts = new Date(post.record.createdAt).getTime();
928928+ const ts = new Date(post.record.createdAt).getTime() * 1000;
929929 if (ts < minTimestamp) minTimestamp = ts;
930930 found = true;
931931 }
···948948 const posts = userFeedTimelines.get(feedUri);
949949 if (!posts || posts.length === 0) return;
950950951951- let minTimestamp = Date.now();
951951+ let minTimestamp = Date.now() * 1000;
952952 let found = false;
953953954954 for (const uri of posts) {
955955 const post = getPostFromUri(uri);
956956 if (post) {
957957- const ts = new Date(post.record.createdAt).getTime();
957957+ const ts = new Date(post.record.createdAt).getTime() * 1000;
958958 if (ts < minTimestamp) minTimestamp = ts;
959959 found = true;
960960 }