@streamplace/components 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chat/chat-box.js +46 -43
- package/dist/components/chat/chat-message.js +36 -33
- package/dist/components/chat/chat.js +31 -27
- package/dist/components/chat/mention-suggestions.js +16 -13
- package/dist/components/chat/mod-view.js +20 -17
- package/dist/components/mobile-player/fullscreen.js +21 -17
- package/dist/components/mobile-player/fullscreen.native.js +39 -35
- package/dist/components/mobile-player/player.js +38 -32
- package/dist/components/mobile-player/props.js +2 -1
- package/dist/components/mobile-player/shared.js +16 -13
- package/dist/components/mobile-player/ui/countdown.js +23 -19
- package/dist/components/mobile-player/ui/index.js +10 -6
- package/dist/components/mobile-player/ui/input.js +16 -12
- package/dist/components/mobile-player/ui/loading.js +104 -0
- package/dist/components/mobile-player/ui/metrics.js +20 -16
- package/dist/components/mobile-player/ui/streamer-context-menu.js +6 -3
- package/dist/components/mobile-player/ui/viewer-context-menu.js +19 -16
- package/dist/components/mobile-player/ui/viewers.js +13 -9
- package/dist/components/mobile-player/use-webrtc.js +29 -24
- package/dist/components/mobile-player/video.js +109 -99
- package/dist/components/mobile-player/video.native.js +92 -85
- package/dist/components/mobile-player/webrtc-diagnostics.js +9 -5
- package/dist/components/mobile-player/webrtc-primitives.js +8 -6
- package/dist/components/mobile-player/webrtc-primitives.native.js +8 -1
- package/dist/components/ui/button.js +26 -23
- package/dist/components/ui/dialog.js +43 -40
- package/dist/components/ui/dropdown.js +121 -116
- package/dist/components/ui/icons.js +8 -5
- package/dist/components/ui/index.js +27 -19
- package/dist/components/ui/input.js +31 -28
- package/dist/components/ui/loader.js +9 -6
- package/dist/components/ui/primitives/button.js +33 -29
- package/dist/components/ui/primitives/input.js +44 -40
- package/dist/components/ui/primitives/modal.js +45 -41
- package/dist/components/ui/primitives/text.js +35 -29
- package/dist/components/ui/resizeable.js +66 -53
- package/dist/components/ui/text.js +50 -48
- package/dist/components/ui/textarea.js +13 -11
- package/dist/components/ui/toast.js +26 -23
- package/dist/components/ui/view.js +41 -39
- package/dist/hooks/index.js +12 -9
- package/dist/hooks/useAvatars.js +11 -8
- package/dist/hooks/useCameraToggle.js +7 -4
- package/dist/hooks/useKeyboard.js +13 -10
- package/dist/hooks/useKeyboardSlide.js +8 -5
- package/dist/hooks/useLivestreamInfo.js +17 -14
- package/dist/hooks/useOuterAndInnerDimensions.js +9 -6
- package/dist/hooks/usePlayerDimensions.js +9 -6
- package/dist/hooks/useSegmentDimensions.js +6 -3
- package/dist/hooks/useSegmentTiming.js +13 -10
- package/dist/index.js +24 -15
- package/dist/lib/facet.js +5 -1
- package/dist/lib/theme/atoms.js +153 -148
- package/dist/lib/theme/atoms.types.js +2 -1
- package/dist/lib/theme/index.js +31 -5
- package/dist/lib/theme/theme.js +91 -83
- package/dist/lib/theme/tokens.js +15 -12
- package/dist/lib/utils.js +22 -11
- package/dist/livestream-provider/index.js +19 -14
- package/dist/livestream-provider/websocket.js +14 -10
- package/dist/livestream-store/chat.js +26 -19
- package/dist/livestream-store/context.js +5 -2
- package/dist/livestream-store/index.js +7 -4
- package/dist/livestream-store/livestream-state.js +2 -1
- package/dist/livestream-store/livestream-store.js +31 -18
- package/dist/livestream-store/stream-key.js +22 -18
- package/dist/livestream-store/websocket-consumer.js +18 -14
- package/dist/player-store/context.js +5 -2
- package/dist/player-store/index.js +8 -5
- package/dist/player-store/player-provider.js +20 -15
- package/dist/player-store/player-state.js +9 -6
- package/dist/player-store/player-store.js +35 -21
- package/dist/player-store/single-player-provider.js +35 -23
- package/dist/streamplace-provider/context.js +5 -2
- package/dist/streamplace-provider/index.js +14 -10
- package/dist/streamplace-provider/poller.js +20 -17
- package/dist/streamplace-store/block.js +6 -3
- package/dist/streamplace-store/index.js +6 -3
- package/dist/streamplace-store/stream.js +58 -33
- package/dist/streamplace-store/streamplace-store.js +23 -13
- package/dist/streamplace-store/user.js +19 -14
- package/dist/streamplace-store/xrpc.js +10 -7
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/56540125 +0 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/67b1eb60 +0 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/7c275f90 +0 -0
- package/package.json +5 -6
- package/src/components/mobile-player/ui/index.ts +1 -0
- package/src/components/mobile-player/ui/loading.tsx +154 -0
- package/src/components/ui/resizeable.tsx +26 -15
- package/src/player-store/player-state.tsx +4 -0
- package/src/player-store/player-store.tsx +5 -0
- package/src/streamplace-store/stream.tsx +66 -35
- package/tsconfig.json +2 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const [
|
|
16
|
-
const [
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatBox = ChatBox;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const lucide_react_native_1 = require("lucide-react-native");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const __1 = require("../../");
|
|
9
|
+
const atoms_1 = require("../../lib/theme/atoms");
|
|
10
|
+
const xrpc_1 = require("../../streamplace-store/xrpc");
|
|
11
|
+
const textarea_1 = require("../ui/textarea");
|
|
12
|
+
const chat_message_1 = require("./chat-message");
|
|
13
|
+
const mention_suggestions_1 = require("./mention-suggestions");
|
|
14
|
+
function ChatBox({ isPopout, chatBoxStyle, }) {
|
|
15
|
+
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
16
|
+
const [message, setMessage] = (0, react_1.useState)("");
|
|
17
|
+
const [showSuggestions, setShowSuggestions] = (0, react_1.useState)(false);
|
|
18
|
+
const [highlightedIndex, setHighlightedIndex] = (0, react_1.useState)(0);
|
|
19
|
+
const [filteredAuthors, setFilteredAuthors] = (0, react_1.useState)(new Map());
|
|
20
|
+
const chat = (0, __1.useChat)();
|
|
21
|
+
const createChatMessage = (0, __1.useCreateChatMessage)();
|
|
22
|
+
const replyTo = (0, __1.useReplyToMessage)();
|
|
23
|
+
const setReplyToMessage = (0, __1.useSetReplyToMessage)();
|
|
24
|
+
const textAreaRef = (0, react_1.useRef)(null);
|
|
22
25
|
// are we logged in?
|
|
23
|
-
let agent = usePDSAgent();
|
|
26
|
+
let agent = (0, xrpc_1.usePDSAgent)();
|
|
24
27
|
if (!agent?.did) {
|
|
25
|
-
|
|
28
|
+
(0, jsx_runtime_1.jsx)(__1.View, { style: [atoms_1.layout.flex.row, atoms_1.layout.flex.alignCenter, atoms_1.gap.all[2]], children: (0, jsx_runtime_1.jsx)(__1.Text, { children: "Log in to chat." }) });
|
|
26
29
|
}
|
|
27
|
-
const authors = useMemo(() => {
|
|
30
|
+
const authors = (0, react_1.useMemo)(() => {
|
|
28
31
|
if (!chat)
|
|
29
32
|
return null;
|
|
30
33
|
return chat.reduce((acc, msg) => {
|
|
@@ -61,30 +64,30 @@ export function ChatBox({ isPopout, chatBoxStyle, }) {
|
|
|
61
64
|
});
|
|
62
65
|
setSubmitting(false);
|
|
63
66
|
};
|
|
64
|
-
useEffect(() => {
|
|
67
|
+
(0, react_1.useEffect)(() => {
|
|
65
68
|
if (replyTo && textAreaRef.current) {
|
|
66
69
|
textAreaRef.current.focus();
|
|
67
70
|
}
|
|
68
71
|
}, [replyTo]);
|
|
69
|
-
return (
|
|
70
|
-
layout.flex.row,
|
|
71
|
-
layout.flex.alignCenter,
|
|
72
|
-
layout.flex.spaceBetween,
|
|
73
|
-
h[12],
|
|
74
|
-
pl[2],
|
|
75
|
-
pr[10],
|
|
76
|
-
mb[2],
|
|
77
|
-
bg.gray[800],
|
|
72
|
+
return ((0, jsx_runtime_1.jsxs)(__1.View, { style: [atoms_1.layout.flex.column, atoms_1.flex.shrink[1], atoms_1.gap.all[2]], children: [replyTo && ((0, jsx_runtime_1.jsxs)(__1.View, { style: [
|
|
73
|
+
atoms_1.layout.flex.row,
|
|
74
|
+
atoms_1.layout.flex.alignCenter,
|
|
75
|
+
atoms_1.layout.flex.spaceBetween,
|
|
76
|
+
atoms_1.h[12],
|
|
77
|
+
atoms_1.pl[2],
|
|
78
|
+
atoms_1.pr[10],
|
|
79
|
+
atoms_1.mb[2],
|
|
80
|
+
atoms_1.bg.gray[800],
|
|
78
81
|
{ borderRadius: 16 },
|
|
79
|
-
], children: [
|
|
80
|
-
layout.flex.row,
|
|
81
|
-
layout.flex.alignCenter,
|
|
82
|
-
layout.flex.justifyCenter,
|
|
83
|
-
h[12],
|
|
84
|
-
w[12],
|
|
85
|
-
bg.gray[600],
|
|
82
|
+
], children: [(0, jsx_runtime_1.jsx)(chat_message_1.RenderChatMessage, { item: replyTo, showReply: false, userCache: authors || new Map() }), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: () => setReplyToMessage(null), children: (0, jsx_runtime_1.jsx)(__1.View, { style: [
|
|
83
|
+
atoms_1.layout.flex.row,
|
|
84
|
+
atoms_1.layout.flex.alignCenter,
|
|
85
|
+
atoms_1.layout.flex.justifyCenter,
|
|
86
|
+
atoms_1.h[12],
|
|
87
|
+
atoms_1.w[12],
|
|
88
|
+
atoms_1.bg.gray[600],
|
|
86
89
|
{ borderRadius: 999 },
|
|
87
|
-
], children:
|
|
90
|
+
], children: (0, jsx_runtime_1.jsx)(lucide_react_native_1.X, { size: 24 }) }) })] })), (0, jsx_runtime_1.jsxs)(__1.View, { style: [atoms_1.layout.flex.row, atoms_1.layout.flex.alignCenter, atoms_1.gap.all[2]], children: [(0, jsx_runtime_1.jsx)(textarea_1.Textarea, { ref: textAreaRef, numberOfLines: 1, value: message, enterKeyHint: "send", onSubmitEditing: submit, multiline: false, onChangeText: (text) => {
|
|
88
91
|
setMessage(text);
|
|
89
92
|
updateSuggestions(text);
|
|
90
93
|
}, onKeyPress: (k) => {
|
|
@@ -105,5 +108,5 @@ export function ChatBox({ isPopout, chatBoxStyle, }) {
|
|
|
105
108
|
else if (k.nativeEvent.key === "ArrowDown") {
|
|
106
109
|
setHighlightedIndex((prev) => Math.min(prev + 1, Array.from(filteredAuthors.keys()).length - 1));
|
|
107
110
|
}
|
|
108
|
-
}, style: [chatBoxStyle] }),
|
|
111
|
+
}, style: [chatBoxStyle] }), (0, jsx_runtime_1.jsx)(__1.Button, { disabled: submitting, variant: "secondary", style: { borderRadius: 16, height: 36, minWidth: 80 }, onPress: submit, children: submitting ? (0, jsx_runtime_1.jsx)(__1.Loader, {}) : "Send" })] }), showSuggestions && ((0, jsx_runtime_1.jsx)(mention_suggestions_1.MentionSuggestions, { authors: filteredAuthors || [], highlightedIndex: highlightedIndex, onSelect: handleMentionSelect }))] }));
|
|
109
112
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderChatMessage = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const facet_1 = require("../../lib/facet");
|
|
8
|
+
const atoms_1 = require("../../lib/theme/atoms");
|
|
9
|
+
const ui_1 = require("../ui");
|
|
10
|
+
const livestream_store_1 = require("../../livestream-store");
|
|
11
|
+
const text_1 = require("../ui/text");
|
|
9
12
|
const getRgbColor = (color) => color ? `rgb(${color.red}, ${color.green}, ${color.blue})` : "$accentColor";
|
|
10
13
|
const segmentedObject = (obj, index, userCache) => {
|
|
11
14
|
if (obj.features && obj.features.length > 0) {
|
|
@@ -13,63 +16,63 @@ const segmentedObject = (obj, index, userCache) => {
|
|
|
13
16
|
// afaik there shouldn't be a case where facets overlap, at least currently
|
|
14
17
|
if (ftr.$type === "app.bsky.richtext.facet#link") {
|
|
15
18
|
let linkftr = ftr;
|
|
16
|
-
return (
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(text_1.Text, { style: [{ color: ui_1.atoms.colors.ios.systemBlue, cursor: "pointer" }], onPress: () => react_native_1.Linking.openURL(linkftr.uri || ""), children: obj.text }, `mention-${index}`));
|
|
17
20
|
}
|
|
18
21
|
else if (ftr.$type === "app.bsky.richtext.facet#mention") {
|
|
19
22
|
let mtnftr = ftr;
|
|
20
23
|
const profile = userCache?.[mtnftr.did];
|
|
21
24
|
console.log(profile, mtnftr.did, userCache);
|
|
22
|
-
return (
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(text_1.Text, { style: [
|
|
23
26
|
{
|
|
24
27
|
cursor: "pointer",
|
|
25
28
|
color: getRgbColor(profile?.color),
|
|
26
29
|
},
|
|
27
|
-
], onPress: () => Linking.openURL(`https://bsky.app/profile/${mtnftr.did || ""}`), children: obj.text }, `mention-${index}`));
|
|
30
|
+
], onPress: () => react_native_1.Linking.openURL(`https://bsky.app/profile/${mtnftr.did || ""}`), children: obj.text }, `mention-${index}`));
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
else {
|
|
31
|
-
return
|
|
34
|
+
return (0, jsx_runtime_1.jsx)(text_1.Text, { children: obj.text }, `text-${index}`);
|
|
32
35
|
}
|
|
33
36
|
};
|
|
34
37
|
const RichTextMessage = ({ text, facets, }) => {
|
|
35
38
|
if (!facets?.length)
|
|
36
|
-
return
|
|
37
|
-
const userCache = useLivestreamStore((state) => state.authors);
|
|
38
|
-
let segs = segmentize(text, facets);
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(text_1.Text, { children: text });
|
|
40
|
+
const userCache = (0, livestream_store_1.useLivestreamStore)((state) => state.authors);
|
|
41
|
+
let segs = (0, facet_1.segmentize)(text, facets);
|
|
39
42
|
return segs.map((seg, i) => segmentedObject(seg, i, userCache));
|
|
40
43
|
};
|
|
41
|
-
|
|
42
|
-
const formatTime = useCallback((dateString) => {
|
|
44
|
+
exports.RenderChatMessage = (0, react_1.memo)(function RenderChatMessage({ item, showReply = true, showTime = true, }) {
|
|
45
|
+
const formatTime = (0, react_1.useCallback)((dateString) => {
|
|
43
46
|
return new Date(dateString).toLocaleString(undefined, {
|
|
44
47
|
hour: "2-digit",
|
|
45
48
|
minute: "2-digit",
|
|
46
49
|
hour12: false,
|
|
47
50
|
});
|
|
48
51
|
}, []);
|
|
49
|
-
return (
|
|
50
|
-
gap.all[2],
|
|
51
|
-
layout.flex.row,
|
|
52
|
-
w.percent[100],
|
|
53
|
-
borders.left.width.medium,
|
|
54
|
-
borders.left.color.gray[700],
|
|
55
|
-
ml[4],
|
|
56
|
-
pl[4],
|
|
57
|
-
opacity[80],
|
|
58
|
-
], children:
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [item.replyTo && showReply && ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
53
|
+
atoms_1.gap.all[2],
|
|
54
|
+
ui_1.layout.flex.row,
|
|
55
|
+
atoms_1.w.percent[100],
|
|
56
|
+
atoms_1.borders.left.width.medium,
|
|
57
|
+
atoms_1.borders.left.color.gray[700],
|
|
58
|
+
atoms_1.ml[4],
|
|
59
|
+
atoms_1.pl[4],
|
|
60
|
+
atoms_1.opacity[80],
|
|
61
|
+
], children: (0, jsx_runtime_1.jsxs)(text_1.Text, { numberOfLines: 1, style: [atoms_1.flex.shrink[1], atoms_1.mr[4]], children: [(0, jsx_runtime_1.jsxs)(text_1.Text, { style: {
|
|
59
62
|
color: getRgbColor(item.replyTo.chatProfile.color),
|
|
60
63
|
fontWeight: "thin",
|
|
61
|
-
}, children: ["@", item.replyTo.author.handle] }), " ",
|
|
62
|
-
color: atoms.colors.gray[300],
|
|
64
|
+
}, children: ["@", item.replyTo.author.handle] }), " ", (0, jsx_runtime_1.jsx)(text_1.Text, { style: {
|
|
65
|
+
color: ui_1.atoms.colors.gray[300],
|
|
63
66
|
fontStyle: "italic",
|
|
64
|
-
}, children: item.replyTo.record.text })] }) })),
|
|
67
|
+
}, children: item.replyTo.record.text })] }) })), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [atoms_1.gap.all[2], ui_1.layout.flex.row, atoms_1.w.percent[100]], children: [showTime && ((0, jsx_runtime_1.jsx)(text_1.Text, { style: {
|
|
65
68
|
fontVariant: ["tabular-nums"],
|
|
66
|
-
color: atoms.colors.gray[300],
|
|
67
|
-
}, children: formatTime(item.record.createdAt) })),
|
|
69
|
+
color: ui_1.atoms.colors.gray[300],
|
|
70
|
+
}, children: formatTime(item.record.createdAt) })), (0, jsx_runtime_1.jsxs)(text_1.Text, { weight: "bold", color: "default", style: [atoms_1.flex.shrink[1]], children: [(0, jsx_runtime_1.jsxs)(text_1.Text, { style: [
|
|
68
71
|
{
|
|
69
72
|
cursor: "pointer",
|
|
70
73
|
color: getRgbColor(item.chatProfile?.color),
|
|
71
74
|
},
|
|
72
|
-
], children: ["@", item.author.handle] }), ":", " ",
|
|
75
|
+
], children: ["@", item.author.handle] }), ":", " ", (0, jsx_runtime_1.jsx)(RichTextMessage, { text: item.record.text, facets: item.record.facets || [] })] })] })] }));
|
|
73
76
|
}, (prevProps, nextProps) => {
|
|
74
77
|
return (prevProps.item.author.handle === nextProps.item.author.handle &&
|
|
75
78
|
prevProps.item.record.text === nextProps.item.record.text);
|
|
@@ -1,44 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Chat = Chat;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const lucide_react_native_1 = require("lucide-react-native");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const ReanimatedSwipeable_1 = tslib_1.__importDefault(require("react-native-gesture-handler/ReanimatedSwipeable"));
|
|
10
|
+
const react_native_reanimated_1 = tslib_1.__importStar(require("react-native-reanimated"));
|
|
11
|
+
const __1 = require("../../");
|
|
12
|
+
const atoms_1 = require("../../lib/theme/atoms");
|
|
13
|
+
const chat_message_1 = require("./chat-message");
|
|
14
|
+
const mod_view_1 = require("./mod-view");
|
|
11
15
|
function RightAction(prog, drag) {
|
|
12
|
-
const styleAnimation = useAnimatedStyle(() => {
|
|
16
|
+
const styleAnimation = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
13
17
|
return {
|
|
14
18
|
transform: [{ translateX: drag.value + 25 }],
|
|
15
19
|
};
|
|
16
20
|
});
|
|
17
|
-
return (
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [styleAnimation], children: (0, jsx_runtime_1.jsx)(lucide_react_native_1.Reply, { color: "white" }) }));
|
|
18
22
|
}
|
|
19
23
|
function LeftAction(prog, drag) {
|
|
20
|
-
const styleAnimation = useAnimatedStyle(() => {
|
|
24
|
+
const styleAnimation = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
21
25
|
return {
|
|
22
26
|
transform: [{ translateX: drag.value - 25 }],
|
|
23
27
|
};
|
|
24
28
|
});
|
|
25
|
-
return (
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [styleAnimation], children: (0, jsx_runtime_1.jsx)(lucide_react_native_1.ShieldEllipsis, { color: "white" }) }));
|
|
26
30
|
}
|
|
27
|
-
const SHOWN_MSGS = Platform.OS === "android" || Platform.OS === "ios" ? 100 : 25;
|
|
31
|
+
const SHOWN_MSGS = react_native_1.Platform.OS === "android" || react_native_1.Platform.OS === "ios" ? 100 : 25;
|
|
28
32
|
const keyExtractor = (item, index) => {
|
|
29
33
|
return `${item.uri}`;
|
|
30
34
|
};
|
|
31
|
-
const ChatLine = memo(({ item }) => {
|
|
32
|
-
const setReply = useSetReplyToMessage();
|
|
33
|
-
const setModMsg = usePlayerStore((state) => state.setModMessage);
|
|
34
|
-
const swipeableRef = useRef(null);
|
|
35
|
-
return (
|
|
35
|
+
const ChatLine = (0, react_1.memo)(({ item }) => {
|
|
36
|
+
const setReply = (0, __1.useSetReplyToMessage)();
|
|
37
|
+
const setModMsg = (0, __1.usePlayerStore)((state) => state.setModMessage);
|
|
38
|
+
const swipeableRef = (0, react_1.useRef)(null);
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onLongPress: () => setModMsg(item), children: (0, jsx_runtime_1.jsx)(ReanimatedSwipeable_1.default, { containerStyle: [atoms_1.py[1]], friction: 2, enableTrackpadTwoFingerGesture: true, rightThreshold: 40, renderRightActions: react_native_1.Platform.OS === "android" ? undefined : RightAction, renderLeftActions: react_native_1.Platform.OS === "android" ? undefined : LeftAction, overshootFriction: 9, ref: (ref) => {
|
|
36
40
|
swipeableRef.current = ref;
|
|
37
41
|
}, onSwipeableOpen: (r) => {
|
|
38
|
-
if (r === (Platform.OS === "android" ? "right" : "left")) {
|
|
42
|
+
if (r === (react_native_1.Platform.OS === "android" ? "right" : "left")) {
|
|
39
43
|
setReply(item);
|
|
40
44
|
}
|
|
41
|
-
if (r === (Platform.OS === "android" ? "left" : "right")) {
|
|
45
|
+
if (r === (react_native_1.Platform.OS === "android" ? "left" : "right")) {
|
|
42
46
|
setModMsg(item);
|
|
43
47
|
}
|
|
44
48
|
// close this swipeable
|
|
@@ -46,11 +50,11 @@ const ChatLine = memo(({ item }) => {
|
|
|
46
50
|
if (swipeable) {
|
|
47
51
|
swipeable.close();
|
|
48
52
|
}
|
|
49
|
-
}, children:
|
|
53
|
+
}, children: (0, jsx_runtime_1.jsx)(chat_message_1.RenderChatMessage, { item: item }) }) }));
|
|
50
54
|
});
|
|
51
|
-
|
|
52
|
-
const chat = useChat();
|
|
55
|
+
function Chat({ shownMessages = SHOWN_MSGS, style: propsStyle, ...props }) {
|
|
56
|
+
const chat = (0, __1.useChat)();
|
|
53
57
|
if (!chat)
|
|
54
|
-
return (
|
|
55
|
-
return (
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(__1.View, { style: [atoms_1.flex.shrink[1]], children: (0, jsx_runtime_1.jsx)(__1.Text, { children: "Loading chaat..." }) }));
|
|
59
|
+
return ((0, jsx_runtime_1.jsxs)(__1.View, { style: [atoms_1.flex.shrink[1]].concat(propsStyle || []), children: [(0, jsx_runtime_1.jsx)(react_native_1.FlatList, { style: [atoms_1.flex.grow[1], atoms_1.flex.shrink[1], atoms_1.w.percent[100]], data: chat, inverted: true, keyExtractor: keyExtractor, renderItem: ({ item, index }) => (0, jsx_runtime_1.jsx)(ChatLine, { item: item }), removeClippedSubviews: true, maxToRenderPerBatch: 10, initialNumToRender: 10, updateCellsBatchingPeriod: 50 }), (0, jsx_runtime_1.jsx)(mod_view_1.ModView, {})] }));
|
|
56
60
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MentionSuggestions = MentionSuggestions;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const __1 = require("../..");
|
|
7
|
+
const atoms_1 = require("../../lib/theme/atoms");
|
|
8
|
+
function MentionSuggestions({ authors, onSelect, highlightedIndex, }) {
|
|
6
9
|
if (!authors || authors.size === 0) {
|
|
7
10
|
return null; // No authors to display
|
|
8
11
|
}
|
|
9
12
|
const authorHandles = Array.from(authors.keys());
|
|
10
|
-
return (
|
|
11
|
-
bg.gray[800],
|
|
12
|
-
layout.position.absolute,
|
|
13
|
-
left[0],
|
|
14
|
-
right[0],
|
|
15
|
-
zIndex[50],
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(__1.View, { style: [
|
|
14
|
+
atoms_1.bg.gray[800],
|
|
15
|
+
atoms_1.layout.position.absolute,
|
|
16
|
+
atoms_1.left[0],
|
|
17
|
+
atoms_1.right[0],
|
|
18
|
+
atoms_1.zIndex[50],
|
|
16
19
|
{
|
|
17
20
|
bottom: "100%",
|
|
18
21
|
borderRadius: 8,
|
|
@@ -20,7 +23,7 @@ export function MentionSuggestions({ authors, onSelect, highlightedIndex, }) {
|
|
|
20
23
|
},
|
|
21
24
|
], children: authorHandles.map((handle, index) => {
|
|
22
25
|
let profile = authors.get(handle);
|
|
23
|
-
return (
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: () => onSelect(handle), style: [
|
|
24
27
|
{
|
|
25
28
|
padding: 8,
|
|
26
29
|
flexDirection: "row",
|
|
@@ -29,7 +32,7 @@ export function MentionSuggestions({ authors, onSelect, highlightedIndex, }) {
|
|
|
29
32
|
? "rgba(0, 0, 0, 0.1)"
|
|
30
33
|
: "rgba(0, 0, 0, 0.5)",
|
|
31
34
|
},
|
|
32
|
-
], children:
|
|
35
|
+
], children: (0, jsx_runtime_1.jsxs)(__1.Text, { style: {
|
|
33
36
|
color: profile?.color
|
|
34
37
|
? `rgb(${profile.color.red}, ${profile.color.green}, ${profile.color.blue})`
|
|
35
38
|
: "black",
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModView = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const atoms_1 = require("../../lib/theme/atoms");
|
|
7
|
+
const player_store_1 = require("../../player-store");
|
|
8
|
+
const block_1 = require("../../streamplace-store/block");
|
|
9
|
+
const xrpc_1 = require("../../streamplace-store/xrpc");
|
|
10
|
+
const ui_1 = require("../ui");
|
|
11
|
+
const chat_message_1 = require("./chat-message");
|
|
12
|
+
exports.ModView = (0, react_1.forwardRef)(() => {
|
|
13
|
+
const triggerRef = (0, react_1.useRef)(null);
|
|
14
|
+
const message = (0, player_store_1.usePlayerStore)((state) => state.modMessage);
|
|
15
|
+
let agent = (0, xrpc_1.usePDSAgent)();
|
|
16
|
+
let createBlockRecord = (0, block_1.useCreateBlockRecord)();
|
|
14
17
|
if (!agent?.did) {
|
|
15
|
-
|
|
18
|
+
(0, jsx_runtime_1.jsx)(ui_1.View, { style: [ui_1.layout.flex.row, ui_1.layout.flex.alignCenter, atoms_1.gap.all[2]], children: (0, jsx_runtime_1.jsx)(ui_1.Text, { children: "Log in to submit mod actions" }) });
|
|
16
19
|
}
|
|
17
|
-
useEffect(() => {
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
18
21
|
if (message) {
|
|
19
22
|
console.log("opening mod view");
|
|
20
23
|
triggerRef.current?.open();
|
|
@@ -24,10 +27,10 @@ export const ModView = forwardRef(() => {
|
|
|
24
27
|
triggerRef.current?.close();
|
|
25
28
|
}
|
|
26
29
|
}, [message]);
|
|
27
|
-
return (
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)(ui_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(ui_1.DropdownMenuTrigger, { ref: triggerRef, children: (0, jsx_runtime_1.jsx)(ui_1.View, {}) }), (0, jsx_runtime_1.jsx)(ui_1.ResponsiveDropdownMenuContent, { children: message && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ui_1.DropdownMenuGroup, { children: (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuItem, { children: (0, jsx_runtime_1.jsx)(ui_1.View, { style: [ui_1.layout.flex.column, atoms_1.mr[5], { gap: 6 }], children: (0, jsx_runtime_1.jsx)(chat_message_1.RenderChatMessage, { item: message }) }) }) }), (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuGroup, { title: `Moderation actions`, children: (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuItem, { disabled: message.author.did === agent?.did, onPress: () => {
|
|
28
31
|
console.log("Creating block record");
|
|
29
32
|
createBlockRecord(message.author.did)
|
|
30
33
|
.then((r) => console.log(r))
|
|
31
34
|
.catch((e) => console.error(e));
|
|
32
|
-
}, children:
|
|
35
|
+
}, children: (0, jsx_runtime_1.jsx)(ui_1.Text, { color: "destructive", children: message.author.did === agent?.did ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Block yourself (you can't block yourself)" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Block user @", message.author.handle, " from this channel"] })) }) }) })] })) })] }));
|
|
33
36
|
});
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Fullscreen = Fullscreen;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
const ui_1 = require("../../components/ui");
|
|
9
|
+
const video_1 = tslib_1.__importDefault(require("./video"));
|
|
10
|
+
function Fullscreen(props) {
|
|
11
|
+
const playerId = (0, __1.getFirstPlayerID)();
|
|
12
|
+
const protocol = (0, __1.usePlayerStore)((x) => x.protocol, playerId);
|
|
13
|
+
const fullscreen = (0, __1.usePlayerStore)((x) => x.fullscreen, playerId);
|
|
14
|
+
const setFullscreen = (0, __1.usePlayerStore)((x) => x.setFullscreen, playerId);
|
|
15
|
+
const setSrc = (0, __1.usePlayerStore)((x) => x.setSrc);
|
|
16
|
+
const divRef = (0, react_1.useRef)(null);
|
|
17
|
+
const videoRef = (0, react_1.useRef)(null);
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
15
19
|
setSrc(props.src);
|
|
16
20
|
}, [props.src]);
|
|
17
|
-
useEffect(() => {
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
18
22
|
if (!divRef.current) {
|
|
19
23
|
return;
|
|
20
24
|
}
|
|
@@ -53,7 +57,7 @@ export function Fullscreen(props) {
|
|
|
53
57
|
}
|
|
54
58
|
})();
|
|
55
59
|
}, [fullscreen, protocol]);
|
|
56
|
-
useEffect(() => {
|
|
60
|
+
(0, react_1.useEffect)(() => {
|
|
57
61
|
const listener = () => {
|
|
58
62
|
console.log("fullscreenchange", document.fullscreenElement);
|
|
59
63
|
setFullscreen(!!document.fullscreenElement);
|
|
@@ -65,5 +69,5 @@ export function Fullscreen(props) {
|
|
|
65
69
|
document.body.removeEventListener("webkitfullscreenchange", listener);
|
|
66
70
|
};
|
|
67
71
|
}, []);
|
|
68
|
-
return (
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(ui_1.View, { ref: divRef, children: (0, jsx_runtime_1.jsx)(video_1.default, {}) }));
|
|
69
73
|
}
|