Skip to content

Commit

Permalink
Merge pull request #4497 from traPtitech/feat/qall_noise
Browse files Browse the repository at this point in the history
Feat/qall noise
  • Loading branch information
nokhnaton authored Jan 26, 2025
2 parents 288ac27 + 3d15c07 commit 61b1702
Show file tree
Hide file tree
Showing 14 changed files with 217 additions and 129 deletions.
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions src/assets/mdi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import {
mdiToggleSwitchOff,
mdiToggleSwitch,
mdiChevronDoubleLeft,
mdiChevronDoubleUp,
mdiChevronDoubleDown,
mdiChevronLeft,
mdiChevronRight,
mdiBookmark,
Expand Down Expand Up @@ -86,7 +88,8 @@ import {
mdiDelete,
mdiVideo,
mdiVideoOff,
mdiCommentTextMultipleOutline
mdiCommentTextMultipleOutline,
mdiCommentOffOutline
} from '@mdi/js'

interface MdiIconsMapping {
Expand Down Expand Up @@ -137,6 +140,8 @@ const mdi: MdiIconsMapping = {
'toggle-switch-off': mdiToggleSwitchOff,
'toggle-switch-on': mdiToggleSwitch,
'chevron-double': mdiChevronDoubleLeft,
'chevron-double-up': mdiChevronDoubleUp,
'chevron-double-down': mdiChevronDoubleDown,

Check warning on line 144 in src/assets/mdi.ts

View check run for this annotation

Codecov / codecov/patch

src/assets/mdi.ts#L143-L144

Added lines #L143 - L144 were not covered by tests
'chevron-left': mdiChevronLeft,
'chevron-right': mdiChevronRight,
'chevron-up': mdiChevronUp,
Expand Down Expand Up @@ -181,7 +186,8 @@ const mdi: MdiIconsMapping = {
delete: mdiDelete,
video: mdiVideo,
'video-off': mdiVideoOff,
'comment-outline': mdiCommentTextMultipleOutline
'comment-outline': mdiCommentTextMultipleOutline,
'comment-off-outline': mdiCommentOffOutline

Check warning on line 190 in src/assets/mdi.ts

View check run for this annotation

Codecov / codecov/patch

src/assets/mdi.ts#L186-L190

Added lines #L186 - L190 were not covered by tests
}

export default mdi
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ const handleApply = () => {
<button :class="$style.cancelButton" @click="onClose">

Check warning on line 79 in src/components/Main/MainView/QallView/BackgroundSettingsModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/BackgroundSettingsModal.vue#L78-L79

Added lines #L78 - L79 were not covered by tests
キャンセル
</button>
<button :class="$style.applyButton" @click="handleApply">
適用
</button>
<button :class="$style.applyButton" @click="handleApply">適用</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -161,7 +159,7 @@ const handleApply = () => {
background-color: transparent;
border: 1px solid $theme-ui-secondary;
color: $theme-ui-secondary;
&:hover {
background-color: rgba($theme-ui-secondary, 0.1);
}
Expand All @@ -170,7 +168,7 @@ const handleApply = () => {
.applyButton {
background-color: $theme-accent-primary;
color: white;
&:hover {
background-color: darken($theme-accent-primary, 5%);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/Main/MainView/QallView/DanmakuComment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ const startAnimation = () => {
font-size: 32px;
color: black;
text-shadow: 1px 1px 2px white;
z-index: 301;
}
</style>
42 changes: 13 additions & 29 deletions src/components/Main/MainView/QallView/DanmakuContainer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { nextTick, onMounted, ref, useTemplateRef } from 'vue'
import { nextTick, ref, useTemplateRef } from 'vue'
import DanmakuComment from './DanmakuComment.vue'
import DanmakuStamp from './DanmakuStamp.vue'

Check warning on line 4 in src/components/Main/MainView/QallView/DanmakuContainer.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/DanmakuContainer.vue#L2-L4

Added lines #L2 - L4 were not covered by tests
Expand Down Expand Up @@ -57,37 +57,21 @@ messageMitt.on('updateMessage', async message => {
})

Check warning on line 57 in src/components/Main/MainView/QallView/DanmakuContainer.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/DanmakuContainer.vue#L46-L57

Added lines #L46 - L57 were not covered by tests
useMittListener(qallMitt, 'pushStamp', stamp => {
sparkle(stamp)
stamps.value.push({
id: Math.random().toString(36).substring(2, 15),
stampId: stamp
})
setTimeout(() => {
stamps.value.shift()
}, 1400)

Check warning on line 66 in src/components/Main/MainView/QallView/DanmakuContainer.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/DanmakuContainer.vue#L59-L66

Added lines #L59 - L66 were not covered by tests
//TODO: 出現ロジックを考える
if (Math.random() < 0.005) {
sparkle(stamp)
}
})

Check warning on line 72 in src/components/Main/MainView/QallView/DanmakuContainer.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/DanmakuContainer.vue#L69-L72

Added lines #L69 - L72 were not covered by tests
const { sparkle } = useDanmakuSparkle(showSparkle)

Check warning on line 74 in src/components/Main/MainView/QallView/DanmakuContainer.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/DanmakuContainer.vue#L74

Added line #L74 was not covered by tests
onMounted(() => {
// 一定間隔でコメントを生成
setInterval(() => {
comments.value.push({
id: Math.random().toString(36).substring(2, 15),
markdown: 'うおおおおおおおおおお!:tada::tada.party::tada.parrot:'
})
setTimeout(() => {
comments.value.shift()
}, 6000)
}, 1000)
setInterval(() => {
stamps.value.push({
id: Math.random().toString(36).substring(2, 15),
stampId: '69c10725-2176-45ac-a4a5-22e70b8a76f7'
})
setTimeout(() => {
stamps.value.shift()
}, 1400)
}, 1000)
setInterval(() => {
sparkle('e0e0c3a6-c544-4c96-8529-d597563fd1ad')
}, 5000)
})
</script>

<template>
Expand Down
1 change: 1 addition & 0 deletions src/components/Main/MainView/QallView/DanmakuStamp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ onMounted(() => startAnimation())
font-size: 32px;
color: black;
text-shadow: 1px 1px 2px white;
z-index: 300;
}
</style>
129 changes: 87 additions & 42 deletions src/components/Main/MainView/QallView/QallMessageView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import useChannelMessageFetcher from '../ChannelView/ChannelViewContent/composab
import { useChannelsStore } from '/@/store/entities/channels'
import MessageElement from '/@/components/Main/MainView/MessageElement/MessageElement.vue'
import { useSubscriptionStore } from '/@/store/domain/subscription'
import IconButton from '/@/components/UI/IconButton.vue'

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

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L7-L11

Added lines #L7 - L11 were not covered by tests
const props = defineProps<{

Check warning on line 13 in src/components/Main/MainView/QallView/QallMessageView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L13

Added line #L13 was not covered by tests
channelId: ChannelId
Expand Down Expand Up @@ -56,60 +57,73 @@ const handleScroll = () => {
showToNewMessageButton.value = true
}
}

Check warning on line 59 in src/components/Main/MainView/QallView/QallMessageView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L52-L59

Added lines #L52 - L59 were not covered by tests
const handleMessage = () => {
if (isMessageShow.value) {
isMessageShow.value = false
toNewMessage('smooth')
} else {
isMessageShow.value = true
nextTick(() => toNewMessage())
}
}
defineExpose({
handleMessage
})
</script>

<template>
<div
:class="$style.container"
:data-is-not-messages-show="$boolAttr(!isMessageShow)"

Check warning on line 65 in src/components/Main/MainView/QallView/QallMessageView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L63-L65

Added lines #L63 - L65 were not covered by tests
>
<div :class="$style.mainViewConteiner">
<div :class="$style.messageContainer">
<div :class="$style.mainViewContainer">
<div
:class="$style.messageContainer"
:data-is-not-messages-show="$boolAttr(!isMessageShow)"

Check warning on line 70 in src/components/Main/MainView/QallView/QallMessageView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L67-L70

Added lines #L67 - L70 were not covered by tests
>
<scroll-loading-bar
:class="$style.loadingBar"
:show="isLoading && isMessageShow"
/>
<transition name="fade-bottom" mode="out-in">
<messages-scroller
<div
v-if="isMessageShow"
ref="scrollerEle"
:message-ids="messageIds"
:is-reached-end="isReachedEnd"
:is-reached-latest="isReachedLatest"
:is-loading="isLoading"
:last-loading-direction="lastLoadingDirection"
@request-load-former="onLoadFormerMessagesRequest"
@request-load-latter="onLoadLatterMessagesRequest"
@scroll-passive="handleScroll"
@reset-is-reached-latest="resetIsReachedLatest"
:class="$style.messageContainerBackgroundContainer"

Check warning on line 79 in src/components/Main/MainView/QallView/QallMessageView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L72-L79

Added lines #L72 - L79 were not covered by tests
>
<template
#default="{ messageId, onChangeHeight, onEntryMessageLoaded }"
<div :class="$style.messageContainerBackground"></div>

Check warning on line 81 in src/components/Main/MainView/QallView/QallMessageView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L81

Added line #L81 was not covered by tests

<messages-scroller
v-if="isMessageShow"
ref="scrollerEle"
:message-ids="messageIds"
:is-reached-end="isReachedEnd"
:is-reached-latest="isReachedLatest"
:is-loading="isLoading"
:last-loading-direction="lastLoadingDirection"
@request-load-former="onLoadFormerMessagesRequest"
@request-load-latter="onLoadLatterMessagesRequest"
@scroll-passive="handleScroll"
@reset-is-reached-latest="resetIsReachedLatest"

Check warning on line 94 in src/components/Main/MainView/QallView/QallMessageView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L83-L94

Added lines #L83 - L94 were not covered by tests
>
<message-element
:class="$style.element"
:message-id="messageId"
:is-archived="isArchived"
@change-height="onChangeHeight"
@entry-message-loaded="onEntryMessageLoaded"
/>
</template>
</messages-scroller>
<template
#default="{ messageId, onChangeHeight, onEntryMessageLoaded }"

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

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L97

Added line #L97 was not covered by tests
>
<message-element
:class="$style.element"
:message-id="messageId"
:is-archived="isArchived"
@change-height="onChangeHeight"
@entry-message-loaded="onEntryMessageLoaded"
/>

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

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L99-L105

Added lines #L99 - L105 were not covered by tests
</template>
</messages-scroller>
</div>
</transition>
<div :class="[$style.uiElement, $style.uiToggleButton]">
<IconButton
:icon-name="`chevron-double-${isMessageShow ? 'down' : 'up'}`"
icon-mdi
@click="

Check warning on line 114 in src/components/Main/MainView/QallView/QallMessageView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallMessageView.vue#L107-L114

Added lines #L107 - L114 were not covered by tests
() => {
if (isMessageShow) {
isMessageShow = false
toNewMessage('smooth')
} else {
isMessageShow = true
nextTick(() => toNewMessage())
}
}
"
/>
</div>
</div>
<slot name="default"></slot>
</div>
Expand All @@ -130,7 +144,7 @@ defineExpose({
flex-direction: column;
}
.mainViewConteiner {
.mainViewContainer {
flex-grow: 1;
position: relative;
}
Expand All @@ -139,7 +153,8 @@ defineExpose({
position: absolute;
bottom: 0;
right: 0;
width: 30%;
width: 33%;
min-width: 25rem;
height: 100%;
display: flex;
Expand All @@ -149,13 +164,33 @@ defineExpose({
&[data-is-not-messages-show] {
pointer-events: none;
}
z-index: 400;
}
.messageContainerBackgroundContainer {
position: absolute;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
}
.messageContainerBackground {
position: absolute;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
opacity: 0.7;
backdrop-filter: blur(100px);
@include background-primary;
}
.loadingBar {
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 12px;
z-index: $z-index-message-loading;
}
Expand All @@ -174,4 +209,14 @@ defineExpose({
.uiElement {
pointer-events: all;
}
.uiToggleButton {
@include color-ui-secondary;
@include background-primary;
padding: 0.5rem;
border-radius: 2rem;
position: absolute;
bottom: 1rem;
right: 1rem;
}
</style>
23 changes: 12 additions & 11 deletions src/components/Main/MainView/QallView/QallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const toggleVideo = async () => {
isCameraOn.value = false
}
} catch (err) {

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

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallView.vue#L52-L69

Added lines #L52 - L69 were not covered by tests
// eslint-disable-next-line no-console
console.error('Failed to toggle video:', err)
}
}

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

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallView.vue#L71-L73

Added lines #L71 - L73 were not covered by tests
Expand All @@ -89,6 +90,7 @@ const toggleScreen = async () => {
isScreenSharing.value = false
}
} catch (err) {

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

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallView.vue#L75-L92

Added lines #L75 - L92 were not covered by tests
// eslint-disable-next-line no-console
console.error('Failed to toggle screen sharing:', err)
}
}

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

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallView.vue#L94-L96

Added lines #L94 - L96 were not covered by tests
Expand Down Expand Up @@ -175,23 +177,22 @@ const handleBackgroundSave = (data: {
const showCameraDetailSetting = ref(false)
const showShareScreenSettingDetail = ref(false)

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

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallView.vue#L177-L178

Added lines #L177 - L178 were not covered by tests
const childRef = ref<InstanceType<typeof QallMessageView> | null>(null)
const showMessage = () => {
childRef.value?.handleMessage()
const showDanmaku = ref(true)
const toggleDanmaku = () => {
showDanmaku.value = !showDanmaku.value
}

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

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/QallView.vue#L180-L183

Added lines #L180 - L183 were not covered by tests
</script>

<template>
<div :class="$style.Block">
<QallMessageView
ref="childRef"
:channel-id="callingChannel"
:typing-users="[]"
>
<DanmakuContainer />
<QallMessageView :channel-id="callingChannel" :typing-users="[]">
<DanmakuContainer v-if="showDanmaku" />
<div :class="$style.iconContainer">
<IconButton icon-name="comment-outline" icon-mdi @click="showMessage" />
<IconButton
:icon-name="`comment${showDanmaku ? '' : '-off'}-outline`"
icon-mdi
@click="toggleDanmaku"
/>
<IconButton icon-name="close" icon-mdi @click="isSubView = true" />
</div>
<div :class="$style.stackContainer">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, onUnmounted, ref, useTemplateRef } from 'vue'
import { ref } from 'vue'

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L2 was not covered by tests
import type { TrackInfo } from '/@/composables/qall/useLiveKitSDK'
import AudioTrack from './AudioTrack.vue'
import VideoComponent from './VideoComponent.vue'

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

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/QallView/ScreenShareComponent.vue#L4-L5

Added lines #L4 - L5 were not covered by tests
Expand Down
Loading

0 comments on commit 61b1702

Please sign in to comment.