@streamplace/components 0.7.13 → 0.7.15
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/package.json +13 -16
- package/src/components/mobile-player/fullscreen.native.tsx +15 -20
- package/src/components/mobile-player/fullscreen.tsx +10 -2
- package/src/components/mobile-player/player.tsx +7 -1
- package/src/components/mobile-player/props.tsx +2 -0
- package/src/components/mobile-player/video.native.tsx +28 -11
- package/src/components/mobile-player/video.tsx +14 -3
- package/src/hooks/useLivestreamInfo.ts +6 -2
- package/src/lib/browser.ts +27 -0
- package/src/livestream-store/stream-key.tsx +1 -28
- package/src/streamplace-store/stream.tsx +51 -13
- package/dist/assets/emoji-data.json +0 -19371
- package/dist/components/chat/chat-box.js +0 -314
- package/dist/components/chat/chat-message.js +0 -87
- package/dist/components/chat/chat.js +0 -149
- package/dist/components/chat/emoji-suggestions.js +0 -35
- package/dist/components/chat/mention-suggestions.js +0 -42
- package/dist/components/chat/mod-view.js +0 -94
- package/dist/components/chat/system-message.js +0 -19
- package/dist/components/dashboard/chat-panel.js +0 -38
- package/dist/components/dashboard/header.js +0 -80
- package/dist/components/dashboard/index.js +0 -14
- package/dist/components/dashboard/information-widget.js +0 -234
- package/dist/components/dashboard/mod-actions.js +0 -71
- package/dist/components/dashboard/problems.js +0 -74
- package/dist/components/icons/bluesky-icon.js +0 -9
- package/dist/components/keep-awake.js +0 -7
- package/dist/components/keep-awake.native.js +0 -16
- package/dist/components/mobile-player/fullscreen.js +0 -74
- package/dist/components/mobile-player/fullscreen.native.js +0 -155
- package/dist/components/mobile-player/player.js +0 -94
- package/dist/components/mobile-player/props.js +0 -2
- package/dist/components/mobile-player/shared.js +0 -54
- package/dist/components/mobile-player/ui/countdown.js +0 -83
- package/dist/components/mobile-player/ui/index.js +0 -11
- package/dist/components/mobile-player/ui/input.js +0 -42
- package/dist/components/mobile-player/ui/metrics.js +0 -44
- package/dist/components/mobile-player/ui/report-modal.js +0 -90
- package/dist/components/mobile-player/ui/streamer-context-menu.js +0 -7
- package/dist/components/mobile-player/ui/streamer-loading-overlay.js +0 -104
- package/dist/components/mobile-player/ui/viewer-context-menu.js +0 -51
- package/dist/components/mobile-player/ui/viewer-loading-overlay.js +0 -49
- package/dist/components/mobile-player/ui/viewers.js +0 -23
- package/dist/components/mobile-player/use-webrtc.js +0 -243
- package/dist/components/mobile-player/video-retry.js +0 -29
- package/dist/components/mobile-player/video.js +0 -460
- package/dist/components/mobile-player/video.native.js +0 -276
- package/dist/components/mobile-player/webrtc-diagnostics.js +0 -110
- package/dist/components/mobile-player/webrtc-primitives.js +0 -27
- package/dist/components/mobile-player/webrtc-primitives.native.js +0 -8
- package/dist/components/share/sharesheet.js +0 -91
- package/dist/components/ui/button.js +0 -223
- package/dist/components/ui/dialog.js +0 -206
- package/dist/components/ui/dropdown.js +0 -172
- package/dist/components/ui/icons.js +0 -25
- package/dist/components/ui/index.js +0 -34
- package/dist/components/ui/info-box.js +0 -31
- package/dist/components/ui/info-row.js +0 -23
- package/dist/components/ui/input.js +0 -205
- package/dist/components/ui/loader.js +0 -10
- package/dist/components/ui/primitives/button.js +0 -125
- package/dist/components/ui/primitives/input.js +0 -206
- package/dist/components/ui/primitives/modal.js +0 -206
- package/dist/components/ui/primitives/text.js +0 -292
- package/dist/components/ui/resizeable.js +0 -121
- package/dist/components/ui/slider.js +0 -5
- package/dist/components/ui/text.js +0 -177
- package/dist/components/ui/textarea.js +0 -19
- package/dist/components/ui/toast.js +0 -175
- package/dist/components/ui/view.js +0 -252
- package/dist/hooks/index.js +0 -14
- package/dist/hooks/useAvatars.js +0 -35
- package/dist/hooks/useCameraToggle.js +0 -12
- package/dist/hooks/useKeyboard.js +0 -36
- package/dist/hooks/useKeyboardSlide.js +0 -14
- package/dist/hooks/useLivestreamInfo.js +0 -65
- package/dist/hooks/useOuterAndInnerDimensions.js +0 -30
- package/dist/hooks/usePlayerDimensions.js +0 -22
- package/dist/hooks/usePointerDevice.js +0 -71
- package/dist/hooks/useSegmentDimensions.js +0 -17
- package/dist/hooks/useSegmentTiming.js +0 -65
- package/dist/index.js +0 -34
- package/dist/lib/facet.js +0 -92
- package/dist/lib/system-messages.js +0 -101
- package/dist/lib/theme/atoms.js +0 -646
- package/dist/lib/theme/atoms.types.js +0 -6
- package/dist/lib/theme/index.js +0 -35
- package/dist/lib/theme/theme.js +0 -256
- package/dist/lib/theme/tokens.js +0 -659
- package/dist/lib/utils.js +0 -105
- package/dist/livestream-provider/index.js +0 -30
- package/dist/livestream-provider/websocket.js +0 -45
- package/dist/livestream-store/chat.js +0 -286
- package/dist/livestream-store/context.js +0 -5
- package/dist/livestream-store/index.js +0 -7
- package/dist/livestream-store/livestream-state.js +0 -2
- package/dist/livestream-store/livestream-store.js +0 -58
- package/dist/livestream-store/problems.js +0 -76
- package/dist/livestream-store/stream-key.js +0 -119
- package/dist/livestream-store/websocket-consumer.js +0 -94
- package/dist/player-store/context.js +0 -5
- package/dist/player-store/index.js +0 -9
- package/dist/player-store/player-provider.js +0 -57
- package/dist/player-store/player-state.js +0 -25
- package/dist/player-store/player-store.js +0 -199
- package/dist/player-store/single-player-provider.js +0 -121
- package/dist/streamplace-provider/context.js +0 -5
- package/dist/streamplace-provider/index.js +0 -20
- package/dist/streamplace-provider/poller.js +0 -49
- package/dist/streamplace-provider/xrpc.js +0 -0
- package/dist/streamplace-store/block.js +0 -65
- package/dist/streamplace-store/index.js +0 -6
- package/dist/streamplace-store/stream.js +0 -218
- package/dist/streamplace-store/streamplace-store.js +0 -47
- package/dist/streamplace-store/user.js +0 -52
- package/dist/streamplace-store/xrpc.js +0 -15
- package/dist/ui/index.js +0 -79
- 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/tsconfig.tsbuildinfo +0 -1
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModView = void 0;
|
|
4
|
-
exports.ReportButton = ReportButton;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const dropdown_menu_1 = require("@rn-primitives/dropdown-menu");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const atoms_1 = require("../../lib/theme/atoms");
|
|
9
|
-
const player_store_1 = require("../../player-store");
|
|
10
|
-
const block_1 = require("../../streamplace-store/block");
|
|
11
|
-
const xrpc_1 = require("../../streamplace-store/xrpc");
|
|
12
|
-
const react_native_1 = require("react-native");
|
|
13
|
-
const streamplace_store_1 = require("../../streamplace-store");
|
|
14
|
-
const ui_1 = require("../ui");
|
|
15
|
-
const BSKY_FRONTEND_DOMAIN = "bsky.app";
|
|
16
|
-
exports.ModView = (0, react_1.forwardRef)(() => {
|
|
17
|
-
const triggerRef = (0, react_1.useRef)(null);
|
|
18
|
-
const message = (0, player_store_1.usePlayerStore)((state) => state.modMessage);
|
|
19
|
-
let agent = (0, xrpc_1.usePDSAgent)();
|
|
20
|
-
let [messageRemoved, setMessageRemoved] = (0, react_1.useState)(false);
|
|
21
|
-
let { createBlock, isLoading: isBlockLoading } = (0, block_1.useCreateBlockRecord)();
|
|
22
|
-
let { createHideChat, isLoading: isHideLoading } = (0, block_1.useCreateHideChatRecord)();
|
|
23
|
-
const setReportModalOpen = (0, player_store_1.usePlayerStore)((x) => x.setReportModalOpen);
|
|
24
|
-
const setReportSubject = (0, player_store_1.usePlayerStore)((x) => x.setReportSubject);
|
|
25
|
-
const setModMessage = (0, player_store_1.usePlayerStore)((x) => x.setModMessage);
|
|
26
|
-
// get the channel did
|
|
27
|
-
const channelId = (0, player_store_1.usePlayerStore)((state) => state.src);
|
|
28
|
-
// get the logged in user's identity
|
|
29
|
-
const handle = (0, streamplace_store_1.useStreamplaceStore)((state) => state.handle);
|
|
30
|
-
if (!agent?.did) {
|
|
31
|
-
(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" }) });
|
|
32
|
-
}
|
|
33
|
-
const cleanup = () => {
|
|
34
|
-
setModMessage(null);
|
|
35
|
-
};
|
|
36
|
-
(0, react_1.useEffect)(() => {
|
|
37
|
-
if (message) {
|
|
38
|
-
setMessageRemoved(false);
|
|
39
|
-
triggerRef.current?.open();
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
triggerRef.current?.close();
|
|
43
|
-
}
|
|
44
|
-
}, [message]);
|
|
45
|
-
return ((0, jsx_runtime_1.jsxs)(ui_1.DropdownMenu, { style: [ui_1.layout.flex.row, ui_1.layout.flex.alignCenter, atoms_1.gap.all[2], atoms_1.w[80]], onOpenChange: (isOpen) => {
|
|
46
|
-
if (!isOpen) {
|
|
47
|
-
cleanup();
|
|
48
|
-
}
|
|
49
|
-
}, 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: [
|
|
50
|
-
ui_1.layout.flex.column,
|
|
51
|
-
atoms_1.mr[5],
|
|
52
|
-
{ gap: 6, maxWidth: "100%" },
|
|
53
|
-
], children: (0, jsx_runtime_1.jsxs)(ui_1.Text, { style: {
|
|
54
|
-
fontVariant: ["tabular-nums"],
|
|
55
|
-
color: ui_1.atoms.colors.gray[300],
|
|
56
|
-
}, children: [new Date(message.record.createdAt).toLocaleTimeString([], {
|
|
57
|
-
hour: "2-digit",
|
|
58
|
-
minute: "2-digit",
|
|
59
|
-
hour12: false,
|
|
60
|
-
}), " ", "@", message.author.handle, ": ", message.record.text] }) }) }) }), channelId === handle && ((0, jsx_runtime_1.jsxs)(ui_1.DropdownMenuGroup, { title: `Moderation actions`, children: [(0, jsx_runtime_1.jsx)(ui_1.DropdownMenuItem, { disabled: isHideLoading || messageRemoved, onPress: () => {
|
|
61
|
-
if (isHideLoading || messageRemoved)
|
|
62
|
-
return;
|
|
63
|
-
createHideChat(message.uri)
|
|
64
|
-
.then((r) => setMessageRemoved(true))
|
|
65
|
-
.catch((e) => console.error(e));
|
|
66
|
-
}, children: (0, jsx_runtime_1.jsx)(ui_1.Text, { color: isHideLoading || messageRemoved ? "muted" : "destructive", children: isHideLoading
|
|
67
|
-
? "Removing..."
|
|
68
|
-
: messageRemoved
|
|
69
|
-
? "Message removed"
|
|
70
|
-
: "Remove this message" }) }), (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuItem, { disabled: message.author.did === agent?.did || isBlockLoading, onPress: () => {
|
|
71
|
-
createBlock(message.author.did)
|
|
72
|
-
.then((r) => console.log(r))
|
|
73
|
-
.catch((e) => console.error(e));
|
|
74
|
-
}, children: message.author.did === agent?.did ? ((0, jsx_runtime_1.jsx)(ui_1.Text, { color: "muted", children: "Block yourself (you can't block yourself)" })) : ((0, jsx_runtime_1.jsx)(ui_1.Text, { color: "destructive", children: isBlockLoading
|
|
75
|
-
? "Blocking..."
|
|
76
|
-
: `Block user @${message.author.handle} from this channel` })) })] })), (0, jsx_runtime_1.jsxs)(ui_1.DropdownMenuGroup, { title: `User actions`, children: [(0, jsx_runtime_1.jsx)(ui_1.DropdownMenuItem, { onPress: () => {
|
|
77
|
-
react_native_1.Linking.openURL(`https://${BSKY_FRONTEND_DOMAIN}/profile/${message.author.handle}`);
|
|
78
|
-
}, children: (0, jsx_runtime_1.jsxs)(ui_1.Text, { color: "primary", children: ["View user on ", BSKY_FRONTEND_DOMAIN] }) }), (0, jsx_runtime_1.jsx)(ReportButton, { message: message, setReportModalOpen: setReportModalOpen, setReportSubject: setReportSubject })] })] })) })] }));
|
|
79
|
-
});
|
|
80
|
-
function ReportButton({ message, setReportModalOpen, setReportSubject, }) {
|
|
81
|
-
const { onOpenChange } = (0, dropdown_menu_1.useRootContext)();
|
|
82
|
-
return ((0, jsx_runtime_1.jsx)(ui_1.DropdownMenuItem, { onPress: () => {
|
|
83
|
-
if (!message)
|
|
84
|
-
return;
|
|
85
|
-
onOpenChange?.(false);
|
|
86
|
-
setReportModalOpen(true);
|
|
87
|
-
setReportSubject({
|
|
88
|
-
$type: "com.atproto.repo.strongRef",
|
|
89
|
-
uri: message.uri,
|
|
90
|
-
cid: message.cid,
|
|
91
|
-
context: message,
|
|
92
|
-
});
|
|
93
|
-
}, children: (0, jsx_runtime_1.jsx)(ui_1.Text, { color: "warning", children: "Report chat..." }) }));
|
|
94
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SystemMessage = SystemMessage;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_native_1 = require("react-native");
|
|
6
|
-
const ui_1 = require("../../ui");
|
|
7
|
-
const ui_2 = require("../ui");
|
|
8
|
-
const text_1 = require("../ui/text");
|
|
9
|
-
function SystemMessage({ title, timestamp }) {
|
|
10
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [ui_1.w.percent[100], ui_1.px[2], ui_1.pb[2]], children: [(0, jsx_runtime_1.jsx)(text_1.Code, { color: "muted", tracking: "widest", style: [ui_1.pl[12], ui_1.ml[1]], children: "SYSTEM MESSAGE" }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [ui_1.gap.all[2], ui_1.layout.flex.row], children: [(0, jsx_runtime_1.jsx)(text_1.Text, { style: {
|
|
11
|
-
fontVariant: ["tabular-nums"],
|
|
12
|
-
color: ui_2.atoms.colors.gray[300],
|
|
13
|
-
}, children: timestamp.toLocaleTimeString([], {
|
|
14
|
-
hour: "2-digit",
|
|
15
|
-
minute: "2-digit",
|
|
16
|
-
hour12: false,
|
|
17
|
-
}) }), (0, jsx_runtime_1.jsx)(text_1.Text, { weight: "bold", color: "default", style: [ui_1.flex.shrink[1]], children: title })] })] }));
|
|
18
|
-
}
|
|
19
|
-
exports.default = SystemMessage;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = ChatPanel;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_native_1 = require("react-native");
|
|
7
|
-
const emoji_data_json_1 = tslib_1.__importDefault(require("../../assets/emoji-data.json"));
|
|
8
|
-
const zero = tslib_1.__importStar(require("../../ui"));
|
|
9
|
-
const chat_1 = require("../chat/chat");
|
|
10
|
-
const chat_box_1 = require("../chat/chat-box");
|
|
11
|
-
const { flex, bg, r, borders, p, px, py, text, layout } = zero;
|
|
12
|
-
function ChatPanel({ isLive, isConnected, messagesPerMinute = 0, canModerate = false, shownMessages = 50, }) {
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
14
|
-
flex.values[1],
|
|
15
|
-
bg.neutral[900],
|
|
16
|
-
borders.width.thin,
|
|
17
|
-
borders.color.neutral[700],
|
|
18
|
-
layout.flex.column,
|
|
19
|
-
r.lg,
|
|
20
|
-
], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
21
|
-
layout.flex.row,
|
|
22
|
-
layout.flex.spaceBetween,
|
|
23
|
-
layout.flex.alignCenter,
|
|
24
|
-
borders.bottom.width.thin,
|
|
25
|
-
borders.bottom.color.neutral[700],
|
|
26
|
-
p[4],
|
|
27
|
-
], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.white, { fontSize: 18, fontWeight: "600" }], children: "Chat" }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
28
|
-
{ width: 6, height: 6, borderRadius: 3 },
|
|
29
|
-
isLive && isConnected ? bg.green[500] : bg.gray[500],
|
|
30
|
-
] }), (0, jsx_runtime_1.jsxs)(react_native_1.Text, { style: [text.gray[400], { fontSize: 12, marginLeft: 8 }], children: [messagesPerMinute, " msg/min"] })] })] }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [flex.values[1], px[2], { minHeight: 0 }], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [flex.values[1], { minHeight: 0 }], children: (0, jsx_runtime_1.jsx)(chat_1.Chat, { canModerate: canModerate, shownMessages: shownMessages }) }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [{ flexShrink: 0 }], children: (0, jsx_runtime_1.jsx)(chat_box_1.ChatBox, { emojiData: emoji_data_json_1.default, chatBoxStyle: [
|
|
31
|
-
bg.gray[700],
|
|
32
|
-
borders.width.thin,
|
|
33
|
-
borders.color.gray[600],
|
|
34
|
-
r.md,
|
|
35
|
-
p[3],
|
|
36
|
-
!isConnected && { opacity: 0.6 },
|
|
37
|
-
] }) })] })] }));
|
|
38
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Header;
|
|
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_native_1 = require("react-native");
|
|
8
|
-
const zero = tslib_1.__importStar(require("../../ui"));
|
|
9
|
-
const { bg, r, borders, px, py, text, layout, gap } = zero;
|
|
10
|
-
function MetricItem({ icon: Icon, label, value, status }) {
|
|
11
|
-
const statusColors = {
|
|
12
|
-
good: text.green[400],
|
|
13
|
-
warning: text.yellow[400],
|
|
14
|
-
error: text.red[400],
|
|
15
|
-
};
|
|
16
|
-
const statusColor = status ? statusColors[status] : text.gray[300];
|
|
17
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter, gap.all[2]], children: [(0, jsx_runtime_1.jsx)(Icon, { size: 16, color: "#9ca3af" }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.column], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.gray[400], { fontSize: 11, fontWeight: "500" }], children: label }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [statusColor, { fontSize: 13, fontWeight: "600" }], children: value })] })] }));
|
|
18
|
-
}
|
|
19
|
-
function StatusIndicator({ status, isLive }) {
|
|
20
|
-
const getStatusColor = () => {
|
|
21
|
-
if (!isLive)
|
|
22
|
-
return bg.gray[500];
|
|
23
|
-
switch (status) {
|
|
24
|
-
case "excellent":
|
|
25
|
-
return bg.green[500];
|
|
26
|
-
case "good":
|
|
27
|
-
return bg.yellow[500];
|
|
28
|
-
case "poor":
|
|
29
|
-
return bg.orange[500];
|
|
30
|
-
case "offline":
|
|
31
|
-
return bg.red[500];
|
|
32
|
-
default:
|
|
33
|
-
return bg.gray[500];
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const getStatusText = () => {
|
|
37
|
-
if (!isLive)
|
|
38
|
-
return "OFFLINE";
|
|
39
|
-
switch (status) {
|
|
40
|
-
case "excellent":
|
|
41
|
-
return "EXCELLENT";
|
|
42
|
-
case "good":
|
|
43
|
-
return "GOOD";
|
|
44
|
-
case "poor":
|
|
45
|
-
return "POOR";
|
|
46
|
-
case "offline":
|
|
47
|
-
return "OFFLINE";
|
|
48
|
-
default:
|
|
49
|
-
return "UNKNOWN";
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter, gap.all[2]], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
53
|
-
{ width: 8, height: 8, borderRadius: 4 },
|
|
54
|
-
getStatusColor(),
|
|
55
|
-
!isLive && { opacity: 0.6 },
|
|
56
|
-
] }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
57
|
-
text.white,
|
|
58
|
-
{ fontSize: 12, fontWeight: "700", letterSpacing: 0.5 },
|
|
59
|
-
!isLive && text.gray[400],
|
|
60
|
-
], children: getStatusText() })] }));
|
|
61
|
-
}
|
|
62
|
-
function Header({ isLive, streamTitle = "Live Stream", viewers = 0, uptime = "00:00:00", bitrate = "0 mbps", timeBetweenSegments = 0, connectionStatus = "offline", }) {
|
|
63
|
-
const getConnectionQuality = () => {
|
|
64
|
-
if (timeBetweenSegments <= 1500)
|
|
65
|
-
return "good";
|
|
66
|
-
if (timeBetweenSegments <= 3000)
|
|
67
|
-
return "warning";
|
|
68
|
-
return "error";
|
|
69
|
-
};
|
|
70
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
71
|
-
px[4],
|
|
72
|
-
py[3],
|
|
73
|
-
r.lg,
|
|
74
|
-
layout.flex.row,
|
|
75
|
-
layout.flex.spaceBetween,
|
|
76
|
-
bg.neutral[900],
|
|
77
|
-
borders.width.thin,
|
|
78
|
-
borders.color.neutral[700],
|
|
79
|
-
], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter, gap.all[4]], children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.white, { fontSize: 18, fontWeight: "600" }], children: streamTitle }), (0, jsx_runtime_1.jsx)(StatusIndicator, { status: connectionStatus, isLive: isLive })] }) }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter, gap.all[6]], children: [isLive && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(MetricItem, { icon: lucide_react_native_1.Users, label: "Viewers", value: viewers.toLocaleString() }), (0, jsx_runtime_1.jsx)(MetricItem, { icon: lucide_react_native_1.Car, label: "Bitrate", value: bitrate })] })), !isLive && ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter, gap.all[2]], children: [(0, jsx_runtime_1.jsx)(lucide_react_native_1.Radio, { size: 16, color: "#6b7280" }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.gray[400], { fontSize: 13 }], children: "Stream offline" })] }))] })] }));
|
|
80
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Problems = exports.ModActions = exports.InformationWidget = exports.Header = exports.ChatPanel = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
var chat_panel_1 = require("./chat-panel");
|
|
6
|
-
Object.defineProperty(exports, "ChatPanel", { enumerable: true, get: function () { return tslib_1.__importDefault(chat_panel_1).default; } });
|
|
7
|
-
var header_1 = require("./header");
|
|
8
|
-
Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return tslib_1.__importDefault(header_1).default; } });
|
|
9
|
-
var information_widget_1 = require("./information-widget");
|
|
10
|
-
Object.defineProperty(exports, "InformationWidget", { enumerable: true, get: function () { return tslib_1.__importDefault(information_widget_1).default; } });
|
|
11
|
-
var mod_actions_1 = require("./mod-actions");
|
|
12
|
-
Object.defineProperty(exports, "ModActions", { enumerable: true, get: function () { return tslib_1.__importDefault(mod_actions_1).default; } });
|
|
13
|
-
var problems_1 = require("./problems");
|
|
14
|
-
Object.defineProperty(exports, "Problems", { enumerable: true, get: function () { return tslib_1.__importDefault(problems_1).default; } });
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = InformationWidget;
|
|
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 = tslib_1.__importStar(require("react"));
|
|
8
|
-
const react_native_1 = require("react-native");
|
|
9
|
-
const react_native_svg_1 = tslib_1.__importStar(require("react-native-svg"));
|
|
10
|
-
const livestream_store_1 = require("../../livestream-store");
|
|
11
|
-
const zero = tslib_1.__importStar(require("../../ui"));
|
|
12
|
-
const ui_1 = require("../ui");
|
|
13
|
-
const BITRATE_HISTORY_LENGTH = 30;
|
|
14
|
-
const { bg, r, borders, px, py, text, layout, gap, flex, p } = zero;
|
|
15
|
-
function InformationWidget({ embedMode = false, wideMode, // Optional override
|
|
16
|
-
showChart = true, }) {
|
|
17
|
-
const [bitrateHistory, setBitrateHistory] = (0, react_1.useState)(Array.from({ length: BITRATE_HISTORY_LENGTH }, () => 0));
|
|
18
|
-
const [showViewers, setShowViewers] = (0, react_1.useState)(false);
|
|
19
|
-
const [componentWidth, setComponentWidth] = (0, react_1.useState)(220);
|
|
20
|
-
const [componentHeight, setComponentHeight] = (0, react_1.useState)(400);
|
|
21
|
-
const [streamStartTime, setStreamStartTime] = (0, react_1.useState)(null);
|
|
22
|
-
const [layoutMeasured, setLayoutMeasured] = (0, react_1.useState)(false);
|
|
23
|
-
const isWideMode = wideMode !== undefined ? wideMode : layoutMeasured && componentWidth > 400;
|
|
24
|
-
const isCompactHeight = layoutMeasured && componentHeight < 350;
|
|
25
|
-
const seg = (0, livestream_store_1.useSegment)();
|
|
26
|
-
const livestream = (0, livestream_store_1.useLivestreamStore)((x) => x.livestream);
|
|
27
|
-
const viewers = (0, livestream_store_1.useViewers)();
|
|
28
|
-
const getBitrate = (0, react_1.useCallback)(() => {
|
|
29
|
-
if (!seg?.size || !seg?.duration)
|
|
30
|
-
return 0;
|
|
31
|
-
const kbps = (seg.size * 8) / ((seg.duration || 1000000000) / 1000000000) / 1000;
|
|
32
|
-
return kbps;
|
|
33
|
-
}, [seg?.size, seg?.duration]);
|
|
34
|
-
const getMediaInfo = (0, react_1.useMemo)(() => {
|
|
35
|
-
const videoTrack = seg?.video?.[0];
|
|
36
|
-
const audioTrack = seg?.audio?.[0];
|
|
37
|
-
return {
|
|
38
|
-
resolution: videoTrack?.width && videoTrack?.height
|
|
39
|
-
? `${videoTrack.width}x${videoTrack.height}`
|
|
40
|
-
: "Unknown",
|
|
41
|
-
fps: videoTrack?.framerate
|
|
42
|
-
? `${(videoTrack.framerate.num / videoTrack.framerate.den).toFixed(2)} FPS`
|
|
43
|
-
: "Unknown",
|
|
44
|
-
videoCodec: videoTrack?.codec
|
|
45
|
-
? videoTrack.codec.toUpperCase()
|
|
46
|
-
: "Unknown",
|
|
47
|
-
};
|
|
48
|
-
}, [seg?.video, seg?.audio]);
|
|
49
|
-
const currentBitrate = getBitrate();
|
|
50
|
-
(0, react_1.useEffect)(() => {
|
|
51
|
-
setBitrateHistory((prev) => [...prev.slice(1), currentBitrate]);
|
|
52
|
-
}, [currentBitrate]);
|
|
53
|
-
(0, react_1.useEffect)(() => {
|
|
54
|
-
if (seg?.startTime && !streamStartTime) {
|
|
55
|
-
setStreamStartTime(new Date(seg.startTime));
|
|
56
|
-
}
|
|
57
|
-
}, [seg?.startTime, streamStartTime]);
|
|
58
|
-
const getBitrateStatus = () => {
|
|
59
|
-
if (currentBitrate > 2000)
|
|
60
|
-
return "good";
|
|
61
|
-
if (currentBitrate > 1000)
|
|
62
|
-
return "warning";
|
|
63
|
-
if (currentBitrate > 0)
|
|
64
|
-
return "error";
|
|
65
|
-
return "neutral";
|
|
66
|
-
};
|
|
67
|
-
const getConnectionStatus = () => {
|
|
68
|
-
if (!seg)
|
|
69
|
-
return "error";
|
|
70
|
-
if (currentBitrate > 1500)
|
|
71
|
-
return "good";
|
|
72
|
-
if (currentBitrate > 500)
|
|
73
|
-
return "warning";
|
|
74
|
-
return "error";
|
|
75
|
-
};
|
|
76
|
-
const avgBitrate = bitrateHistory.length > 0
|
|
77
|
-
? bitrateHistory.reduce((a, b) => a + b, 0) / bitrateHistory.length
|
|
78
|
-
: 0;
|
|
79
|
-
const peakBitrate = Math.max(...bitrateHistory, 0);
|
|
80
|
-
const uptimeMinutes = streamStartTime
|
|
81
|
-
? Math.floor((Date.now() - streamStartTime.getTime()) / 60000)
|
|
82
|
-
: 0;
|
|
83
|
-
const estimatedLatency = seg?.duration
|
|
84
|
-
? Math.floor((seg.duration / 1000000000) * 2)
|
|
85
|
-
: 0;
|
|
86
|
-
const displayBitrate = `${(currentBitrate / 1000).toFixed(2)} Mbps`;
|
|
87
|
-
const displayResolution = getMediaInfo.resolution;
|
|
88
|
-
const displayFps = getMediaInfo.fps;
|
|
89
|
-
const streamTitle = livestream?.record?.title || "Untitled Stream";
|
|
90
|
-
const viewerCount = viewers ?? 0;
|
|
91
|
-
const handleLayout = (0, react_1.useCallback)((event) => {
|
|
92
|
-
const { width, height } = event.nativeEvent.layout;
|
|
93
|
-
console.log("InformationWidget onLayout - size:", `${width}x${height}`);
|
|
94
|
-
if (width > 0 && height > 0) {
|
|
95
|
-
setComponentWidth(width);
|
|
96
|
-
setComponentHeight(height);
|
|
97
|
-
setLayoutMeasured(true);
|
|
98
|
-
}
|
|
99
|
-
}, []);
|
|
100
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { onLayout: handleLayout, style: [
|
|
101
|
-
embedMode
|
|
102
|
-
? { backgroundColor: "rgba(23, 23, 23, 0.9)" }
|
|
103
|
-
: bg.neutral[900],
|
|
104
|
-
embedMode ? undefined : borders.width.thin,
|
|
105
|
-
embedMode ? undefined : borders.color.neutral[700],
|
|
106
|
-
r.lg,
|
|
107
|
-
px[4],
|
|
108
|
-
py[4],
|
|
109
|
-
gap.all[6],
|
|
110
|
-
flex.values[1],
|
|
111
|
-
{
|
|
112
|
-
minWidth: isWideMode ? 500 : 220,
|
|
113
|
-
width: "100%",
|
|
114
|
-
},
|
|
115
|
-
], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
116
|
-
layout.flex.row,
|
|
117
|
-
layout.flex.spaceBetween,
|
|
118
|
-
layout.flex.alignCenter,
|
|
119
|
-
], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter, gap.all[1]], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.white, { fontSize: 18, fontWeight: "700" }], numberOfLines: 1, children: "Stream Health" }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
120
|
-
{
|
|
121
|
-
width: 8,
|
|
122
|
-
height: 8,
|
|
123
|
-
borderRadius: 4,
|
|
124
|
-
backgroundColor: getConnectionStatus() === "good"
|
|
125
|
-
? "#22c55e"
|
|
126
|
-
: getConnectionStatus() === "warning"
|
|
127
|
-
? "#f59e0b"
|
|
128
|
-
: "#ef4444",
|
|
129
|
-
},
|
|
130
|
-
] })] }), (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { onPress: () => setShowViewers(!showViewers), style: [
|
|
131
|
-
layout.flex.column,
|
|
132
|
-
layout.flex.alignCenter,
|
|
133
|
-
gap.all[1],
|
|
134
|
-
{ minWidth: 120 },
|
|
135
|
-
], children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter, gap.all[2]], children: [showViewers ? ((0, jsx_runtime_1.jsx)(lucide_react_native_1.Eye, { size: 14, color: "#9ca3af" })) : ((0, jsx_runtime_1.jsx)(lucide_react_native_1.EyeClosed, { size: 14, color: "#9ca3af" })), (0, jsx_runtime_1.jsxs)(react_native_1.Text, { style: [
|
|
136
|
-
text.white,
|
|
137
|
-
{ fontSize: 16, fontWeight: "600", textAlign: "center" },
|
|
138
|
-
], children: [showViewers ? `${viewerCount}` : "...", " viewer", showViewers && viewerCount !== 1 ? "s" : ""] })] }) })] }), isWideMode ? ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [gap.all[3]], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, gap.all[2]], children: [(0, jsx_runtime_1.jsx)(ui_1.InfoBox, { icon: lucide_react_native_1.Car, label: "Bitrate", value: displayBitrate, status: getBitrateStatus() }), (0, jsx_runtime_1.jsx)(ui_1.InfoBox, { icon: lucide_react_native_1.Monitor, label: "Resolution", value: displayResolution }), (0, jsx_runtime_1.jsx)(ui_1.InfoBox, { icon: lucide_react_native_1.Video, label: "FPS", value: displayFps })] }), showChart && ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [gap.all[2]], children: [!isCompactHeight && ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
139
|
-
layout.flex.row,
|
|
140
|
-
layout.flex.spaceBetween,
|
|
141
|
-
layout.flex.alignCenter,
|
|
142
|
-
], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
143
|
-
text.gray[200],
|
|
144
|
-
{ fontSize: 14, fontWeight: "600" },
|
|
145
|
-
], children: "Live Performance" }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, gap.all[4]], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.alignCenter], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
146
|
-
text.gray[400],
|
|
147
|
-
{ fontSize: 11, fontWeight: "500" },
|
|
148
|
-
], children: "AVG" }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
149
|
-
text.white,
|
|
150
|
-
{ fontSize: 13, fontWeight: "600" },
|
|
151
|
-
], children: avgBitrate > 0
|
|
152
|
-
? `${(avgBitrate / 1000).toFixed(1)}M`
|
|
153
|
-
: "0M" })] }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.alignCenter], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
154
|
-
text.gray[400],
|
|
155
|
-
{ fontSize: 11, fontWeight: "500" },
|
|
156
|
-
], children: "PEAK" }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
157
|
-
text.white,
|
|
158
|
-
{ fontSize: 13, fontWeight: "600" },
|
|
159
|
-
], children: peakBitrate > 0
|
|
160
|
-
? `${(peakBitrate / 1000).toFixed(1)}M`
|
|
161
|
-
: "0M" })] }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.alignCenter], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
162
|
-
text.gray[400],
|
|
163
|
-
{ fontSize: 11, fontWeight: "500" },
|
|
164
|
-
], children: "CAPTURED" }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
165
|
-
text.white,
|
|
166
|
-
{ fontSize: 13, fontWeight: "600" },
|
|
167
|
-
], children: uptimeMinutes > 60
|
|
168
|
-
? `${Math.floor(uptimeMinutes / 60)}h ${uptimeMinutes % 60}m`
|
|
169
|
-
: `${uptimeMinutes}m` })] })] })] })), (0, jsx_runtime_1.jsx)(BitrateChart, { data: bitrateHistory, width: componentWidth - 40, height: 120 })] }))] })) : ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [gap.all[3]], children: [!isCompactHeight && ((0, jsx_runtime_1.jsxs)(react_native_1.TouchableOpacity, { onPress: () => setShowViewers(!showViewers), style: [
|
|
170
|
-
layout.flex.row,
|
|
171
|
-
layout.flex.spaceBetween,
|
|
172
|
-
layout.flex.alignCenter,
|
|
173
|
-
py[2],
|
|
174
|
-
], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter, gap.all[3]], children: [(0, jsx_runtime_1.jsx)(lucide_react_native_1.Eye, { size: 16, color: "#9ca3af" }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.gray[300], { fontSize: 13, fontWeight: "500" }], children: "Viewers" })] }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [layout.flex.row, layout.flex.alignCenter, gap.all[2]], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
175
|
-
showViewers ? text.green[400] : text.white,
|
|
176
|
-
{ fontSize: 13, fontWeight: "600" },
|
|
177
|
-
], children: showViewers ? `${viewerCount} watching` : "•••" }), showViewers ? ((0, jsx_runtime_1.jsx)(lucide_react_native_1.ChevronUp, { size: 14, color: "#9ca3af" })) : ((0, jsx_runtime_1.jsx)(lucide_react_native_1.ChevronDown, { size: 14, color: "#9ca3af" }))] })] })), showChart && ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [gap.all[2]], children: [!isCompactHeight && ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
178
|
-
layout.flex.row,
|
|
179
|
-
layout.flex.spaceBetween,
|
|
180
|
-
layout.flex.alignCenter,
|
|
181
|
-
], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
182
|
-
text.gray[200],
|
|
183
|
-
{ fontSize: 14, fontWeight: "600" },
|
|
184
|
-
], children: "Performance" }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
185
|
-
text.gray[400],
|
|
186
|
-
{ fontSize: 11, fontWeight: "500" },
|
|
187
|
-
], children: avgBitrate > 0
|
|
188
|
-
? `AVG ${(avgBitrate / 1000).toFixed(1)}M`
|
|
189
|
-
: "No data" })] })), (0, jsx_runtime_1.jsx)(BitrateChart, { data: bitrateHistory, width: componentWidth - 40, height: isCompactHeight ? 80 : 120 })] })), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [gap.all[1]], children: [(0, jsx_runtime_1.jsx)(ui_1.InfoRow, { icon: lucide_react_native_1.Signal, label: "Connection", value: getConnectionStatus() === "good"
|
|
190
|
-
? "Excellent"
|
|
191
|
-
: getConnectionStatus() === "warning"
|
|
192
|
-
? "Good"
|
|
193
|
-
: "Poor", status: getConnectionStatus() }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [gap.all[1], layout.flex.row], children: [(0, jsx_runtime_1.jsx)(ui_1.InfoBox, { icon: lucide_react_native_1.Zap, label: "Bitrate", value: displayBitrate, status: getBitrateStatus() }), (0, jsx_runtime_1.jsx)(ui_1.InfoBox, { icon: lucide_react_native_1.Video, label: "FPS", value: displayFps })] })] })] }))] }));
|
|
194
|
-
}
|
|
195
|
-
function BitrateChart({ data, width, height, }) {
|
|
196
|
-
const maxDataValue = Math.max(...data, 1);
|
|
197
|
-
const minDataValue = Math.min(...data);
|
|
198
|
-
const getSmartRange = (max) => {
|
|
199
|
-
if (max <= 1000)
|
|
200
|
-
return { min: 0, max: 1000, step: 500 };
|
|
201
|
-
if (max <= 2000)
|
|
202
|
-
return { min: 1000, max: 2000, step: 1000 };
|
|
203
|
-
if (max <= 7000)
|
|
204
|
-
return { min: 4000, max: 7000, step: 1500 };
|
|
205
|
-
if (max <= 10000)
|
|
206
|
-
return { min: 4000, max: 10000, step: 5000 };
|
|
207
|
-
const roundedMax = Math.ceil(max / 5000) * 5000;
|
|
208
|
-
return { min: 0, max: roundedMax, step: roundedMax / 2 };
|
|
209
|
-
};
|
|
210
|
-
const { min: minValue, max: maxValue, step } = getSmartRange(maxDataValue);
|
|
211
|
-
const range = maxValue - minValue;
|
|
212
|
-
const chartWidth = width - 40;
|
|
213
|
-
const chartStartX = 40;
|
|
214
|
-
const verticalPadding = 10;
|
|
215
|
-
const chartHeight = height - verticalPadding * 2;
|
|
216
|
-
const points = data
|
|
217
|
-
.map((value, index) => {
|
|
218
|
-
const x = chartStartX + (index / (data.length - 1)) * chartWidth;
|
|
219
|
-
// Clamp value to chart range and plot against the smart scale
|
|
220
|
-
const clampedValue = Math.max(minValue, Math.min(maxValue, value));
|
|
221
|
-
const y = verticalPadding +
|
|
222
|
-
chartHeight -
|
|
223
|
-
((clampedValue - minValue) / range) * chartHeight;
|
|
224
|
-
return `${x},${y}`;
|
|
225
|
-
})
|
|
226
|
-
.join(" ");
|
|
227
|
-
const pathData = `M ${points.replace(/ /g, " L ")}`;
|
|
228
|
-
const ticks = [
|
|
229
|
-
{ value: minValue, y: height - verticalPadding },
|
|
230
|
-
{ value: minValue + step, y: height / 2 },
|
|
231
|
-
{ value: maxValue, y: verticalPadding },
|
|
232
|
-
];
|
|
233
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: { height, width, marginVertical: 8 }, children: (0, jsx_runtime_1.jsxs)(react_native_svg_1.default, { width: width, height: height, children: [ticks.map((tick, index) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Line, { x1: chartStartX, y1: tick.y, x2: width, y2: tick.y, stroke: "rgba(255,255,255,0.1)", strokeWidth: "1" }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Text, { x: "35", y: tick.y + 4, fontSize: 10, fontFamily: "sans-serif", fill: "#9ca3af", textAnchor: "end", children: (tick.value / 1000).toLocaleString() })] }, index))), (0, jsx_runtime_1.jsx)(react_native_svg_1.Text, { x: 12, y: height / 2, transform: `rotate(-90, 12, ${height / 2})`, fontSize: 10, fontFamily: "sans-serif", fill: "#9ca3af", textAnchor: "middle", children: "mbits/s" }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Path, { d: pathData, stroke: "#22c55e", strokeWidth: "2", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" })] }) }));
|
|
234
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = ModActions;
|
|
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_native_1 = require("react-native");
|
|
8
|
-
const zero = tslib_1.__importStar(require("../../ui"));
|
|
9
|
-
const { flex, bg, r, borders, p, text, layout, gap, mb } = zero;
|
|
10
|
-
const defaultActions = [
|
|
11
|
-
{
|
|
12
|
-
icon: lucide_react_native_1.Shield,
|
|
13
|
-
label: "Ban User",
|
|
14
|
-
color: "red",
|
|
15
|
-
action: () => console.log("Ban user action"),
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
icon: lucide_react_native_1.MessageCircle,
|
|
19
|
-
label: "Timeout",
|
|
20
|
-
color: "yellow",
|
|
21
|
-
action: () => console.log("Timeout user action"),
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
icon: lucide_react_native_1.Eye,
|
|
25
|
-
label: "Monitor",
|
|
26
|
-
color: "blue",
|
|
27
|
-
action: () => console.log("Monitor stream action"),
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
icon: lucide_react_native_1.AlertTriangle,
|
|
31
|
-
label: "Report",
|
|
32
|
-
color: "orange",
|
|
33
|
-
action: () => console.log("Report content action"),
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
function ModActions({ isLive, isConnected, messageCount = 0, actions = defaultActions, }) {
|
|
37
|
-
const canModerate = isLive && isConnected;
|
|
38
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
39
|
-
flex.values[1],
|
|
40
|
-
bg.gray[800],
|
|
41
|
-
r[3],
|
|
42
|
-
borders.width.thin,
|
|
43
|
-
borders.color.gray[700],
|
|
44
|
-
p[4],
|
|
45
|
-
], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
46
|
-
layout.flex.row,
|
|
47
|
-
layout.flex.spaceBetween,
|
|
48
|
-
layout.flex.alignCenter,
|
|
49
|
-
mb[4],
|
|
50
|
-
], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.white, { fontSize: 18, fontWeight: "600" }], children: "Moderation" }), (0, jsx_runtime_1.jsxs)(react_native_1.Text, { style: [text.gray[400], { fontSize: 12 }], children: [messageCount, " messages"] })] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [layout.flex.row, gap.all[3]], children: actions.map((action, index) => ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { style: [
|
|
51
|
-
flex.grow[1],
|
|
52
|
-
bg.gray[700],
|
|
53
|
-
r[2],
|
|
54
|
-
p[3],
|
|
55
|
-
layout.flex.row,
|
|
56
|
-
layout.flex.alignCenter,
|
|
57
|
-
gap.all[2],
|
|
58
|
-
borders.width.thin,
|
|
59
|
-
borders.color.gray[600],
|
|
60
|
-
], disabled: !canModerate, onPress: action.action, children: [(0, jsx_runtime_1.jsx)(action.icon, { size: 20, color: canModerate ? "#ffffff" : "#6b7280" }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
61
|
-
canModerate ? text.white : text.gray[400],
|
|
62
|
-
{ fontSize: 14, fontWeight: "500" },
|
|
63
|
-
], children: action.label })] }, index))) }), !canModerate && ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
64
|
-
text.gray[500],
|
|
65
|
-
{ fontSize: 12, textAlign: "center", marginTop: 16 },
|
|
66
|
-
], children: !isLive
|
|
67
|
-
? "Moderation tools available when live"
|
|
68
|
-
: !isConnected
|
|
69
|
-
? "Waiting for stream connection..."
|
|
70
|
-
: "Moderation tools unavailable" }))] }));
|
|
71
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProblemsWrapper = void 0;
|
|
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 livestream_store_1 = require("../../livestream-store");
|
|
10
|
-
const zero = tslib_1.__importStar(require("../../ui"));
|
|
11
|
-
const { bg, r, borders, p, text, layout, gap } = zero;
|
|
12
|
-
const Problems = ({ probs, onIgnore, }) => {
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [gap.all[3]], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.white, { fontSize: 24, fontWeight: "bold" }], children: "Optimize Your Stream" }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.gray[300]], children: "We've found a few things that could improve your stream's reliability." })] }), probs.map((p) => ((0, jsx_runtime_1.jsx)(react_native_1.View, { children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
14
|
-
gap.all[2],
|
|
15
|
-
layout.flex.row,
|
|
16
|
-
layout.flex.alignCenter,
|
|
17
|
-
{ gap: 8, alignItems: "flex-start" },
|
|
18
|
-
], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
19
|
-
r.sm,
|
|
20
|
-
p[2],
|
|
21
|
-
{
|
|
22
|
-
width: 82,
|
|
23
|
-
textAlign: "center",
|
|
24
|
-
backgroundColor: p.severity === "error"
|
|
25
|
-
? "#7f1d1d"
|
|
26
|
-
: p.severity === "warning"
|
|
27
|
-
? "#7c2d12"
|
|
28
|
-
: "#1e3a8a",
|
|
29
|
-
color: "white",
|
|
30
|
-
fontSize: 12,
|
|
31
|
-
},
|
|
32
|
-
], children: p.severity }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [{ flex: 1 }, gap.all[1]], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.white, { fontWeight: "600" }], children: p.code }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.gray[400], { fontSize: 14 }], children: p.message }), p.link && ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: () => p.link && react_native_1.Linking.openURL(p.link), children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
33
|
-
layout.flex.row,
|
|
34
|
-
layout.flex.alignCenter,
|
|
35
|
-
gap.all[2],
|
|
36
|
-
], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [{ color: "#3b82f6", fontSize: 14 }], children: "Learn More" }), (0, jsx_runtime_1.jsx)(lucide_react_native_1.ExternalLink, { size: 12, color: "#3b82f6" })] }) }))] })] }) }, p.message))), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: onIgnore, style: [
|
|
37
|
-
bg.blue[600],
|
|
38
|
-
r.md,
|
|
39
|
-
p[3],
|
|
40
|
-
layout.flex.center,
|
|
41
|
-
{ marginTop: 16 },
|
|
42
|
-
], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [text.white, { fontWeight: "600" }], children: "Ignore" }) })] }));
|
|
43
|
-
};
|
|
44
|
-
const ProblemsWrapper = ({ children, }) => {
|
|
45
|
-
const problems = (0, livestream_store_1.useLivestreamStore)((x) => x.problems);
|
|
46
|
-
const [dismiss, setDismiss] = (0, react_1.useState)(false);
|
|
47
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
48
|
-
{ position: "relative", flex: 1 },
|
|
49
|
-
layout.flex.center,
|
|
50
|
-
{ flexBasis: 0 },
|
|
51
|
-
], children: [children, problems.length > 0 && !dismiss && ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
52
|
-
{
|
|
53
|
-
position: "absolute",
|
|
54
|
-
top: 0,
|
|
55
|
-
left: 0,
|
|
56
|
-
right: 0,
|
|
57
|
-
bottom: 0,
|
|
58
|
-
backgroundColor: "rgba(0, 0, 0, 0.8)",
|
|
59
|
-
zIndex: 100,
|
|
60
|
-
},
|
|
61
|
-
layout.flex.center,
|
|
62
|
-
{ justifyContent: "flex-start" },
|
|
63
|
-
p[8],
|
|
64
|
-
], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
65
|
-
bg.gray[900],
|
|
66
|
-
borders.color.gray[700],
|
|
67
|
-
borders.width.thin,
|
|
68
|
-
r.lg,
|
|
69
|
-
p[4],
|
|
70
|
-
{ maxWidth: 700, width: "100%" },
|
|
71
|
-
], children: (0, jsx_runtime_1.jsx)(Problems, { probs: problems, onIgnore: () => setDismiss(true) }) }) }))] }));
|
|
72
|
-
};
|
|
73
|
-
exports.ProblemsWrapper = ProblemsWrapper;
|
|
74
|
-
exports.default = Problems;
|