Skip to content

Commit a5c9b83

Browse files
mikelxklisten1
andauthored
port nowplaying window (#786)
* port nowplaying window * fix: typo * fix: window gap * style: adjust now playing page style Co-authored-by: Listen 1 <githublisten1@gmail.com>
1 parent a3e3512 commit a5c9b83

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

src/views/NowPlaying.vue

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class="songdetail-wrapper absolute flex flex-col top-0 left-0 right-0 bottom-20 duration-300 app-region-nodrag bg-now-playing"
55
:class="{
66
'overflow-y-scroll': commentActive,
7-
'overflow-hidden': !commentActive,
7+
'overflow-hidden justify-center': !commentActive,
88
slidedown: overlay.type !== 'track',
99
coverbg: settings.enableNowplayingCoverBackground
1010
}">
@@ -38,17 +38,17 @@
3838
</svg>
3939
</div>-->
4040

41-
<div class="playsong-detail my-0 mx-auto flex w-[60rem] z-10">
42-
<div class="detail-head overflow-hidden flex-none w-[30rem] 2xl:w-[500px] flex justify-center">
43-
<div class="detail-head-cover w-72 2xl:w-96 mt-32 2xl:mr-28 transition-all ease-in-out">
44-
<img class="w-full aspect-square object-cover rounded shadow-2xl" :src="currentPlaying?.img_url" @error="showImage($event, 'images/mycover.jpg')" />
41+
<div class="playsong-detail flex self-center w-[60rem] z-10 justify-center" :class="{ 'mt-24': commentActive }">
42+
<div class="detail-head overflow-hidden flex items-center mr-20">
43+
<div class="detail-head-cover w-80 2xl:w-96 transition-all ease-in-out">
44+
<img class="w-full aspect-square object-cover rounded-lg shadow-2xl" :src="currentPlaying?.img_url" @error="showImage($event, coverImg)" />
4545
</div>
4646
<div class="detail-head-title">
4747
<!--<a title="加入收藏" class="clone" ng-click="showDialog(0, currentPlaying)">收藏</a>
4848
<a open-url="currentPlaying.source_url" title="原始链接" class="link">原始链接</a>-->
4949
</div>
5050
</div>
51-
<div class="detail-songinfo flex app-region-nodrag overflow-hidden mt-28 flex-col flex-1">
51+
<div class="detail-songinfo flex w-96 app-region-nodrag overflow-hidden flex-col ml-8">
5252
<div class="title flex items-start">
5353
<h2 class="font-normal text-3xl mr-4 mb-4">{{ currentPlaying?.title }}</h2>
5454
<span
@@ -88,26 +88,30 @@
8888
</a>
8989
</div>
9090
</div>
91-
<div class="lyric relative flex-none h-96 overflow-y-scroll">
92-
<div class="placeholder" />
91+
<div class="lyric blur-mask relative flex-none h-[30rem] overflow-y-scroll">
92+
<div class="placeholder h-1/3" />
9393
<p
9494
v-for="line in lyricArray"
9595
:key="line.lineNumber"
9696
:data-line="line.lineNumber"
97-
:style="{ fontWeight: lyricFontWeight, fontSize: `${lyricFontSize}px` }"
97+
:style="{
98+
fontWeight: lyricFontWeight,
99+
fontSize: `${lyricFontSize * (isHighlighted(line.lineNumber, line.translationFlag) ? 1.2 : 1)}px`,
100+
filter: `blur(${line.lineNumber === (line.translationFlag ? lyricLineNumberTrans : lyricLineNumber) ? 0.25 : 0}px)`
101+
}"
98102
:class="{
99-
highlight: (!line.translationFlag && line.lineNumber == lyricLineNumber) || (line.translationFlag && line.lineNumber == lyricLineNumberTrans),
103+
highlight: isHighlighted(line.lineNumber, line.translationFlag),
100104
hidden: line.translationFlag && !settings.enableLyricTranslation,
101105
'mt-1': line.translationFlag,
102106
'mt-4': !line.translationFlag
103107
}">
104108
{{ line.content }}
105109
</p>
106-
<div class="placeholder" />
110+
<div class="placeholder h-1/3" />
107111
</div>
108112
</div>
109113
</div>
110-
<div v-if="commentActive" class="mt-20 mb-8 mx-auto w-[42rem] z-10">
114+
<div v-if="commentActive" class="mt-16 mb-8 self-center w-[42rem] z-10">
111115
<div>热门评论</div>
112116
<ul>
113117
<li v-for="comment in commentList" :key="comment.id" class="flex py-4 border-b border-default">
@@ -149,6 +153,7 @@ import useOverlay from '../composition/overlay';
149153
import usePlayer from '../composition/player';
150154
import useSettings from '../composition/settings';
151155
import { datetimeFormats } from '../i18n/index';
156+
import coverImg from '../images/mycover.jpg';
152157
import type { Comment } from '../provider/types';
153158
import MediaService from '../services/MediaService';
154159
const { t, d } = useI18n({
@@ -176,6 +181,7 @@ const showPlaylist = (playlistId?: string) => {
176181
};
177182
178183
const toggleLyricTranslation = () => setSettings({ enableLyricTranslation: !settings.enableLyricTranslation });
184+
const isHighlighted = (n: number, flag: boolean) => n == (flag ? lyricLineNumberTrans : lyricLineNumber);
179185
180186
const showImage = (e: any, url: any) => {
181187
e.target.src = url;
@@ -254,4 +260,9 @@ watchEffect(async () => {
254260
.page .songdetail-wrapper .close svg {
255261
stroke: var(--now-playing-close-icon-color);
256262
} */
263+
264+
.blur-mask {
265+
mask: linear-gradient(transparent 5%, black 20%, black 80%, transparent 95%);
266+
-webkit-mask: linear-gradient(transparent 5%, black 20%, black 80%, transparent 95%);
267+
}
257268
</style>

0 commit comments

Comments
 (0)