@@ -163,7 +163,7 @@ import Icon from "../Icon.vue";
import { computed } from "vue";
import type { ChannelMember, useVoiceWebSocket } from "../../composables/useVoiceWebSocket.js";
import type { useWebClientScreenShare } from "../../composables/useWebClientScreenShare.js";
-const props = defineProps<{
+const props = withDefaults(defineProps<{
currentMembers: ChannelMember[]; isMobileViewport: boolean; showMemberActions?: boolean;
showScreenShare?: boolean;
sharing?: Pick, "screenShareActive" | "screenShareStarting" | "screenShareViewingStreamId"> & Pick, "settingsOpen">;
@@ -171,17 +171,18 @@ const props = defineProps<{
isSpeaking: (member: ChannelMember) => boolean;
avatarStyle: (name: string, isSelf?: boolean, avatar?: string) => Record;
avatarInitial: (name: string) => string; t: (key: string) => string;
-}>();
-const shareEnabled = computed(() => props.showScreenShare !== false && Boolean(props.sharing && props.controls));
-const screenShareActive = computed(() => shareEnabled.value && Boolean(props.sharing?.screenShareActive.value));
-const screenShareStarting = computed(() => shareEnabled.value && Boolean(props.sharing?.screenShareStarting.value));
-const screenShareViewingStreamId = computed(() => shareEnabled.value ? props.sharing?.screenShareViewingStreamId.value ?? null : null);
-const screenShareSettingsOpen = computed(() => shareEnabled.value && Boolean(props.sharing?.settingsOpen.value));
-const screenShareStreamForMember = (member: ChannelMember) => shareEnabled.value ? props.controls?.streamForMember(member) ?? null : null;
-const toggleScreenShareForMember = (member: ChannelMember) => { if (shareEnabled.value) props.controls?.toggleForMember(member); };
-const startScreenShareWithSettings = () => { if (shareEnabled.value) void props.controls?.startWithSettings(); };
+}>(), { showScreenShare: true });
+const screenShareControlsEnabled = computed(() => props.showScreenShare !== false && Boolean(props.controls));
+const screenShareStatusEnabled = computed(() => screenShareControlsEnabled.value && Boolean(props.sharing));
+const screenShareActive = computed(() => screenShareStatusEnabled.value && Boolean(props.sharing?.screenShareActive.value));
+const screenShareStarting = computed(() => screenShareStatusEnabled.value && Boolean(props.sharing?.screenShareStarting.value));
+const screenShareViewingStreamId = computed(() => screenShareStatusEnabled.value ? props.sharing?.screenShareViewingStreamId.value ?? null : null);
+const screenShareSettingsOpen = computed(() => screenShareStatusEnabled.value && Boolean(props.sharing?.settingsOpen.value));
+const screenShareStreamForMember = (member: ChannelMember) => screenShareControlsEnabled.value ? props.controls?.streamForMember(member) ?? null : null;
+const toggleScreenShareForMember = (member: ChannelMember) => { if (screenShareControlsEnabled.value) props.controls?.toggleForMember(member); };
+const startScreenShareWithSettings = () => { if (screenShareStatusEnabled.value) void props.controls?.startWithSettings(); };
function toggleScreenShareSettings() {
- if (!shareEnabled.value || !props.sharing) return;
+ if (!screenShareStatusEnabled.value || !props.sharing) return;
props.sharing.settingsOpen.value = !props.sharing.settingsOpen.value;
}
const emit = defineEmits<{ memberActions: [member: ChannelMember, event: MouseEvent]; stopShare: [] }>();
diff --git a/web/src/views/WebClient.vue b/web/src/views/WebClient.vue
index 943b72e..8bb5cd4 100644
--- a/web/src/views/WebClient.vue
+++ b/web/src/views/WebClient.vue
@@ -674,10 +674,11 @@
:avatar-initial="avatarInitial"
:t="t"
/>
- ({ text }), createText: text => ({ text }), createElement: () => ({}), insert() {}, remove() {}, setText() {}, setElementText() {}, patchProp() {}, parentNode: () => null, nextSibling: () => null });
before(async () => {
- vite = await createServer({ configFile: false, root: fileURLToPath(new URL("../", import.meta.url)), server: { middlewareMode: true, hmr: false, ws: false, watch: null }, optimizeDeps: { noDiscovery: true, include: [] }, appType: "custom" });
+ vite = await createServer({ configFile: false, plugins: [vue()], root: fileURLToPath(new URL("../", import.meta.url)), server: { middlewareMode: true, hmr: false, ws: false, watch: null }, optimizeDeps: { noDiscovery: true, include: [] }, appType: "custom" });
({ useWebClientScreenShare } = await vite.ssrLoadModule("/src/composables/useWebClientScreenShare.ts"));
+ ({ default: VoiceMemberCards } = await vite.ssrLoadModule("/src/components/web-client/VoiceMemberCards.vue"));
});
after(async () => { await vite?.close(); });
function mount(t, initialStream = null) {
@@ -73,6 +76,49 @@ test("known screen owner IDs cannot fall back to another member with the same ni
} finally { f.app.unmount(); }
});
+test("member cards detect and expose a remote share without depending on local share status", async () => {
+ let lookupCount = 0;
+ const html = await renderToString(createSSRApp(VoiceMemberCards, {
+ currentMembers: [
+ { id: 7, nickname: "Remote sharer", isSelf: false, inputMuted: false },
+ { id: 8, nickname: "Local viewer", isSelf: true, inputMuted: false },
+ ],
+ isMobileViewport: false,
+ controls: {
+ streamForMember: member => { lookupCount++; return member.id === 7 ? { streamId: "active-share" } : null; },
+ toggleForMember() {},
+ startWithSettings() {},
+ },
+ isSpeaking: () => false,
+ avatarStyle: () => ({}),
+ avatarInitial: nickname => nickname[0],
+ t: key => key,
+ }));
+
+ assert.ok(lookupCount > 0, "member cards query the available share controls");
+ assert.match(html, /screen-share-live-indicator/);
+ assert.match(html, /sharingScreen/);
+ assert.match(html, /screen-share-card-button/);
+ assert.match(html, /watchScreenShare/);
+ assert.equal((html.match(/screen-share-card-actions/g) ?? []).length, 1);
+ assert.doesNotMatch(html, /startScreenShare/);
+});
+
+test("a skin can explicitly opt the member-card widget out of screen-share UI", async () => {
+ const html = await renderToString(createSSRApp(VoiceMemberCards, {
+ currentMembers: [{ id: 7, nickname: "Remote sharer", isSelf: false, inputMuted: false }],
+ isMobileViewport: false,
+ showScreenShare: false,
+ controls: { streamForMember: () => ({ streamId: "active-share" }), toggleForMember() {}, startWithSettings() {} },
+ isSpeaking: () => false,
+ avatarStyle: () => ({}),
+ avatarInitial: nickname => nickname[0],
+ t: key => key,
+ }));
+
+ assert.doesNotMatch(html, /screen-share-live-indicator|screen-share-card-button/);
+});
+
test("share settings submit the selected resolution and frame rate", async t => {
const f = mount(t);
try { f.ui.settingsOpen.value = true; f.ui.resolutionPreset.value = "720p"; f.ui.frameRate.value = 30; await f.ui.startWithSettings();