Skip to content

Commit

Permalink
✨ ウェビナー仮実装(動かなそう)
Browse files Browse the repository at this point in the history
  • Loading branch information
pikachu0310 committed Jan 26, 2025
1 parent 9a8c014 commit 27ce4eb
Showing 1 changed file with 52 additions and 15 deletions.
67 changes: 52 additions & 15 deletions src/components/Main/MainView/QallView/ParticipantList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@ import { useUserVolume } from '/@/store/app/userVolume'
import { ref, watch, useCssModule, computed } from 'vue'
import type { User } from '@traptitech/traq'
const { participant, trackInfo } = defineProps<{
// 追加: useQall をimportし、changeParticipantRoleを使う
import { useQall } from '/@/composables/qall/useQall'

Check warning on line 9 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L9

Added line #L9 was not covered by tests
const props = defineProps<{

Check warning on line 11 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L11

Added line #L11 was not covered by tests
participant: User
trackInfo: TrackInfo
roomId: string
isWebinar: boolean
iHavePermission: boolean // 自分が発言権限を持っているかどうか
participantCanPublish: boolean // 表示する相手の発言権限
}>()
const { participant, trackInfo, roomId, isWebinar, iHavePermission, participantCanPublish } = props

Check warning on line 20 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L20

Added line #L20 was not covered by tests
const { changeParticipantRole } = useQall()

Check warning on line 22 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L22

Added line #L22 was not covered by tests
const { getStore, setStore } = useUserVolume()
const parseToFloat = (value: number | string): number => {
Expand Down Expand Up @@ -62,23 +73,50 @@ const volumeSliderClass = computed(() => ({
[style.volumeSlider]: true,
[style.muted]: isMuted.value
}))
/**
* 発言権限のトグル (チェックボックスの変更)
*/
const publishCheck = ref(participantCanPublish)

Check warning on line 80 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L80

Added line #L80 was not covered by tests
const togglePublish = async () => {

Check warning on line 82 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L82

Added line #L82 was not covered by tests
// もし自分が権限を持ってなければ変更不可
if (!iHavePermission) return

Check warning on line 84 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L84

Added line #L84 was not covered by tests
publishCheck.value = !publishCheck.value
try {
await changeParticipantRole(roomId, [
{
identity: participant.name, // name が identityとして識別されてる想定
canPublish: publishCheck.value
}
])
} catch (e) {
console.error('Failed to change participant role:', e)

Check warning on line 95 in src/components/Main/MainView/QallView/ParticipantList.vue

View workflow job for this annotation

GitHub Actions / run lint

Unexpected console statement
}
}

Check warning on line 97 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L86-L97

Added lines #L86 - L97 were not covered by tests
</script>

<template>
<div :class="$style.container">
<div :class="$style.leftSide">
<user-icon :size="40" :user-id="participant.id" />
<span :class="$style.userName">{{ participant.displayName }}</span>
<!-- TODO: Qall: ミュートを実装する -->
<!-- <button :class="$style.micIconButton">
<a-icon v-if="isMuted" name="microphone-off" mdi />
</button> -->
<!-- (Optional) mic or speaker icon if needed -->

Check warning on line 105 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L105

Added line #L105 was not covered by tests
</div>

<div :class="$style.rightSide">
<!-- <button :class="$style.iconButton" @click="toggleMute(trackInfo)">
<a-icon v-if="isMuted" name="volume-off" :size="24" mdi />
<a-icon v-else name="volume-high" mdi :size="24" />
</button> -->
<!-- If isWebinar && iHavePermission, show a checkbox to toggle participant's canPublish -->
<div v-if="isWebinar && iHavePermission" :class="$style.checkboxContainer">
<input
type="checkbox"
:checked="publishCheck"
@change="togglePublish"
/>
<label>発言権限</label>
</div>

Check warning on line 117 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L109-L117

Added lines #L109 - L117 were not covered by tests

<!-- volume slider -->

Check warning on line 119 in src/components/Main/MainView/QallView/ParticipantList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ParticipantList.vue#L119

Added line #L119 was not covered by tests
<input
v-model="volume"
type="range"
Expand Down Expand Up @@ -128,12 +166,11 @@ const volumeSliderClass = computed(() => ({
gap: 8px;
}
.iconButton {
width: 40px;
height: 40px;
border: none;
background: transparent;
cursor: pointer;
/* checkbox style */
.checkboxContainer {
display: flex;
align-items: center;
gap: 4px;
}
.volumeSlider {
Expand Down

0 comments on commit 27ce4eb

Please sign in to comment.