• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

oetherington / bluesky-embed-react / 12323894398

13 Dec 2024 10:20PM UTC coverage: 65.369% (-1.6%) from 67.008%
12323894398

Pull #19

github

web-flow
Merge e4e374ad6 into afedac89b
Pull Request #19: Bump react, react-dom and @types/react

53 of 123 branches covered (43.09%)

Branch coverage included in aggregate %.

266 of 365 relevant lines covered (72.88%)

65.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

44.44
/src/components/BlueskySegment.tsx
1
import React, { FC } from "react";
2
import type { RichTextSegment } from "@atproto/api";
3
import {
4
        getBlueskyLinkProps,
5
        getBlueskyProfileUrl,
6
        getBlueskyTagUrl,
7
} from "../helpers";
8
import { useBlueskyConfig } from "../hooks/useBlueskyConfig";
9
import { useHoverDecoration } from "../hooks/useHoverDecoration";
10

11
export type BlueskySegmentProps = {
12
        segment: RichTextSegment;
13
};
14

15
export const BlueskySegment: FC<BlueskySegmentProps> = ({ segment }) => {
30✔
16
        const { app, anchorColor, openLinksInNewTab } = useBlueskyConfig();
31✔
17
        const eventHandlers = useHoverDecoration();
31✔
18
        const anchorProps = {
31✔
19
                ...eventHandlers,
20
                ...getBlueskyLinkProps(openLinksInNewTab),
21
                style: {
22
                        color: anchorColor,
23
                        textDecoration: "none",
24
                },
25
        };
26

27
        if (segment.isLink()) {
31!
28
                return (
×
29
                        <a href={segment.link?.uri} {...anchorProps}>
30
                                {segment.text}
31
                        </a>
32
                );
33
        }
34

35
        if (segment.isMention()) {
31!
36
                return (
×
37
                        <a
38
                                href={getBlueskyProfileUrl(app, segment.mention?.did ?? "")}
×
39
                                {...anchorProps}
40
                        >
41
                                {segment.text}
42
                        </a>
43
                );
44
        }
45

46
        if (segment.isTag()) {
31!
47
                return (
×
48
                        <a href={getBlueskyTagUrl(app, segment.tag?.tag ?? "")} {...anchorProps}>
×
49
                                {segment.text}
50
                        </a>
51
                );
52
        }
53

54
        return <span>{segment.text}</span>;
31✔
55
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc