@streamplace/components 0.7.9 → 0.7.11

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.
@@ -20,6 +20,8 @@ exports.ModView = (0, react_1.forwardRef)(() => {
20
20
  let [messageRemoved, setMessageRemoved] = (0, react_1.useState)(false);
21
21
  let { createBlock, isLoading: isBlockLoading } = (0, block_1.useCreateBlockRecord)();
22
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);
23
25
  // get the channel did
24
26
  const channelId = (0, player_store_1.usePlayerStore)((state) => state.src);
25
27
  // get the logged in user's identity
@@ -66,12 +68,10 @@ exports.ModView = (0, react_1.forwardRef)(() => {
66
68
  }, 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
67
69
  ? "Blocking..."
68
70
  : `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: () => {
69
- react_native_1.Linking.openURL(`https://${BSKY_FRONTEND_DOMAIN}/profile/${channelId}`);
70
- }, 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 })] })] })) })] }));
71
+ react_native_1.Linking.openURL(`https://${BSKY_FRONTEND_DOMAIN}/profile/${message.author.handle}`);
72
+ }, 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 })] })] })) })] }));
71
73
  });
72
- function ReportButton({ message, }) {
73
- const setReportModalOpen = (0, player_store_1.usePlayerStore)((x) => x.setReportModalOpen);
74
- const setReportSubject = (0, player_store_1.usePlayerStore)((x) => x.setReportSubject);
74
+ function ReportButton({ message, setReportModalOpen, setReportSubject, }) {
75
75
  const { onOpenChange } = (0, dropdown_menu_1.useRootContext)();
76
76
  return ((0, jsx_runtime_1.jsx)(ui_1.DropdownMenuItem, { onPress: () => {
77
77
  if (!message)
@@ -17,16 +17,16 @@ function ContextMenu() {
17
17
  const setProtocol = (0, player_store_1.usePlayerStore)((x) => x.setProtocol);
18
18
  const debugInfo = (0, player_store_1.usePlayerStore)((x) => x.showDebugInfo);
19
19
  const setShowDebugInfo = (0, player_store_1.usePlayerStore)((x) => x.setShowDebugInfo);
20
+ const livestream = (0, livestream_store_1.useLivestreamStore)((x) => x.livestream);
21
+ const setReportModalOpen = (0, player_store_1.usePlayerStore)((x) => x.setReportModalOpen);
22
+ const setReportSubject = (0, player_store_1.usePlayerStore)((x) => x.setReportSubject);
20
23
  const lowLatency = protocol === "webrtc";
21
24
  const setLowLatency = (value) => {
22
25
  setProtocol(value ? player_store_1.PlayerProtocol.WEBRTC : player_store_1.PlayerProtocol.HLS);
23
26
  };
24
- return ((0, jsx_runtime_1.jsxs)(ui_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(ui_1.DropdownMenuTrigger, { children: (0, jsx_runtime_1.jsx)(lucide_react_native_1.Settings, { color: theme_1.colors.gray[200] }) }), (0, jsx_runtime_1.jsxs)(ui_1.ResponsiveDropdownMenuContent, { side: "top", align: "end", children: [(0, jsx_runtime_1.jsx)(ui_1.DropdownMenuGroup, { title: "Resolution", children: (0, jsx_runtime_1.jsxs)(ui_1.DropdownMenuRadioGroup, { value: quality, onValueChange: setQuality, children: [(0, jsx_runtime_1.jsx)(ui_1.DropdownMenuRadioItem, { value: "source", children: (0, jsx_runtime_1.jsx)(ui_1.Text, { children: "Source (Original Quality)" }) }), qualities.map((r) => ((0, jsx_runtime_1.jsx)(ui_1.DropdownMenuRadioItem, { value: r.name, children: (0, jsx_runtime_1.jsx)(ui_1.Text, { children: r.name }) })))] }) }), (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuGroup, { title: "Advanced", children: (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuCheckboxItem, { checked: lowLatency, onCheckedChange: () => setLowLatency(!lowLatency), children: (0, jsx_runtime_1.jsx)(ui_1.Text, { children: "Low Latency" }) }) }), (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuInfo, { description: "Reduces the delay between video and chat for a more real-time experience." }), (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuGroup, { children: (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuCheckboxItem, { checked: debugInfo, onCheckedChange: () => setShowDebugInfo(!debugInfo), children: (0, jsx_runtime_1.jsx)(ui_1.Text, { children: "Show Debug Info" }) }) }), (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuGroup, { title: "Report", children: (0, jsx_runtime_1.jsx)(ReportButton, {}) })] })] }));
27
+ return ((0, jsx_runtime_1.jsxs)(ui_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(ui_1.DropdownMenuTrigger, { children: (0, jsx_runtime_1.jsx)(lucide_react_native_1.Settings, { color: theme_1.colors.gray[200] }) }), (0, jsx_runtime_1.jsxs)(ui_1.ResponsiveDropdownMenuContent, { side: "top", align: "end", children: [(0, jsx_runtime_1.jsx)(ui_1.DropdownMenuGroup, { title: "Resolution", children: (0, jsx_runtime_1.jsxs)(ui_1.DropdownMenuRadioGroup, { value: quality, onValueChange: setQuality, children: [(0, jsx_runtime_1.jsx)(ui_1.DropdownMenuRadioItem, { value: "source", children: (0, jsx_runtime_1.jsx)(ui_1.Text, { children: "Source (Original Quality)" }) }), qualities.map((r) => ((0, jsx_runtime_1.jsx)(ui_1.DropdownMenuRadioItem, { value: r.name, children: (0, jsx_runtime_1.jsx)(ui_1.Text, { children: r.name }) })))] }) }), (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuGroup, { title: "Advanced", children: (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuCheckboxItem, { checked: lowLatency, onCheckedChange: () => setLowLatency(!lowLatency), children: (0, jsx_runtime_1.jsx)(ui_1.Text, { children: "Low Latency" }) }) }), (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuInfo, { description: "Reduces the delay between video and chat for a more real-time experience." }), (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuGroup, { children: (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuCheckboxItem, { checked: debugInfo, onCheckedChange: () => setShowDebugInfo(!debugInfo), children: (0, jsx_runtime_1.jsx)(ui_1.Text, { children: "Show Debug Info" }) }) }), (0, jsx_runtime_1.jsx)(ui_1.DropdownMenuGroup, { title: "Report", children: (0, jsx_runtime_1.jsx)(ReportButton, { livestream: livestream, setReportModalOpen: setReportModalOpen, setReportSubject: setReportSubject }) })] })] }));
25
28
  }
26
- function ReportButton() {
27
- const livestream = (0, livestream_store_1.useLivestreamStore)((x) => x.livestream);
28
- const setReportModalOpen = (0, player_store_1.usePlayerStore)((x) => x.setReportModalOpen);
29
- const setReportSubject = (0, player_store_1.usePlayerStore)((x) => x.setReportSubject);
29
+ function ReportButton({ livestream, setReportModalOpen, setReportSubject, }) {
30
30
  const { onOpenChange } = (0, dropdown_menu_1.useRootContext)();
31
31
  return ((0, jsx_runtime_1.jsx)(ui_1.DropdownMenuItem, { onPress: () => {
32
32
  if (!livestream)
@@ -77,6 +77,8 @@ exports.DropdownMenuContent = (0, react_1.forwardRef)(({ overlayStyle, portalHos
77
77
  atoms_1.a.shadows.md,
78
78
  ], ...props }) }) }));
79
79
  });
80
+ /// Responsive Dropdown Menu Content. On mobile this will render a *bottom sheet* that is **portaled to the root of the app**.
81
+ /// Prefer passing scoped content in as **otherwise it may crash the app**.
80
82
  exports.ResponsiveDropdownMenuContent = (0, react_1.forwardRef)(({ children, ...props }, ref) => {
81
83
  const { width } = (0, react_native_1.useWindowDimensions)();
82
84
  // On web, you might want to always use the normal dropdown
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamplace/components",
3
- "version": "0.7.9",
3
+ "version": "0.7.11",
4
4
  "description": "Streamplace React (Native) Components",
5
5
  "main": "dist/index.js",
6
6
  "types": "src/index.tsx",
@@ -54,5 +54,5 @@
54
54
  "peerDependencies": {
55
55
  "react": "*"
56
56
  },
57
- "gitHead": "3fb5c967d2fc25e07f394829e44a48090de73a2d"
57
+ "gitHead": "e78005bfaba2a1e9845f1e21c9ce88af6a42ebf1"
58
58
  }
@@ -45,6 +45,9 @@ export const ModView = forwardRef<ModViewRef, ModViewProps>(() => {
45
45
  let { createBlock, isLoading: isBlockLoading } = useCreateBlockRecord();
46
46
  let { createHideChat, isLoading: isHideLoading } = useCreateHideChatRecord();
47
47
 
48
+ const setReportModalOpen = usePlayerStore((x) => x.setReportModalOpen);
49
+ const setReportSubject = usePlayerStore((x) => x.setReportSubject);
50
+
48
51
  // get the channel did
49
52
  const channelId = usePlayerStore((state) => state.src);
50
53
  // get the logged in user's identity
@@ -155,13 +158,17 @@ export const ModView = forwardRef<ModViewRef, ModViewProps>(() => {
155
158
  <DropdownMenuItem
156
159
  onPress={() => {
157
160
  Linking.openURL(
158
- `https://${BSKY_FRONTEND_DOMAIN}/profile/${channelId}`,
161
+ `https://${BSKY_FRONTEND_DOMAIN}/profile/${message.author.handle}`,
159
162
  );
160
163
  }}
161
164
  >
162
165
  <Text color="primary">View user on {BSKY_FRONTEND_DOMAIN}</Text>
163
166
  </DropdownMenuItem>
164
- <ReportButton message={message} />
167
+ <ReportButton
168
+ message={message}
169
+ setReportModalOpen={setReportModalOpen}
170
+ setReportSubject={setReportSubject}
171
+ />
165
172
  </DropdownMenuGroup>
166
173
  </>
167
174
  )}
@@ -172,11 +179,13 @@ export const ModView = forwardRef<ModViewRef, ModViewProps>(() => {
172
179
 
173
180
  export function ReportButton({
174
181
  message,
182
+ setReportModalOpen,
183
+ setReportSubject,
175
184
  }: {
176
185
  message: ChatMessageViewHydrated;
186
+ setReportModalOpen: (open: boolean) => void;
187
+ setReportSubject: (subject: any) => void;
177
188
  }) {
178
- const setReportModalOpen = usePlayerStore((x) => x.setReportModalOpen);
179
- const setReportSubject = usePlayerStore((x) => x.setReportSubject);
180
189
  const { onOpenChange } = useRootContext();
181
190
  return (
182
191
  <DropdownMenuItem
@@ -27,6 +27,10 @@ export function ContextMenu() {
27
27
  const debugInfo = usePlayerStore((x) => x.showDebugInfo);
28
28
  const setShowDebugInfo = usePlayerStore((x) => x.setShowDebugInfo);
29
29
 
30
+ const livestream = useLivestreamStore((x) => x.livestream);
31
+ const setReportModalOpen = usePlayerStore((x) => x.setReportModalOpen);
32
+ const setReportSubject = usePlayerStore((x) => x.setReportSubject);
33
+
30
34
  const lowLatency = protocol === "webrtc";
31
35
  const setLowLatency = (value: boolean) => {
32
36
  setProtocol(value ? PlayerProtocol.WEBRTC : PlayerProtocol.HLS);
@@ -68,17 +72,22 @@ export function ContextMenu() {
68
72
  </DropdownMenuCheckboxItem>
69
73
  </DropdownMenuGroup>
70
74
  <DropdownMenuGroup title="Report">
71
- <ReportButton />
75
+ <ReportButton
76
+ livestream={livestream}
77
+ setReportModalOpen={setReportModalOpen}
78
+ setReportSubject={setReportSubject}
79
+ />
72
80
  </DropdownMenuGroup>
73
81
  </ResponsiveDropdownMenuContent>
74
82
  </DropdownMenu>
75
83
  );
76
84
  }
77
85
 
78
- export function ReportButton() {
79
- const livestream = useLivestreamStore((x) => x.livestream);
80
- const setReportModalOpen = usePlayerStore((x) => x.setReportModalOpen);
81
- const setReportSubject = usePlayerStore((x) => x.setReportSubject);
86
+ export function ReportButton({
87
+ livestream,
88
+ setReportModalOpen,
89
+ setReportSubject,
90
+ }) {
82
91
  const { onOpenChange } = useRootContext();
83
92
  return (
84
93
  <DropdownMenuItem
@@ -200,6 +200,8 @@ export const DropdownMenuContent = forwardRef<
200
200
  );
201
201
  });
202
202
 
203
+ /// Responsive Dropdown Menu Content. On mobile this will render a *bottom sheet* that is **portaled to the root of the app**.
204
+ /// Prefer passing scoped content in as **otherwise it may crash the app**.
203
205
  export const ResponsiveDropdownMenuContent = forwardRef<any, any>(
204
206
  ({ children, ...props }, ref) => {
205
207
  const { width } = useWindowDimensions();