@syra.fm/sdk 0.4.0 → 0.5.0
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/lib/commonjs/client.js +268 -0
- package/lib/commonjs/client.js.map +1 -0
- package/lib/commonjs/errors.js +22 -0
- package/lib/commonjs/errors.js.map +1 -0
- package/lib/commonjs/index.js +63 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.native.js +28 -0
- package/lib/commonjs/index.native.js.map +1 -0
- package/lib/commonjs/live/assets/icons/spaces-icon.js +42 -0
- package/lib/commonjs/live/assets/icons/spaces-icon.js.map +1 -0
- package/lib/commonjs/live/assets/icons/syra-icon.js +43 -0
- package/lib/commonjs/live/assets/icons/syra-icon.js.map +1 -0
- package/lib/commonjs/live/components/AnimatedPulse.js +38 -0
- package/lib/commonjs/live/components/AnimatedPulse.js.map +1 -0
- package/lib/commonjs/live/components/AnimatedSpeakerRing.js +90 -0
- package/lib/commonjs/live/components/AnimatedSpeakerRing.js.map +1 -0
- package/lib/commonjs/live/components/CreateRoomSheet.js +688 -0
- package/lib/commonjs/live/components/CreateRoomSheet.js.map +1 -0
- package/lib/commonjs/live/components/InsightsPanel.js +333 -0
- package/lib/commonjs/live/components/InsightsPanel.js.map +1 -0
- package/lib/commonjs/live/components/LiveRoomSheet.js +1195 -0
- package/lib/commonjs/live/components/LiveRoomSheet.js.map +1 -0
- package/lib/commonjs/live/components/MiniRoomBar.js +161 -0
- package/lib/commonjs/live/components/MiniRoomBar.js.map +1 -0
- package/lib/commonjs/live/components/PanelHeader.js +57 -0
- package/lib/commonjs/live/components/PanelHeader.js.map +1 -0
- package/lib/commonjs/live/components/PodcastStreamPicker.js +1190 -0
- package/lib/commonjs/live/components/PodcastStreamPicker.js.map +1 -0
- package/lib/commonjs/live/components/RecordingCard.js +192 -0
- package/lib/commonjs/live/components/RecordingCard.js.map +1 -0
- package/lib/commonjs/live/components/RecordingsPanel.js +304 -0
- package/lib/commonjs/live/components/RecordingsPanel.js.map +1 -0
- package/lib/commonjs/live/components/RoomCard.js +553 -0
- package/lib/commonjs/live/components/RoomCard.js.map +1 -0
- package/lib/commonjs/live/components/StreamConfigModal.js +656 -0
- package/lib/commonjs/live/components/StreamConfigModal.js.map +1 -0
- package/lib/commonjs/live/components/StreamConfigPanel.js +822 -0
- package/lib/commonjs/live/components/StreamConfigPanel.js.map +1 -0
- package/lib/commonjs/live/context/LiveConfigContext.js +46 -0
- package/lib/commonjs/live/context/LiveConfigContext.js.map +1 -0
- package/lib/commonjs/live/context/LiveRoomContext.js +195 -0
- package/lib/commonjs/live/context/LiveRoomContext.js.map +1 -0
- package/lib/commonjs/live/hooks/useActiveSpeakers.js +35 -0
- package/lib/commonjs/live/hooks/useActiveSpeakers.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomAudio.js +129 -0
- package/lib/commonjs/live/hooks/useRoomAudio.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomConnection.js +177 -0
- package/lib/commonjs/live/hooks/useRoomConnection.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomManager.js +37 -0
- package/lib/commonjs/live/hooks/useRoomManager.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomUsers.js +52 -0
- package/lib/commonjs/live/hooks/useRoomUsers.js.map +1 -0
- package/lib/commonjs/live/index.js +310 -0
- package/lib/commonjs/live/index.js.map +1 -0
- package/lib/commonjs/live/services/livekitService.js +20 -0
- package/lib/commonjs/live/services/livekitService.js.map +1 -0
- package/lib/commonjs/live/services/spaceSocketService.js +181 -0
- package/lib/commonjs/live/services/spaceSocketService.js.map +1 -0
- package/lib/commonjs/live/services/spacesService.js +642 -0
- package/lib/commonjs/live/services/spacesService.js.map +1 -0
- package/lib/commonjs/live/types.js +6 -0
- package/lib/commonjs/live/types.js.map +1 -0
- package/lib/commonjs/live/validation.js +238 -0
- package/lib/commonjs/live/validation.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/{dist/cjs → lib/commonjs}/schema.js +55 -47
- package/lib/commonjs/schema.js.map +1 -0
- package/lib/module/client.js +264 -0
- package/lib/module/client.js.map +1 -0
- package/lib/module/errors.js +17 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.native.js +5 -0
- package/lib/module/index.native.js.map +1 -0
- package/lib/module/live/assets/icons/spaces-icon.js +34 -0
- package/lib/module/live/assets/icons/spaces-icon.js.map +1 -0
- package/lib/module/live/assets/icons/syra-icon.js +36 -0
- package/lib/module/live/assets/icons/syra-icon.js.map +1 -0
- package/lib/module/live/components/AnimatedPulse.js +33 -0
- package/lib/module/live/components/AnimatedPulse.js.map +1 -0
- package/lib/module/live/components/AnimatedSpeakerRing.js +85 -0
- package/lib/module/live/components/AnimatedSpeakerRing.js.map +1 -0
- package/lib/module/live/components/CreateRoomSheet.js +682 -0
- package/lib/module/live/components/CreateRoomSheet.js.map +1 -0
- package/lib/module/live/components/InsightsPanel.js +327 -0
- package/lib/module/live/components/InsightsPanel.js.map +1 -0
- package/lib/module/live/components/LiveRoomSheet.js +1189 -0
- package/lib/module/live/components/LiveRoomSheet.js.map +1 -0
- package/lib/module/live/components/MiniRoomBar.js +154 -0
- package/lib/module/live/components/MiniRoomBar.js.map +1 -0
- package/lib/module/live/components/PanelHeader.js +52 -0
- package/lib/module/live/components/PanelHeader.js.map +1 -0
- package/lib/module/live/components/PodcastStreamPicker.js +1183 -0
- package/lib/module/live/components/PodcastStreamPicker.js.map +1 -0
- package/lib/module/live/components/RecordingCard.js +187 -0
- package/lib/module/live/components/RecordingCard.js.map +1 -0
- package/lib/module/live/components/RecordingsPanel.js +298 -0
- package/lib/module/live/components/RecordingsPanel.js.map +1 -0
- package/lib/module/live/components/RoomCard.js +548 -0
- package/lib/module/live/components/RoomCard.js.map +1 -0
- package/lib/module/live/components/StreamConfigModal.js +650 -0
- package/lib/module/live/components/StreamConfigModal.js.map +1 -0
- package/lib/module/live/components/StreamConfigPanel.js +816 -0
- package/lib/module/live/components/StreamConfigPanel.js.map +1 -0
- package/lib/module/live/context/LiveConfigContext.js +40 -0
- package/lib/module/live/context/LiveConfigContext.js.map +1 -0
- package/lib/module/live/context/LiveRoomContext.js +189 -0
- package/lib/module/live/context/LiveRoomContext.js.map +1 -0
- package/lib/module/live/hooks/useActiveSpeakers.js +31 -0
- package/lib/module/live/hooks/useActiveSpeakers.js.map +1 -0
- package/lib/module/live/hooks/useRoomAudio.js +125 -0
- package/lib/module/live/hooks/useRoomAudio.js.map +1 -0
- package/lib/module/live/hooks/useRoomConnection.js +173 -0
- package/lib/module/live/hooks/useRoomConnection.js.map +1 -0
- package/lib/module/live/hooks/useRoomManager.js +32 -0
- package/lib/module/live/hooks/useRoomManager.js.map +1 -0
- package/lib/module/live/hooks/useRoomUsers.js +46 -0
- package/lib/module/live/hooks/useRoomUsers.js.map +1 -0
- package/lib/module/live/index.js +38 -0
- package/lib/module/live/index.js.map +1 -0
- package/lib/module/live/services/livekitService.js +16 -0
- package/lib/module/live/services/livekitService.js.map +1 -0
- package/lib/module/live/services/spaceSocketService.js +176 -0
- package/lib/module/live/services/spaceSocketService.js.map +1 -0
- package/lib/module/live/services/spacesService.js +639 -0
- package/lib/module/live/services/spacesService.js.map +1 -0
- package/lib/module/live/types.js +4 -0
- package/lib/module/live/types.js.map +1 -0
- package/lib/module/live/validation.js +229 -0
- package/lib/module/live/validation.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/{dist/esm → lib/module}/schema.js +47 -39
- package/lib/module/schema.js.map +1 -0
- package/{dist/types → lib/typescript/commonjs}/client.d.ts +1 -0
- package/lib/typescript/commonjs/client.d.ts.map +1 -0
- package/{dist/types → lib/typescript/commonjs}/errors.d.ts +1 -0
- package/lib/typescript/commonjs/errors.d.ts.map +1 -0
- package/{dist/types → lib/typescript/commonjs}/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.native.d.ts +3 -0
- package/lib/typescript/commonjs/index.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/assets/icons/spaces-icon.d.ts +13 -0
- package/lib/typescript/commonjs/live/assets/icons/spaces-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/assets/icons/syra-icon.d.ts +13 -0
- package/lib/typescript/commonjs/live/assets/icons/syra-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/AnimatedPulse.d.ts +8 -0
- package/lib/typescript/commonjs/live/components/AnimatedPulse.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/AnimatedSpeakerRing.d.ts +10 -0
- package/lib/typescript/commonjs/live/components/AnimatedSpeakerRing.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/CreateRoomSheet.d.ts +26 -0
- package/lib/typescript/commonjs/live/components/CreateRoomSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/InsightsPanel.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/InsightsPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/LiveRoomSheet.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/LiveRoomSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/MiniRoomBar.d.ts +15 -0
- package/lib/typescript/commonjs/live/components/MiniRoomBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/PanelHeader.d.ts +10 -0
- package/lib/typescript/commonjs/live/components/PanelHeader.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/PodcastStreamPicker.d.ts +54 -0
- package/lib/typescript/commonjs/live/components/PodcastStreamPicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/RecordingCard.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/RecordingCard.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/RecordingsPanel.d.ts +12 -0
- package/lib/typescript/commonjs/live/components/RecordingsPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/RoomCard.d.ts +38 -0
- package/lib/typescript/commonjs/live/components/RoomCard.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/StreamConfigModal.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/StreamConfigModal.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/StreamConfigPanel.d.ts +13 -0
- package/lib/typescript/commonjs/live/components/StreamConfigPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/context/LiveConfigContext.d.ts +78 -0
- package/lib/typescript/commonjs/live/context/LiveConfigContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/context/LiveRoomContext.d.ts +12 -0
- package/lib/typescript/commonjs/live/context/LiveRoomContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useActiveSpeakers.d.ts +3 -0
- package/lib/typescript/commonjs/live/hooks/useActiveSpeakers.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts +16 -0
- package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts +29 -0
- package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomManager.d.ts +11 -0
- package/lib/typescript/commonjs/live/hooks/useRoomManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomUsers.d.ts +5 -0
- package/lib/typescript/commonjs/live/hooks/useRoomUsers.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/index.d.ts +24 -0
- package/lib/typescript/commonjs/live/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/services/livekitService.d.ts +7 -0
- package/lib/typescript/commonjs/live/services/livekitService.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/services/spaceSocketService.d.ts +69 -0
- package/lib/typescript/commonjs/live/services/spaceSocketService.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/services/spacesService.d.ts +181 -0
- package/lib/typescript/commonjs/live/services/spacesService.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/types.d.ts +100 -0
- package/lib/typescript/commonjs/live/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/validation.d.ts +658 -0
- package/lib/typescript/commonjs/live/validation.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/{dist/types → lib/typescript/commonjs}/schema.d.ts +1 -0
- package/lib/typescript/commonjs/schema.d.ts.map +1 -0
- package/lib/typescript/module/client.d.ts +141 -0
- package/lib/typescript/module/client.d.ts.map +1 -0
- package/lib/typescript/module/errors.d.ts +9 -0
- package/lib/typescript/module/errors.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +6 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/index.native.d.ts +3 -0
- package/lib/typescript/module/index.native.d.ts.map +1 -0
- package/lib/typescript/module/live/assets/icons/spaces-icon.d.ts +13 -0
- package/lib/typescript/module/live/assets/icons/spaces-icon.d.ts.map +1 -0
- package/lib/typescript/module/live/assets/icons/syra-icon.d.ts +13 -0
- package/lib/typescript/module/live/assets/icons/syra-icon.d.ts.map +1 -0
- package/lib/typescript/module/live/components/AnimatedPulse.d.ts +8 -0
- package/lib/typescript/module/live/components/AnimatedPulse.d.ts.map +1 -0
- package/lib/typescript/module/live/components/AnimatedSpeakerRing.d.ts +10 -0
- package/lib/typescript/module/live/components/AnimatedSpeakerRing.d.ts.map +1 -0
- package/lib/typescript/module/live/components/CreateRoomSheet.d.ts +26 -0
- package/lib/typescript/module/live/components/CreateRoomSheet.d.ts.map +1 -0
- package/lib/typescript/module/live/components/InsightsPanel.d.ts +11 -0
- package/lib/typescript/module/live/components/InsightsPanel.d.ts.map +1 -0
- package/lib/typescript/module/live/components/LiveRoomSheet.d.ts +11 -0
- package/lib/typescript/module/live/components/LiveRoomSheet.d.ts.map +1 -0
- package/lib/typescript/module/live/components/MiniRoomBar.d.ts +15 -0
- package/lib/typescript/module/live/components/MiniRoomBar.d.ts.map +1 -0
- package/lib/typescript/module/live/components/PanelHeader.d.ts +10 -0
- package/lib/typescript/module/live/components/PanelHeader.d.ts.map +1 -0
- package/lib/typescript/module/live/components/PodcastStreamPicker.d.ts +54 -0
- package/lib/typescript/module/live/components/PodcastStreamPicker.d.ts.map +1 -0
- package/lib/typescript/module/live/components/RecordingCard.d.ts +11 -0
- package/lib/typescript/module/live/components/RecordingCard.d.ts.map +1 -0
- package/lib/typescript/module/live/components/RecordingsPanel.d.ts +12 -0
- package/lib/typescript/module/live/components/RecordingsPanel.d.ts.map +1 -0
- package/lib/typescript/module/live/components/RoomCard.d.ts +38 -0
- package/lib/typescript/module/live/components/RoomCard.d.ts.map +1 -0
- package/lib/typescript/module/live/components/StreamConfigModal.d.ts +11 -0
- package/lib/typescript/module/live/components/StreamConfigModal.d.ts.map +1 -0
- package/lib/typescript/module/live/components/StreamConfigPanel.d.ts +13 -0
- package/lib/typescript/module/live/components/StreamConfigPanel.d.ts.map +1 -0
- package/lib/typescript/module/live/context/LiveConfigContext.d.ts +78 -0
- package/lib/typescript/module/live/context/LiveConfigContext.d.ts.map +1 -0
- package/lib/typescript/module/live/context/LiveRoomContext.d.ts +12 -0
- package/lib/typescript/module/live/context/LiveRoomContext.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useActiveSpeakers.d.ts +3 -0
- package/lib/typescript/module/live/hooks/useActiveSpeakers.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomAudio.d.ts +16 -0
- package/lib/typescript/module/live/hooks/useRoomAudio.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomConnection.d.ts +29 -0
- package/lib/typescript/module/live/hooks/useRoomConnection.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomManager.d.ts +11 -0
- package/lib/typescript/module/live/hooks/useRoomManager.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomUsers.d.ts +5 -0
- package/lib/typescript/module/live/hooks/useRoomUsers.d.ts.map +1 -0
- package/lib/typescript/module/live/index.d.ts +24 -0
- package/lib/typescript/module/live/index.d.ts.map +1 -0
- package/lib/typescript/module/live/services/livekitService.d.ts +7 -0
- package/lib/typescript/module/live/services/livekitService.d.ts.map +1 -0
- package/lib/typescript/module/live/services/spaceSocketService.d.ts +69 -0
- package/lib/typescript/module/live/services/spaceSocketService.d.ts.map +1 -0
- package/lib/typescript/module/live/services/spacesService.d.ts +181 -0
- package/lib/typescript/module/live/services/spacesService.d.ts.map +1 -0
- package/lib/typescript/module/live/types.d.ts +100 -0
- package/lib/typescript/module/live/types.d.ts.map +1 -0
- package/lib/typescript/module/live/validation.d.ts +658 -0
- package/lib/typescript/module/live/validation.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/schema.d.ts +1072 -0
- package/lib/typescript/module/schema.d.ts.map +1 -0
- package/package.json +133 -21
- package/src/index.native.ts +2 -0
- package/src/live/assets/icons/spaces-icon.tsx +15 -0
- package/src/live/assets/icons/syra-icon.tsx +13 -0
- package/src/live/assets/sounds/intro.mp3 +0 -0
- package/src/live/components/AnimatedPulse.tsx +52 -0
- package/src/live/components/AnimatedSpeakerRing.tsx +101 -0
- package/src/live/components/CreateRoomSheet.tsx +654 -0
- package/src/live/components/InsightsPanel.tsx +202 -0
- package/src/live/components/LiveRoomSheet.tsx +969 -0
- package/src/live/components/MiniRoomBar.tsx +166 -0
- package/src/live/components/PanelHeader.tsx +36 -0
- package/src/live/components/PodcastStreamPicker.tsx +1155 -0
- package/src/live/components/RecordingCard.tsx +154 -0
- package/src/live/components/RecordingsPanel.tsx +251 -0
- package/src/live/components/RoomCard.tsx +494 -0
- package/src/live/components/StreamConfigModal.tsx +600 -0
- package/src/live/components/StreamConfigPanel.tsx +729 -0
- package/src/live/context/LiveConfigContext.tsx +96 -0
- package/src/live/context/LiveRoomContext.tsx +235 -0
- package/src/live/hooks/useActiveSpeakers.ts +39 -0
- package/src/live/hooks/useRoomAudio.ts +103 -0
- package/src/live/hooks/useRoomConnection.ts +162 -0
- package/src/live/hooks/useRoomManager.ts +17 -0
- package/src/live/hooks/useRoomUsers.ts +52 -0
- package/src/live/index.ts +92 -0
- package/src/live/services/livekitService.ts +11 -0
- package/src/live/services/spaceSocketService.ts +136 -0
- package/src/live/services/spacesService.ts +692 -0
- package/src/live/types.ts +119 -0
- package/src/live/validation.ts +279 -0
- package/dist/cjs/client.js +0 -244
- package/dist/cjs/errors.js +0 -16
- package/dist/cjs/index.js +0 -15
- package/dist/cjs/package.json +0 -3
- package/dist/esm/client.js +0 -240
- package/dist/esm/errors.js +0 -12
- package/dist/esm/index.js +0 -3
- package/dist/esm/package.json +0 -3
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, TouchableOpacity, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
4
|
+
import { useAuth } from '@oxyhq/services';
|
|
5
|
+
|
|
6
|
+
import { useLiveConfig } from '../context/LiveConfigContext';
|
|
7
|
+
import { getAvatarUrl, getDisplayName } from '../hooks/useRoomUsers';
|
|
8
|
+
import type { Recording } from '../validation';
|
|
9
|
+
|
|
10
|
+
// --- Helpers ---
|
|
11
|
+
|
|
12
|
+
const MONTH_SHORT = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
13
|
+
|
|
14
|
+
function formatDate(dateStr: string): string {
|
|
15
|
+
const d = new Date(dateStr);
|
|
16
|
+
return `${d.getDate()} ${MONTH_SHORT[d.getMonth()]} ${d.getFullYear()}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function formatDurationMs(ms: number): string {
|
|
20
|
+
const totalMin = Math.round(ms / 60_000);
|
|
21
|
+
if (totalMin < 60) return `${totalMin}m`;
|
|
22
|
+
const h = Math.floor(totalMin / 60);
|
|
23
|
+
const m = totalMin % 60;
|
|
24
|
+
return m > 0 ? `${h}h ${m}m` : `${h}h`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// --- Types ---
|
|
28
|
+
|
|
29
|
+
interface RecordingCardProps {
|
|
30
|
+
recording: Recording;
|
|
31
|
+
onPress?: () => void;
|
|
32
|
+
style?: StyleProp<ViewStyle>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// --- Component ---
|
|
36
|
+
|
|
37
|
+
export const RecordingCard: React.FC<RecordingCardProps> = ({ recording, onPress, style }) => {
|
|
38
|
+
const { useTheme, useUserById, AvatarComponent, getCachedFileDownloadUrlSync } = useLiveConfig();
|
|
39
|
+
const theme = useTheme();
|
|
40
|
+
const { oxyServices } = useAuth();
|
|
41
|
+
const hostProfile = useUserById(recording.host);
|
|
42
|
+
const hostAvatarUri = getAvatarUrl(hostProfile, oxyServices, getCachedFileDownloadUrlSync);
|
|
43
|
+
const hostName = getDisplayName(hostProfile, recording.host);
|
|
44
|
+
|
|
45
|
+
const duration = recording.durationMs ? formatDurationMs(recording.durationMs) : null;
|
|
46
|
+
const date = formatDate(recording.createdAt);
|
|
47
|
+
const listeners = recording.participantIds?.length || 0;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<TouchableOpacity
|
|
51
|
+
style={[styles.card, { backgroundColor: theme.colors.card, borderColor: theme.colors.border }, style]}
|
|
52
|
+
onPress={onPress}
|
|
53
|
+
activeOpacity={onPress ? 0.7 : 1}
|
|
54
|
+
disabled={!onPress}
|
|
55
|
+
>
|
|
56
|
+
<View style={styles.row}>
|
|
57
|
+
{/* Play icon */}
|
|
58
|
+
<View style={[styles.playIcon, { backgroundColor: theme.colors.primary + '15' }]}>
|
|
59
|
+
<MaterialCommunityIcons name="play-circle" size={28} color={theme.colors.primary} />
|
|
60
|
+
</View>
|
|
61
|
+
|
|
62
|
+
{/* Content */}
|
|
63
|
+
<View style={styles.content}>
|
|
64
|
+
<Text style={[styles.title, { color: theme.colors.text }]} numberOfLines={1}>
|
|
65
|
+
{recording.roomTitle}
|
|
66
|
+
</Text>
|
|
67
|
+
<View style={styles.meta}>
|
|
68
|
+
{hostAvatarUri && (
|
|
69
|
+
<AvatarComponent size={16} source={hostAvatarUri} shape="squircle" style={{ marginRight: 4 }} />
|
|
70
|
+
)}
|
|
71
|
+
<Text style={[styles.metaText, { color: theme.colors.textSecondary }]} numberOfLines={1}>
|
|
72
|
+
{hostName}
|
|
73
|
+
</Text>
|
|
74
|
+
<Text style={[styles.dot, { color: theme.colors.textSecondary }]}>·</Text>
|
|
75
|
+
<Text style={[styles.metaText, { color: theme.colors.textSecondary }]}>{date}</Text>
|
|
76
|
+
</View>
|
|
77
|
+
</View>
|
|
78
|
+
|
|
79
|
+
{/* Duration / Stats */}
|
|
80
|
+
<View style={styles.rightCol}>
|
|
81
|
+
{duration && (
|
|
82
|
+
<Text style={[styles.duration, { color: theme.colors.text }]}>{duration}</Text>
|
|
83
|
+
)}
|
|
84
|
+
{listeners > 0 && (
|
|
85
|
+
<View style={styles.listenersRow}>
|
|
86
|
+
<MaterialCommunityIcons name="account-group" size={12} color={theme.colors.textSecondary} />
|
|
87
|
+
<Text style={[styles.listenersText, { color: theme.colors.textSecondary }]}>{listeners}</Text>
|
|
88
|
+
</View>
|
|
89
|
+
)}
|
|
90
|
+
</View>
|
|
91
|
+
</View>
|
|
92
|
+
</TouchableOpacity>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// --- Styles ---
|
|
97
|
+
|
|
98
|
+
const styles = StyleSheet.create({
|
|
99
|
+
card: {
|
|
100
|
+
borderRadius: 12,
|
|
101
|
+
borderWidth: 1,
|
|
102
|
+
padding: 12,
|
|
103
|
+
width: 280,
|
|
104
|
+
},
|
|
105
|
+
row: {
|
|
106
|
+
flexDirection: 'row',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
gap: 10,
|
|
109
|
+
},
|
|
110
|
+
playIcon: {
|
|
111
|
+
width: 44,
|
|
112
|
+
height: 44,
|
|
113
|
+
borderRadius: 12,
|
|
114
|
+
alignItems: 'center',
|
|
115
|
+
justifyContent: 'center',
|
|
116
|
+
},
|
|
117
|
+
content: {
|
|
118
|
+
flex: 1,
|
|
119
|
+
gap: 4,
|
|
120
|
+
},
|
|
121
|
+
title: {
|
|
122
|
+
fontSize: 14,
|
|
123
|
+
fontWeight: '600',
|
|
124
|
+
},
|
|
125
|
+
meta: {
|
|
126
|
+
flexDirection: 'row',
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
},
|
|
129
|
+
metaText: {
|
|
130
|
+
fontSize: 12,
|
|
131
|
+
},
|
|
132
|
+
dot: {
|
|
133
|
+
fontSize: 10,
|
|
134
|
+
marginHorizontal: 4,
|
|
135
|
+
},
|
|
136
|
+
rightCol: {
|
|
137
|
+
alignItems: 'flex-end',
|
|
138
|
+
gap: 4,
|
|
139
|
+
},
|
|
140
|
+
duration: {
|
|
141
|
+
fontSize: 13,
|
|
142
|
+
fontWeight: '600',
|
|
143
|
+
},
|
|
144
|
+
listenersRow: {
|
|
145
|
+
flexDirection: 'row',
|
|
146
|
+
alignItems: 'center',
|
|
147
|
+
gap: 3,
|
|
148
|
+
},
|
|
149
|
+
listenersText: {
|
|
150
|
+
fontSize: 11,
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
export default RecordingCard;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, ScrollView, TouchableOpacity, ActivityIndicator } from 'react-native';
|
|
3
|
+
import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
4
|
+
|
|
5
|
+
import { PanelHeader } from './PanelHeader';
|
|
6
|
+
import { useLiveConfig } from '../context/LiveConfigContext';
|
|
7
|
+
import type { Recording, LiveTheme } from '../types';
|
|
8
|
+
|
|
9
|
+
interface RecordingsPanelProps {
|
|
10
|
+
roomId: string;
|
|
11
|
+
isHost: boolean;
|
|
12
|
+
theme: LiveTheme;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
onPlay?: (playbackUrl: string, recording: Recording) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function formatDurationMs(ms: number | null | undefined): string {
|
|
18
|
+
if (!ms) return '—';
|
|
19
|
+
const totalSecs = Math.floor(ms / 1000);
|
|
20
|
+
const hours = Math.floor(totalSecs / 3600);
|
|
21
|
+
const mins = Math.floor((totalSecs % 3600) / 60);
|
|
22
|
+
const secs = totalSecs % 60;
|
|
23
|
+
if (hours > 0) return `${hours}h ${mins}m ${secs}s`;
|
|
24
|
+
if (mins > 0) return `${mins}m ${secs}s`;
|
|
25
|
+
return `${secs}s`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function formatDate(dateStr: string): string {
|
|
29
|
+
const date = new Date(dateStr);
|
|
30
|
+
return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function RecordingsPanel({ roomId, isHost, theme, onClose, onPlay }: RecordingsPanelProps) {
|
|
34
|
+
const { roomsService, toast } = useLiveConfig();
|
|
35
|
+
const [recordings, setRecordings] = useState<Recording[]>([]);
|
|
36
|
+
const [loading, setLoading] = useState(true);
|
|
37
|
+
const [playingId, setPlayingId] = useState<string | null>(null);
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
loadRecordings();
|
|
41
|
+
}, [roomId]);
|
|
42
|
+
|
|
43
|
+
const loadRecordings = async () => {
|
|
44
|
+
setLoading(true);
|
|
45
|
+
const data = await roomsService.getRoomRecordings(roomId);
|
|
46
|
+
setRecordings(data);
|
|
47
|
+
setLoading(false);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const handlePlay = async (recording: Recording) => {
|
|
51
|
+
setPlayingId(recording._id);
|
|
52
|
+
try {
|
|
53
|
+
const result = await roomsService.getRecording(recording._id);
|
|
54
|
+
if (result?.playbackUrl) {
|
|
55
|
+
onPlay?.(result.playbackUrl, recording);
|
|
56
|
+
} else {
|
|
57
|
+
toast.error('Failed to load playback URL');
|
|
58
|
+
}
|
|
59
|
+
} catch {
|
|
60
|
+
toast.error('Failed to load recording');
|
|
61
|
+
} finally {
|
|
62
|
+
setPlayingId(null);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const handleToggleAccess = async (recording: Recording) => {
|
|
67
|
+
const newAccess = recording.access === 'public' ? 'participants' as const : 'public' as const;
|
|
68
|
+
const success = await roomsService.updateRecordingAccess(recording._id, newAccess);
|
|
69
|
+
if (success) {
|
|
70
|
+
setRecordings((prev) =>
|
|
71
|
+
prev.map((r) => r._id === recording._id ? { ...r, access: newAccess } : r)
|
|
72
|
+
);
|
|
73
|
+
toast.success(`Recording is now ${newAccess}`);
|
|
74
|
+
} else {
|
|
75
|
+
toast.error('Failed to update access');
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const handleDelete = async (recording: Recording) => {
|
|
80
|
+
const success = await roomsService.deleteRecording(recording._id);
|
|
81
|
+
if (success) {
|
|
82
|
+
setRecordings((prev) => prev.filter((r) => r._id !== recording._id));
|
|
83
|
+
toast.success('Recording deleted');
|
|
84
|
+
} else {
|
|
85
|
+
toast.error('Failed to delete recording');
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<View style={styles.container}>
|
|
91
|
+
<PanelHeader title="Recordings" theme={theme} onBack={onClose} />
|
|
92
|
+
|
|
93
|
+
<ScrollView
|
|
94
|
+
style={{ flex: 1 }}
|
|
95
|
+
contentContainerStyle={styles.scrollContent}
|
|
96
|
+
showsVerticalScrollIndicator={false}
|
|
97
|
+
>
|
|
98
|
+
{loading ? (
|
|
99
|
+
<View style={styles.centered}>
|
|
100
|
+
<ActivityIndicator color={theme.colors.primary} />
|
|
101
|
+
</View>
|
|
102
|
+
) : recordings.length === 0 ? (
|
|
103
|
+
<View style={styles.centered}>
|
|
104
|
+
<MaterialCommunityIcons name="record-circle-outline" size={40} color={theme.colors.textSecondary} />
|
|
105
|
+
<Text style={[styles.emptyText, { color: theme.colors.textSecondary }]}>
|
|
106
|
+
No recordings yet
|
|
107
|
+
</Text>
|
|
108
|
+
</View>
|
|
109
|
+
) : (
|
|
110
|
+
recordings.map((recording) => (
|
|
111
|
+
<View
|
|
112
|
+
key={recording._id}
|
|
113
|
+
style={[styles.recordingCard, { backgroundColor: `${theme.colors.card}80`, borderColor: theme.colors.border }]}
|
|
114
|
+
>
|
|
115
|
+
<View style={styles.recordingHeader}>
|
|
116
|
+
<View style={styles.recordingInfo}>
|
|
117
|
+
<Text style={[styles.recordingTitle, { color: theme.colors.text }]} numberOfLines={1}>
|
|
118
|
+
{recording.roomTitle}
|
|
119
|
+
</Text>
|
|
120
|
+
<View style={styles.recordingMeta}>
|
|
121
|
+
<Text style={[styles.recordingDate, { color: theme.colors.textSecondary }]}>
|
|
122
|
+
{formatDate(recording.startedAt)}
|
|
123
|
+
</Text>
|
|
124
|
+
<Text style={[styles.recordingDuration, { color: theme.colors.textSecondary }]}>
|
|
125
|
+
{formatDurationMs(recording.durationMs)}
|
|
126
|
+
</Text>
|
|
127
|
+
<View style={[styles.accessBadge, {
|
|
128
|
+
backgroundColor: recording.access === 'public' ? `${theme.colors.primary}1A` : '#FF98001A',
|
|
129
|
+
}]}>
|
|
130
|
+
<MaterialCommunityIcons
|
|
131
|
+
name={recording.access === 'public' ? 'earth' : 'lock'}
|
|
132
|
+
size={10}
|
|
133
|
+
color={recording.access === 'public' ? theme.colors.primary : '#FF9800'}
|
|
134
|
+
/>
|
|
135
|
+
<Text style={[styles.accessBadgeText, {
|
|
136
|
+
color: recording.access === 'public' ? theme.colors.primary : '#FF9800',
|
|
137
|
+
}]}>
|
|
138
|
+
{recording.access === 'public' ? 'Public' : 'Participants'}
|
|
139
|
+
</Text>
|
|
140
|
+
</View>
|
|
141
|
+
</View>
|
|
142
|
+
</View>
|
|
143
|
+
|
|
144
|
+
<TouchableOpacity
|
|
145
|
+
onPress={() => handlePlay(recording)}
|
|
146
|
+
disabled={playingId === recording._id}
|
|
147
|
+
style={[styles.playButton, { backgroundColor: theme.colors.primary }]}
|
|
148
|
+
>
|
|
149
|
+
{playingId === recording._id ? (
|
|
150
|
+
<ActivityIndicator size="small" color="#FFFFFF" />
|
|
151
|
+
) : (
|
|
152
|
+
<MaterialCommunityIcons name="play" size={22} color="#FFFFFF" />
|
|
153
|
+
)}
|
|
154
|
+
</TouchableOpacity>
|
|
155
|
+
</View>
|
|
156
|
+
|
|
157
|
+
{isHost && (
|
|
158
|
+
<View style={[styles.recordingActions, { borderTopColor: theme.colors.border }]}>
|
|
159
|
+
<TouchableOpacity
|
|
160
|
+
style={styles.actionButton}
|
|
161
|
+
onPress={() => handleToggleAccess(recording)}
|
|
162
|
+
>
|
|
163
|
+
<MaterialCommunityIcons
|
|
164
|
+
name={recording.access === 'public' ? 'lock' : 'earth'}
|
|
165
|
+
size={16}
|
|
166
|
+
color={theme.colors.textSecondary}
|
|
167
|
+
/>
|
|
168
|
+
<Text style={[styles.actionText, { color: theme.colors.textSecondary }]}>
|
|
169
|
+
{recording.access === 'public' ? 'Make private' : 'Make public'}
|
|
170
|
+
</Text>
|
|
171
|
+
</TouchableOpacity>
|
|
172
|
+
|
|
173
|
+
<TouchableOpacity
|
|
174
|
+
style={styles.actionButton}
|
|
175
|
+
onPress={() => handleDelete(recording)}
|
|
176
|
+
>
|
|
177
|
+
<MaterialCommunityIcons name="delete-outline" size={16} color="#FF4458" />
|
|
178
|
+
<Text style={[styles.actionText, { color: '#FF4458' }]}>Delete</Text>
|
|
179
|
+
</TouchableOpacity>
|
|
180
|
+
</View>
|
|
181
|
+
)}
|
|
182
|
+
</View>
|
|
183
|
+
))
|
|
184
|
+
)}
|
|
185
|
+
</ScrollView>
|
|
186
|
+
</View>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const styles = StyleSheet.create({
|
|
191
|
+
container: { flex: 1 },
|
|
192
|
+
scrollContent: { padding: 16, paddingBottom: 32 },
|
|
193
|
+
centered: {
|
|
194
|
+
alignItems: 'center',
|
|
195
|
+
justifyContent: 'center',
|
|
196
|
+
paddingTop: 60,
|
|
197
|
+
gap: 12,
|
|
198
|
+
},
|
|
199
|
+
emptyText: { fontSize: 15, fontWeight: '500' },
|
|
200
|
+
recordingCard: {
|
|
201
|
+
borderRadius: 12,
|
|
202
|
+
borderWidth: 1,
|
|
203
|
+
marginBottom: 10,
|
|
204
|
+
overflow: 'hidden',
|
|
205
|
+
},
|
|
206
|
+
recordingHeader: {
|
|
207
|
+
flexDirection: 'row',
|
|
208
|
+
alignItems: 'center',
|
|
209
|
+
padding: 14,
|
|
210
|
+
gap: 12,
|
|
211
|
+
},
|
|
212
|
+
recordingInfo: { flex: 1, gap: 4 },
|
|
213
|
+
recordingTitle: { fontSize: 15, fontWeight: '600' },
|
|
214
|
+
recordingMeta: {
|
|
215
|
+
flexDirection: 'row',
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
gap: 8,
|
|
218
|
+
flexWrap: 'wrap',
|
|
219
|
+
},
|
|
220
|
+
recordingDate: { fontSize: 12, fontWeight: '500' },
|
|
221
|
+
recordingDuration: { fontSize: 12, fontWeight: '500' },
|
|
222
|
+
accessBadge: {
|
|
223
|
+
flexDirection: 'row',
|
|
224
|
+
alignItems: 'center',
|
|
225
|
+
gap: 3,
|
|
226
|
+
paddingHorizontal: 6,
|
|
227
|
+
paddingVertical: 2,
|
|
228
|
+
borderRadius: 8,
|
|
229
|
+
},
|
|
230
|
+
accessBadgeText: { fontSize: 10, fontWeight: '600' },
|
|
231
|
+
playButton: {
|
|
232
|
+
width: 42,
|
|
233
|
+
height: 42,
|
|
234
|
+
borderRadius: 21,
|
|
235
|
+
alignItems: 'center',
|
|
236
|
+
justifyContent: 'center',
|
|
237
|
+
},
|
|
238
|
+
recordingActions: {
|
|
239
|
+
flexDirection: 'row',
|
|
240
|
+
borderTopWidth: 1,
|
|
241
|
+
paddingVertical: 8,
|
|
242
|
+
paddingHorizontal: 14,
|
|
243
|
+
gap: 16,
|
|
244
|
+
},
|
|
245
|
+
actionButton: {
|
|
246
|
+
flexDirection: 'row',
|
|
247
|
+
alignItems: 'center',
|
|
248
|
+
gap: 4,
|
|
249
|
+
},
|
|
250
|
+
actionText: { fontSize: 12, fontWeight: '500' },
|
|
251
|
+
});
|