Skip to content

Commit

Permalink
fix: links in messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ImLunaHey committed Jan 12, 2025
1 parent ecdfe9d commit 49292ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/lib/bluesky/types/bsky-message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Static, Type } from '@sinclair/typebox';
import { BSkyFacet } from './bsky-facet';

export const BSkyMessage = Type.Object({
id: Type.String(),
Expand All @@ -8,6 +9,7 @@ export const BSkyMessage = Type.Object({
}),
text: Type.String(),
sentAt: Type.String(),
facets: Type.Optional(Type.Array(BSkyFacet)),
});

export type BSkyMessage = Static<typeof BSkyMessage>;
Expand Down
9 changes: 8 additions & 1 deletion src/routes/messages/$convoId.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { SendIcon } from 'lucide-react';
import { useSendMessage } from '@/lib/bluesky/hooks/use-send-message';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { StickyHeader } from '@/components/sticky-header';
import { FacetedText } from '@/components/faceted-text';

function Message({ message }: { message: BSkyMessageWithReactions }) {
const session = useBlueskyStore((state) => state.session);
Expand All @@ -32,7 +33,13 @@ function Message({ message }: { message: BSkyMessageWithReactions }) {
)}
key={message.id as string}
>
<FormattedText text={message.text} linkify />
{message.facets ? (
<div className="[&>*]:!text-white [&>a]:underline">
<FacetedText text={message.text} facets={message.facets} />
</div>
) : (
<FormattedText text={message.text} />
)}
</div>
{message.reactions.length >= 1 && <div>{message.reactions.map((reaction) => reaction.emoji).join(' ')}</div>}
<div className="dark:text-gray-500 text-xs">
Expand Down

0 comments on commit 49292ca

Please sign in to comment.