Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,47 @@
"lint": "next lint"
},
"dependencies": {
"@atproto/api": "^0.13.17",
"@atproto/identity": "^0.4.3",
"@atproto/oauth-client": "^0.3.1",
"@atproto/api": "^0.16.9",
"@atproto/identity": "^0.4.9",
"@atproto/oauth-client": "^0.5.6",
"@hookform/resolvers": "^3.9.1",
"@radix-ui/react-accordion": "^1.2.11",
"@radix-ui/react-dialog": "^1.1.14",
"@radix-ui/react-dropdown-menu": "^2.1.15",
"@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-dropdown-menu": "^2.1.16",
"@radix-ui/react-label": "^2.1.7",
"@radix-ui/react-navigation-menu": "^1.2.13",
"@radix-ui/react-popover": "^1.1.14",
"@radix-ui/react-select": "^2.2.5",
"@radix-ui/react-navigation-menu": "^1.2.14",
"@radix-ui/react-popover": "^1.1.15",
"@radix-ui/react-select": "^2.2.6",
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slider": "^1.3.5",
"@radix-ui/react-slider": "^1.3.6",
"@radix-ui/react-slot": "^1.2.3",
"class-variance-authority": "^0.7.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"lodash": "^4.17.21",
"lucide-react": "^0.460.0",
"next": "15.3.2",
"next-themes": "^0.4.4",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-hook-form": "^7.53.2",
"react-intersection-observer": "^9.13.1",
"tailwind-merge": "^2.5.4",
"zod": "^3.23.8"
"lucide-react": "^0.544.0",
"next": "15.5.3",
"next-themes": "^0.4.6",
"react": "19.1.1",
"react-dom": "19.1.1",
"react-hook-form": "^7.62.0",
"react-intersection-observer": "^9.16.0",
"tailwind-merge": "^3.3.1",
"zod": "^3.25.76"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.1.7",
"@tailwindcss/typography": "^0.5.15",
"@tailwindcss/postcss": "^4.1.13",
"@tailwindcss/typography": "^0.5.16",
"@types/lodash": "^4",
"@types/node": "^20",
"@types/react": "19.1.5",
"@types/react-dom": "19.1.5",
"eslint": "^8",
"eslint-config-next": "15.3.2",
"@types/node": "^20.19.14",
"@types/react": "19.1.13",
"@types/react-dom": "19.1.9",
"eslint": "^8.57.1",
"eslint-config-next": "15.5.3",
"postcss": "^8",
"shiki": "^3.4.2",
"tailwindcss": "^4.1.7",
"tw-animate-css": "^1.3.0",
"shiki": "^3.12.2",
"tailwindcss": "^4.1.13",
"tw-animate-css": "^1.3.8",
"typescript": "^5"
},
"packageManager": "[email protected]",
Expand Down
28 changes: 24 additions & 4 deletions src/app/at/[did]/[collection]/[rkey]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,39 @@ function RecordWrapper({
did: string;
}) {
if (AppBskyGraphFollow.isRecord(value)) {
return <BlueskyFollowRecord record={value} pds={pds} />;
const validation = AppBskyGraphFollow.validateRecord(value);
if (!validation.success) {
throw new Error(`Invalid ${value.$type} record`);
}

return <BlueskyFollowRecord record={validation.value} pds={pds} />;
}

if (AppBskyFeedLike.isRecord(value)) {
return <BlueskyLikeRecord record={value} pds={pds} />;
const validation = AppBskyFeedLike.validateRecord(value);
if (!validation.success) {
throw new Error(`Invalid ${value.$type} record`);
}

return <BlueskyLikeRecord record={validation.value} pds={pds} />;
}

if (AppBskyFeedPost.isRecord(value)) {
return <BlueskyPostRecord record={value} />;
const validation = AppBskyFeedPost.validateRecord(value);
if (!validation.success) {
throw new Error(`Invalid ${value.$type} record`);
}

return <BlueskyPostRecord record={validation.value} />;
}

if (AppBskyActorProfile.isRecord(value)) {
return <BlueskyProfileRecord record={value} did={did} />;
const validation = AppBskyActorProfile.validateRecord(value);
if (!validation.success) {
throw new Error(`Invalid ${value.$type} record`);
}

return <BlueskyProfileRecord record={validation.value} did={did} />;
}

return null;
Expand Down
6 changes: 3 additions & 3 deletions src/components/bsky-avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use client";

import { BlobRef } from "@atproto/api";
import { TypedJsonBlobRef } from "@atproto/lexicon";
import Image from "next/image";

export function BskyAvatar({
avatar,
did,
}: {
avatar: BlobRef | undefined;
avatar: TypedJsonBlobRef | undefined;
did: string;
}) {
if (!avatar || !did) {
Expand All @@ -21,7 +21,7 @@ export function BskyAvatar({

const url = new URL(
`/img/avatar/plain/${decodeURIComponent(did)}/${avatar.ref.$link}@jpeg`,
"https://cdn.bsky.app"
"https://cdn.bsky.app",
);

return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/records/bluesky-follow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import LinkSpan from "@/components/link-span";
import { AppBskyGraphFollow, BlobRef } from "@atproto/api";
import { AppBskyGraphFollow } from "@atproto/api";
import Link from "next/link";
import { Suspense, use } from "react";
import { cachedFetchProfile } from "@/lib/records";
Expand Down Expand Up @@ -39,7 +39,7 @@ function EmbeddedProfile({ did, pds }: { did: string; pds: string }) {

return (
<div className="flex flex-row gap-4 my-8">
<BskyAvatar avatar={profile.avatar?.toJSON() as BlobRef} did={did} />
<BskyAvatar avatar={profile.avatar?.toJSON()} did={did} />
<div className="flex flex-col justify-center max-w-lg">
<h3 className="my-0">{profile.displayName}</h3>
<p className="mb-0 mt-1">{profile.description}</p>
Expand Down
9 changes: 7 additions & 2 deletions src/components/records/bluesky-like.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ function EmbeddedPost({ uri, pds }: EmbeddedPostProps) {
collection: uri.collection,
rkey: uri.rkey,
pds,
})
}),
);

if (!AppBskyFeedPost.isRecord(post.value)) {
return null;
}

return <BlueskyPostRecord record={post.value} showReplies={false} />;
const validation = AppBskyFeedPost.validateRecord(post.value);
if (!validation.success) {
throw new Error(`Invalid ${post.value.$type} record`);
}

return <BlueskyPostRecord record={validation.value} showReplies={false} />;
}
9 changes: 7 additions & 2 deletions src/components/records/bluesky-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,18 @@ function ReplyParent({
collection: atUri.collection,
rkey: atUri.rkey,
pds: pdsUrl,
})
}),
);

