Skip to content

Commit 0ae9cf9

Browse files
committed
refactor: Adjust store state names.
1 parent 3c42c3a commit 0ae9cf9

File tree

24 files changed

+365
-273
lines changed

24 files changed

+365
-273
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/ButtonSave/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<button v-tooltip="toolTipLike" @click.prevent="handleClick">
3-
<IconSaved v-if="isSaved" />
3+
<IconSaved v-if="saved" />
44
<IconAddTo v-else />
55
</button>
66
</template>
@@ -10,7 +10,7 @@ import IconSaved from '@/components/Icons/IconSaved.vue'
1010
export default {
1111
name: 'ButtonSave',
1212
props: {
13-
isSaved: {
13+
saved: {
1414
type: Boolean,
1515
required: true
1616
},
@@ -25,7 +25,7 @@ export default {
2525
},
2626
computed: {
2727
toolTipLike() {
28-
if (this.isSaved) {
28+
if (this.saved) {
2929
return this.$t('tooltip.remove_from_library')
3030
}
3131
return this.$t('tooltip.add_to_library')

src/components/ButtonTogglePlay/index.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ export default {
3030
}
3131
},
3232
computed: {
33-
...mapWritableState(usePlayerStore, ['context', 'current_track', 'isPause', 'activeDevice']),
33+
...mapWritableState(usePlayerStore, [
34+
'context',
35+
'current_track',
36+
'active_pause',
37+
'activeDevice'
38+
]),
3439
isPlaying() {
35-
return !this.isPause && this.isCurrent
40+
return !this.active_pause && this.isCurrent
3641
},
3742
isCurrent() {
3843
if (this.item.type === 'track') {

src/components/CardAlbumLibrary/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/>
2929
</div>
3030
<Transition name="fade">
31-
<div v-if="!isCollasped" class="card-album-library-contanier__info">
31+
<div v-if="!active_collasped" class="card-album-library-contanier__info">
3232
<a
3333
@click.prevent.stop="$router.push({ name: 'Album', params: { albumId: item.id } })"
3434
class="card-album-library-contanier__info__title"
@@ -64,7 +64,7 @@
6464
<div class="card-album-library-contanier__cover">
6565
<Skeleton class="card-album-library-contanier__cover__img" />
6666
</div>
67-
<div v-if="!isCollasped" class="card-album-library-contanier__info">
67+
<div v-if="!active_collasped" class="card-album-library-contanier__info">
6868
<Skeleton class="card-album-library-contanier__info__title skeleton__name" />
6969
<Skeleton class="card-album-library-contanier__info__artists skeleton__artists" />
7070
</div>
@@ -106,7 +106,7 @@ export default {
106106
Image
107107
},
108108
computed: {
109-
...mapState(useLibraryStore, ['isCollasped']),
109+
...mapState(useLibraryStore, ['active_collasped']),
110110
...mapState(usePlayerStore, ['isPause', 'context']),
111111
isPlaying() {
112112
return !this.isPause && this.isCurrentItem

src/components/CardArtistLibrary/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/>
2929
</div>
3030
<Transition name="fade">
31-
<div v-if="!isCollasped" class="card-artist-library-contanier__info">
31+
<div v-if="!active_collasped" class="card-artist-library-contanier__info">
3232
<a
3333
@click.prevent.stop="$router.push({ name: 'Artist', params: { artistId: item.id } })"
3434
class="card-artist-library-contanier__info__title"
@@ -47,7 +47,7 @@
4747
<div class="card-artist-library-contanier__cover">
4848
<Skeleton class="card-artist-library-contanier__cover__img" />
4949
</div>
50-
<div v-if="!isCollasped" class="card-artist-library-contanier__info">
50+
<div v-if="!active_collasped" class="card-artist-library-contanier__info">
5151
<Skeleton class="card-artist-library-contanier__info__title skeleton__name" />
5252
</div>
5353
</div>
@@ -83,7 +83,7 @@ export default {
8383
Image
8484
},
8585
computed: {
86-
...mapState(useLibraryStore, ['isCollasped']),
86+
...mapState(useLibraryStore, ['active_collasped']),
8787
...mapState(usePlayerStore, ['isPause', 'context']),
8888
isPlaying() {
8989
return !this.isPause && this.isCurrentItem

src/components/CardPlaylistLibrary/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</div>
3434
</div>
3535
<Transition name="fade">
36-
<div v-if="!isCollasped" class="card-playlist-library-contanier__info">
36+
<div v-if="!active_collasped" class="card-playlist-library-contanier__info">
3737
<a
3838
@click.prevent.stop="
3939
$router.push({ name: 'Playlist', params: { playlistId: item.id } })
@@ -60,7 +60,7 @@
6060
<div class="card-playlist-library-contanier__cover">
6161
<Skeleton class="card-playlist-library-contanier__cover__img" />
6262
</div>
63-
<div v-if="!isCollasped" class="card-playlist-library-contanier__info">
63+
<div v-if="!active_collasped" class="card-playlist-library-contanier__info">
6464
<Skeleton class="card-playlist-library-contanier__info__title skeleton__name" />
6565
<Skeleton class="card-playlist-library-contanier__info__artists skeleton__artists" />
6666
</div>
@@ -99,7 +99,7 @@ export default {
9999
Image
100100
},
101101
computed: {
102-
...mapState(useLibraryStore, ['isCollasped']),
102+
...mapState(useLibraryStore, ['active_collasped']),
103103
...mapState(usePlayerStore, ['isPause', 'context']),
104104
isPlaying() {
105105
return !this.isPause && this.isCurrentItem

src/components/CardTrackHorizontal/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class="card-library-container__right-wrapper__btn-wrapper"
2525
:class="{
2626
'card-library-container__right-wrapper__btn-wrapper-playing':
27-
!isPause && item.track.uri === current_track.uri
27+
!isPause && item.track?.uri === current_track?.uri
2828
}"
2929
>
3030
<ButtonTogglePlay :item="item.track" />

src/components/CardTrackLibrary/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
</div>
2323
<Image
2424
class="card-track-library-contanier__cover__img"
25-
:src="item.album.images[0]?.url"
25+
:src="item.album?.images[0]?.url"
2626
:alt="item.name"
2727
no-scale
2828
/>
2929
</div>
3030
<Transition name="fade">
31-
<div v-if="!isCollasped" class="card-track-library-contanier__info">
31+
<div v-if="!active_collasped" class="card-track-library-contanier__info">
3232
<a
3333
@click.prevent.stop="$router.push({ name: 'Track', params: { trackId: item.id } })"
3434
class="card-track-library-contanier__info__title"
@@ -64,7 +64,7 @@
6464
<div class="card-track-library-contanier__cover">
6565
<Skeleton class="card-track-library-contanier__cover__img" />
6666
</div>
67-
<div v-if="!isCollasped" class="card-track-library-contanier__info">
67+
<div v-if="!active_collasped" class="card-track-library-contanier__info">
6868
<Skeleton class="card-track-library-contanier__info__title skeleton__name" />
6969
<Skeleton class="card-track-library-contanier__info__artists skeleton__artists" />
7070
</div>
@@ -111,7 +111,7 @@ export default {
111111
Image
112112
},
113113
computed: {
114-
...mapState(useLibraryStore, ['isCollasped']),
114+
...mapState(useLibraryStore, ['active_collasped']),
115115
...mapState(usePlayerStore, ['isPause', 'current_track']),
116116
isPlaying() {
117117
return !this.isPause && this.isCurrentItem

src/components/FullScreenPlayer/index.vue

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
22
<Transition name="slide-from-bottom">
33
<main
4-
v-show="showFullScreenPlayer"
4+
v-show="show_fullscreen_player"
55
@mousemove="isCursorMove = true"
66
class="full-screen-container"
77
>
88
<div
99
class="full-screen-container__background"
10-
:class="{ 'full-screen-container__background-pause': isPause }"
10+
:class="{ 'full-screen-container__background-pause': active_pause }"
1111
></div>
1212
<div class="full-screen-container__wrapper">
1313
<div class="full-screen-container__wrapper__top">
@@ -89,7 +89,7 @@
8989
<button
9090
v-tooltip="toolTipShuffle"
9191
class="icon-wrapper"
92-
:class="{ 'btn-active': isShuffle }"
92+
:class="{ 'btn-active': active_shuffle }"
9393
@click="toggleShuffle"
9494
>
9595
<IconShuffle />
@@ -105,7 +105,7 @@
105105
<span
106106
class="full-screen-container__wrapper__player__btns__mid__play__icon-wrapper-round"
107107
>
108-
<IconPlay v-if="isPause" />
108+
<IconPlay v-if="active_pause" />
109109
<IconPause v-else />
110110
</span>
111111
</button>
@@ -115,10 +115,10 @@
115115
<button
116116
v-tooltip="toolTipRepeat"
117117
class="icon-wrapper"
118-
:class="{ 'btn-active': repeatMode !== 0 }"
118+
:class="{ 'btn-active': repeat_mode !== 0 }"
119119
@click="setRepeatMode"
120120
>
121-
<IconRepeatSingle v-if="repeatMode === 2" />
121+
<IconRepeatSingle v-if="repeat_mode === 2" />
122122
<IconRepeat v-else />
123123
</button>
124124
</div>
@@ -171,34 +171,33 @@ export default {
171171
computed: {
172172
...mapWritableState(usePlayerStore, [
173173
'current_track',
174-
'isPause',
175-
'repeatMode',
176-
'isShuffle',
177-
'isMute',
174+
'active_pause',
175+
'repeat_mode',
176+
'active_shuffle',
178177
'volume'
179178
]),
180-
...mapWritableState(useAppStore, ['showFullScreenPlayer']),
179+
...mapWritableState(useAppStore, ['show_fullscreen_player']),
181180
toolTipShuffle() {
182-
if (this.isShuffle) {
181+
if (this.active_shuffle) {
183182
return this.$t('tooltip.disable_shuffle')
184183
}
185184
return this.$t('tooltip.enable_shuffle')
186185
},
187186
toolTipPlay() {
188-
if (this.isPause) {
187+
if (this.active_pause) {
189188
return this.$t('tooltip.play')
190189
}
191190
return this.$t('tooltip.pause')
192191
},
193192
toolTipRepeat() {
194-
if (this.repeatMode === 0) {
193+
if (this.repeat_mode === 0) {
195194
return this.$t('tooltip.repeat_enable')
196-
} else if (this.repeatMode === 1) {
195+
} else if (this.repeat_mode === 1) {
197196
return this.$t('tooltip.repeat_one')
198-
} else if (this.repeatMode === 2) {
197+
} else if (this.repeat_mode === 2) {
199198
return this.$t('tooltip.repeat_disable')
200199
} else {
201-
throw Error('Invalid value of repeatMode! Only accept values 0, 1 or 2.')
200+
throw Error('Invalid value of repeat_mode! Only accept values 0, 1 or 2.')
202201
}
203202
}
204203
},
@@ -220,7 +219,7 @@ export default {
220219
methods: {
221220
async closeFullScreenPlayer() {
222221
await this.closeFullscreen()
223-
this.showFullScreenPlayer = false
222+
this.show_fullscreen_player = false
224223
},
225224
/* Close fullscreen */
226225
async closeFullscreen() {

src/components/TagButton/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<button class="tag-button" :class="{ 'btn-active': activeTag }" @click="$emit('handleClick')">
2+
<button class="tag-button" :class="{ 'btn-active': isActive }" @click="$emit('handleClick')">
33
{{ text }}
44
</button>
55
</template>
@@ -9,7 +9,7 @@ export default {
99
name: 'TagButton',
1010
emits: ['handleClick'],
1111
props: {
12-
activeTag: {
12+
isActive: {
1313
type: Boolean,
1414
default: false
1515
},

0 commit comments

Comments
 (0)