Skip to content

Commit

Permalink
Merge pull request #4491 from traPtitech/feat/qall_UI
Browse files Browse the repository at this point in the history
Feat/qall UI
  • Loading branch information
nokhnaton authored Jan 26, 2025
2 parents 30fd5da + 9f6f4a0 commit 3ca1bf3
Show file tree
Hide file tree
Showing 29 changed files with 1,602 additions and 727 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
@click="openChannelManageModal"
@click-item="emit('clickItem')"
/>
<header-tools-menu-item
icon-name="phone-outline"
icon-mdi
label="ウェビナーモードでQallを開始"
@click="() => joinQall(props.channelId, true)"
@click-item="emit('clickItem')"
/>

Check warning on line 57 in src/components/Main/MainView/ChannelView/ChannelHeader/ChannelHeaderToolsMenu.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelHeader/ChannelHeaderToolsMenu.vue#L51-L57

Added lines #L51 - L57 were not covered by tests
</primary-view-header-popup-frame>
</template>

Expand Down
7 changes: 5 additions & 2 deletions src/components/Main/MainView/ChannelView/ChannelView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<channel-header :channel-id="channelId" />
</template>
<template #default>
<QallView v-if="callingChannel === channelId" />
<QallAudio />
<QallView v-if="getQallingState(channelId) === 'mainView'" />

Check warning on line 8 in src/components/Main/MainView/ChannelView/ChannelView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelView.vue#L7-L8

Added lines #L7 - L8 were not covered by tests
<channel-view-content
v-else
:channel-id="channelId"
Expand All @@ -15,6 +16,7 @@
</template>
<template #sidebar>
<channel-sidebar
v-if="getQallingState(channelId) !== 'mainView'"

Check warning on line 19 in src/components/Main/MainView/ChannelView/ChannelView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelView.vue#L19

Added line #L19 was not covered by tests
:channel-id="channelId"
:is-sidebar-opener-ready="isReady"
:pinned-messages="pinnedMessages"
Expand All @@ -35,6 +37,7 @@ import usePinnedMessages from '/@/composables/message/usePinnedMessages'
import useCurrentViewers from '/@/composables/useCurrentViewers'
import { useQall } from '/@/composables/qall/useQall'
import QallView from '../QallView/QallView.vue'
import QallAudio from '../QallView/QallAudio.vue'

Check warning on line 40 in src/components/Main/MainView/ChannelView/ChannelView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelView.vue#L38-L40