if (!AppBskyFeedPost.isRecord(post.value)) {
return null;
}

const validation = AppBskyFeedPost.validateRecord(post.value);
if (!validation.success) {
throw new Error(`Invalid ${post.value.$type} record`);
}

return (
<Accordion className="border-t px-4 mt-4" type="single" collapsible>
<AccordionItem value={post.uri}>
Expand All @@ -121,7 +126,7 @@ function ReplyParent({
</p>
</AccordionTrigger>
<AccordionContent className="ml-2">
<BlueskyPostRecord record={post.value} depth={depth + 1} />
<BlueskyPostRecord record={validation.value} depth={depth + 1} />
</AccordionContent>
</AccordionItem>
</Accordion>
Expand Down
4 changes: 2 additions & 2 deletions src/components/records/bluesky-profile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BskyAvatar } from "@/components/bsky-avatar";
import { AppBskyActorProfile, BlobRef } from "@atproto/api";
import { AppBskyActorProfile } from "@atproto/api";
import { differenceInDays } from "date-fns/differenceInDays";
import { parseISO } from "date-fns/parseISO";

Expand All @@ -13,7 +13,7 @@ export default function BlueskyProfileRecord({
return (
<div className="prose dark:prose-invert py-4">
<div className="flex flex-row gap-4">
<BskyAvatar avatar={record.avatar?.toJSON() as BlobRef} did={did} />
<BskyAvatar avatar={record.avatar?.toJSON()} did={did} />
<div className="flex flex-col justify-center">
<h3 className="my-0">{record.displayName}</h3>
<p className="mb-0 mt-1">{record.description}</p>
Expand Down
Loading