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

oetherington / bluesky-embed-react / 12322397256

13 Dec 2024 08:15PM UTC coverage: 50.205% (-6.6%) from 56.762%
12322397256

push

github

web-flow
Merge pull request #16 from oetherington/dependabot/npm_and_yarn/storybook/addon-essentials-8.4.7

Bump @storybook/addon-essentials from 8.4.5 to 8.4.7

44 of 123 branches covered (35.77%)

Branch coverage included in aggregate %.

201 of 365 relevant lines covered (55.07%)

43.06 hits per line

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

90.91
/src/components/BlueskyText.tsx
1
import React, { FC, useEffect, useState } from "react";
2
import { RichText, RichTextSegment } from "@atproto/api";
3
import { useBlueskyClient } from "../hooks/useBlueskyClient";
4
import { useBlueskyConfig } from "../hooks/useBlueskyConfig";
5
import { BlueskySegment } from "./BlueskySegment";
6

7
export type BlueskyTextProps = {
8
        text: string;
9
};
10

11
export const BlueskyText: FC<BlueskyTextProps> = ({ text }) => {
30✔
12
        const client = useBlueskyClient();
5✔
13
        const { textPrimaryColor, fontSize, fontWeight } = useBlueskyConfig();
5✔
14
        const [segments, setSegments] = useState<RichTextSegment[]>([]);
5✔
15

16
        useEffect(() => {
5✔
17
                void (async () => {
5✔
18
                        const rt = new RichText({ text });
5✔
19
                        await rt.detectFacets(client);
5✔
20
                        setSegments(Array.from(rt.segments()));
2✔
21
                })();
22
        }, [text, client]);
23

24
        return (
5✔
25
                <div
26
                        style={{
27
                                color: textPrimaryColor,
28
                                fontSize,
29
                                fontWeight,
30
                                whiteSpace: "pre-line",
31
                        }}
32
                >
33
                        {segments.map((segment, i) => (
34
                                <BlueskySegment key={i} segment={segment} />
×
35
                        ))}
36
                </div>
37
        );
38
};
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