Added lines #L38 - L40 were not covered by tests
const props = defineProps<{
isReady: boolean
Expand All @@ -45,5 +48,5 @@ const props = defineProps<{
const channelId = toRef(props, 'channelId')
const pinnedMessages = usePinnedMessages(channelId)
const { viewingUsers, typingUsers } = useCurrentViewers(channelId)
const { callingChannel } = useQall()
const { getQallingState } = useQall()

Check warning on line 51 in src/components/Main/MainView/ChannelView/ChannelView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelView.vue#L51

Added line #L51 was not covered by tests
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { computed, ref, type ShallowRef } from 'vue'

Check warning on line 1 in src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts#L1

Added line #L1 was not covered by tests
import useChannelMessageFetcher from './useChannelMessageFetcher'
import { useChannelsStore } from '/@/store/entities/channels'
import { useSubscriptionStore } from '/@/store/domain/subscription'
export const useChannelView = ({
channelId,
entryMessageId,
scrollerEle
}: {

Check warning on line 9 in src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts#L5-L9

Added lines #L5 - L9 were not covered by tests
channelId: string
entryMessageId?: string
scrollerEle: ShallowRef<{ $el: HTMLDivElement } | undefined>
}) => {
const isMessageShow = ref(false)

Check warning on line 14 in src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts#L13-L14

Added lines #L13 - L14 were not covered by tests

const {
messageIds,
isReachedEnd,
isReachedLatest,
isLoading,
lastLoadingDirection,
onLoadFormerMessagesRequest,
onLoadLatterMessagesRequest
} = useChannelMessageFetcher(scrollerEle, { channelId, entryMessageId })

Check warning on line 24 in src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts#L16-L24

Added lines #L16 - L24 were not covered by tests

const { channelsMap } = useChannelsStore()
const isArchived = computed(
() => channelsMap.value.get(channelId)?.archived ?? false
)

Check warning on line 29 in src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts#L26-L29

Added lines #L26 - L29 were not covered by tests

const { unreadChannelsMap } = useSubscriptionStore()
const resetIsReachedLatest = () => {
if (!unreadChannelsMap.value.get(channelId)) return
isReachedLatest.value = false
}

Check warning on line 35 in src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts#L31-L35

Added lines #L31 - L35 were not covered by tests

const showToNewMessageButton = ref(false)
const toNewMessage = (behavior?: ScrollBehavior) => {
if (!scrollerEle.value) return
showToNewMessageButton.value = false
scrollerEle.value.$el.scrollTo({
top: scrollerEle.value.$el.scrollHeight,
behavior: behavior
})
}

Check warning on line 45 in src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts#L37-L45

Added lines #L37 - L45 were not covered by tests

const handleScroll = () => {
if (scrollerEle.value === undefined || isLoading.value) return
const { scrollTop, scrollHeight, clientHeight } = scrollerEle.value.$el
showToNewMessageButton.value = scrollHeight - 2 * clientHeight > scrollTop
if (!isReachedLatest.value) {
showToNewMessageButton.value = true
}
}

Check warning on line 54 in src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts#L47-L54

Added lines #L47 - L54 were not covered by tests

return {
isMessageShow,
messageIds,
isReachedEnd,
isReachedLatest,
isLoading,
lastLoadingDirection,
onLoadFormerMessagesRequest,
onLoadLatterMessagesRequest,
isArchived,
resetIsReachedLatest,
showToNewMessageButton,
toNewMessage,
handleScroll
}
}

Check warning on line 71 in src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/composables/useChannelView.ts#L56-L71

Added lines #L56 - L71 were not covered by tests
7 changes: 5 additions & 2 deletions src/components/Main/MainView/MessageInput/MessageInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div
ref="containerEle"
:class="$style.container"
:data-is-mobile="$boolAttr(isMobile)"
:data-is-mobile="$boolAttr(forceMobileStyle || isMobile)"

Check warning on line 5 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L5

Added line #L5 was not covered by tests
>
<button
v-if="showToNewMessageButton"
Expand Down Expand Up @@ -36,7 +36,9 @@
v-model="state.text"
:channel-id="channelId"
:is-posting="isPosting"
:shrink-to-one-line="isMobile && isLeftControlsExpanded"
:shrink-to-one-line="

Check warning on line 39 in src/components/Main/MainView/MessageInput/MessageInput.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/MessageInput/MessageInput.vue#L39

Added line #L39 was not covered by tests
(forceMobileStyle || isMobile) && isLeftControlsExpanded
"
@focus="onFocus"
@blur="onBlur"
@add-attachments="onAddAttachments"
Expand Down Expand Up @@ -85,6 +87,7 @@ const props = defineProps<{
channelId: ChannelId | DMChannelId
typingUsers: UserId[]
showToNewMessageButton: boolean
forceMobileStyle?: boolean
}>()
const emit = defineEmits<{
(e: 'clickToNewMessageButton'): void
Expand Down
116 changes: 11 additions & 105 deletions src/components/Main/MainView/QallView/AudioComponent.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { computed } from 'vue'

Check warning on line 2 in src/components/Main/MainView/QallView/AudioComponent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/AudioComponent.vue#L2

Added line #L2 was not covered by tests
import type { TrackInfo } from '/@/composables/qall/useLiveKitSDK'
import { useUsersStore } from '/@/store/entities/users'
import { buildUserIconPath } from '/@/lib/apis'
import AudioTrack from './AudioTrack.vue'
import { useUserVolume } from '/@/store/app/userVolume'
const { trackInfo, isLarge } = defineProps<{
import UserCard from './UserCard.vue'

Check warning on line 8 in src/components/Main/MainView/QallView/AudioComponent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/AudioComponent.vue#L4-L8

Added lines #L4 - L8 were not covered by tests
const { trackInfo, isShow } = defineProps<{
trackInfo: TrackInfo
isLarge: boolean
isShow?: boolean
}>()
const { getStore, setStore, restoringPromise } = useUserVolume()
const volume = ref<number | string>(getStore(trackInfo.username) ?? 1)
const volume = computed<number | string>(
() => getStore(trackInfo.username) ?? 1
)

Check warning on line 16 in src/components/Main/MainView/QallView/AudioComponent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/AudioComponent.vue#L13-L16

Added lines #L13 - L16 were not covered by tests
const { findUserByName } = useUsersStore()
const user = computed(() => findUserByName(trackInfo.username))
Expand All @@ -23,114 +26,17 @@ const parseToFloat = (value: number | string): number => {
}
return parseFloat(value)
}

Check warning on line 28 in src/components/Main/MainView/QallView/AudioComponent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/AudioComponent.vue#L23-L28

Added lines #L23 - L28 were not covered by tests
watch(
() => volume.value,
v => {
setStore(trackInfo.username, parseToFloat(v))
},
{ deep: true, immediate: true }
)
watch(
() => getStore(trackInfo.username),
v => {
if (v) {
volume.value = v
}
},
{ deep: true }
)
</script>

<template>
<div>
<div :class="isLarge ? $style.LargeCard : $style.UserCard">
<AudioTrack :track-info="trackInfo" :volume="parseToFloat(volume)" />

<div :class="$style.OuterIcon">
<img :src="iconImage" :class="$style.OuterImage" />
</div>
<div :class="isLarge ? $style.LargeInnerIcon : $style.InnerIcon">
<img :src="iconImage" :class="$style.InnerImage" />
</div>

<div :class="$style.NameLabel">{{ trackInfo.username }}</div>
</div>
<input v-model="volume" type="range" min="0" max="3" step="0.01" />
<div :class="isShow ? $style.container : []">
<UserCard :track-info="trackInfo" />
<AudioTrack :track-info="trackInfo" :volume="parseToFloat(volume)" />
</div>

Check warning on line 35 in src/components/Main/MainView/QallView/AudioComponent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/AudioComponent.vue#L32-L35

Added lines #L32 - L35 were not covered by tests
</template>
<style lang="scss" module>
.UserCard {
height: 108px;
width: 192px;
position: relative;
overflow: hidden;
border-radius: 12px;
}
.LargeCard {
height: 324px;
width: 576px;
position: relative;
overflow: hidden;
border-radius: 12px;
}
.InnerIcon {
height: 64px;
width: 64px;
background-size: cover;
border-radius: 50%;
margin: auto;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.LargeInnerIcon {
height: 192px;
width: 192px;
background-size: cover;
border-radius: 50%;
margin: auto;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.OuterIcon {
height: 100%;
.container {
width: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translateY(-50%) translateX(-50%);
-webkit-transform: translateY(-50%) translateX(-50%);
overflow: hidden;
filter: blur(40px);
}
.NameLabel {
position: absolute;
left: 8px;
bottom: 8px;
display: flex;
padding: 4px 12px;
align-items: flex-start;
gap: 8px;
border-radius: 8px;
background: rgba(0, 0, 0, 0.5);
color: #fff;
}
.OuterImage {
height: 100%;
width: 100%;
object-fit: cover;
}
.InnerImage {
height: 100%;
width: 100%;
object-fit: cover;
border-radius: 50%;
}
</style>
2 changes: 1 addition & 1 deletion src/components/Main/MainView/QallView/AudioTrack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ onMounted(() => {
})

Check warning on line 34 in src/components/Main/MainView/QallView/AudioTrack.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/AudioTrack.vue#L25-L34

Added lines #L25 - L34 were not covered by tests
onUnmounted(() => {
audioContext.close()
if (audioElement.value) {
trackInfo.trackPublication?.track?.detach(audioElement.value)
audioContext.close()
}
})

Check warning on line 41 in src/components/Main/MainView/QallView/AudioTrack.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/AudioTrack.vue#L36-L41

Added lines #L36 - L41 were not covered by tests
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ function handleClick() {
.callControlBtnSmall {
width: 48px;
height: 48px;
background-color: #222325;
border: none;
cursor: pointer;
padding: 0;
display: inline-flex;
justify-content: center;
align-items: center;
transition: opacity 0.3s;
color: white;
@include background-tertiary;
@include color-ui-primary;
}
.callControlBtnSmall:hover {
opacity: 0.1;
opacity: 0.5;
}
.icon {
Expand Down
Loading

0 comments on commit 3ca1bf3

Please sign in to comment.