Skip to content

Commit 8294211

Browse files
committed
Refactor options props
1 parent 5db9e26 commit 8294211

37 files changed

+226
-226
lines changed

src/components/containers/tabs/profile/favorites/BaseProfileFavoriteTabContainer.vue

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
:is="tabData.component"
2121
:[tabData.scope]="slotProps[tabData.scope]"
2222
:profile-id="profileId"
23-
:is-with-playlist-option="isWithPlaylistOption"
24-
:is-with-delete-option="isWithDeleteOption"
23+
:is-with-playlist-option="isSelf"
24+
:is-with-delete-option="isSelf"
2525
is-with-image
2626
is-with-artist-name
2727
is-with-album-title
@@ -62,8 +62,11 @@ export default {
6262
type: Object,
6363
required: true
6464
},
65-
isActive: Boolean,
66-
profileId: String
65+
profileId: {
66+
type: String,
67+
required: true
68+
},
69+
isActive: Boolean
6770
},
6871
emits: [
6972
'focus'
@@ -93,12 +96,7 @@ export default {
9396
favoritesData () {
9497
return this.profileData?.favorites
9598
},
96-
isWithPlaylistOption () {
97-
return isCurrentProfile(
98-
this.profileId
99-
)
100-
},
101-
isWithDeleteOption () {
99+
isSelf () {
102100
return isCurrentProfile(
103101
this.profileId
104102
)

src/components/containers/tabs/profile/library/BaseProfileLibraryTabContainer.vue

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
:[tabData.scope]="slotProps[tabData.scope]"
2222
:items-in-row="tabData.itemsInRow"
2323
:profile-id="profileId"
24-
:is-with-playlist-option="isWithPlaylistOption"
25-
:is-with-favorite-option="isWithFavoriteOption"
24+
:is-with-playlist-option="isSelf"
25+
:is-with-favorite-option="isSelf"
2626
:is-with-delete-option="isWithDeleteOption(tabData.scope)"
2727
is-with-image
2828
is-with-artist-name
@@ -102,12 +102,7 @@ export default {
102102
libraryData () {
103103
return this.profileData?.library
104104
},
105-
isWithPlaylistOption () {
106-
return isCurrentProfile(
107-
this.profileId
108-
)
109-
},
110-
isWithFavoriteOption () {
105+
isSelf () {
111106
return isCurrentProfile(
112107
this.profileId
113108
)
@@ -166,9 +161,7 @@ export default {
166161
) {
167162
return (
168163
scope === 'tracks' &&
169-
isCurrentProfile(
170-
this.profileId
171-
)
164+
this.isSelf
172165
)
173166
}
174167
}

src/components/lists/playlists/BasePlaylistsSimpleList/PlaylistItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</div>
4646

4747
<BaseOptionsDropdown
48-
:is-with-delete-option="isWithDeleteOption"
48+
:is-with-delete-option="isSelf"
4949
@delete-option-click="handleDeleteOptionClick"
5050
/>
5151
</template>
@@ -176,7 +176,7 @@ export default {
176176
uuid () {
177177
return this.playlistData.uuid
178178
},
179-
isWithDeleteOption () {
179+
isSelf () {
180180
return isCurrentProfile(
181181
this.profileId
182182
)

src/components/lists/profiles/BaseProfilesSimpleList/ProfileItem.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
/>
5555
</small>
5656

57-
<template v-if="isRenderOptions">
57+
<template v-if="!isSelf">
5858
<BaseOptionsDropdown
5959
:profile-data="profileData"
6060
is-with-follow-option
@@ -158,8 +158,8 @@ export default {
158158
`roles.${this.role}`
159159
)
160160
},
161-
isRenderOptions () {
162-
return !isCurrentProfile(
161+
isSelf () {
162+
return isCurrentProfile(
163163
this.profileId
164164
)
165165
},

src/views/profile/MainPage/InfoSegment.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
:profile-data="profileData"
1111
/>
1212

13-
<template v-if="isRenderProfileSection">
13+
<template v-if="!isSelf">
1414
<FollowSection
1515
:profile-data="profileData"
1616
/>
@@ -46,8 +46,8 @@ export default {
4646
profileData: Object
4747
},
4848
computed: {
49-
isRenderProfileSection () {
50-
return !isCurrentProfile(
49+
isSelf () {
50+
return isCurrentProfile(
5151
this.profileId
5252
)
5353
},

src/views/profile/MainPage/LibrarySegment.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
>
77
<template #default>
88
<CompatibilitySegment
9-
v-if="isRenderCompatibility"
9+
v-if="!isSelf"
1010
:profile-id="profileId"
1111
:profile-nickname="profileNickname"
1212
/>
@@ -51,8 +51,8 @@ export default {
5151
profileNickname: String
5252
},
5353
computed: {
54-
isRenderCompatibility () {
55-
return !isCurrentProfile(
54+
isSelf () {
55+
return isCurrentProfile(
5656
this.profileId
5757
)
5858
},

src/views/profile/PlaylistPage.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/>
1818

1919
<ImportSegment
20-
v-if="isRenderImport"
20+
v-if="isSelf"
2121
:playlist-id="playlistId"
2222
/>
2323

@@ -50,11 +50,14 @@ export default {
5050
TracksSegment
5151
},
5252
props: {
53-
profileId: String,
53+
profileId: {
54+
type: String,
55+
required: true
56+
},
5457
playlistId: String
5558
},
5659
computed: {
57-
isRenderImport () {
60+
isSelf () {
5861
return isCurrentProfile(
5962
this.profileId
6063
)

src/views/profile/PlaylistPage/InfoSegment.vue

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
<BaseOptionsDropdown
2929
class="playlist-options"
30-
:is-with-edit-option="isWithEditOption"
31-
:is-with-delete-option="isWithDeleteOption"
30+
:is-with-edit-option="isSelf"
31+
:is-with-delete-option="isSelf"
3232
@edit-option-click="handleEditOptionClick"
3333
@delete-option-click="handleDeleteOptionClick"
3434
/>
@@ -117,12 +117,7 @@ export default {
117117
created () {
118118
return this.playlistData.created
119119
},
120-
isWithEditOption () {
121-
return isCurrentProfile(
122-
this.profileId
123-
)
124-
},
125-
isWithDeleteOption () {
120+
isSelf () {
126121
return isCurrentProfile(
127122
this.profileId
128123
)

src/views/profile/PlaylistsPage.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class="top-segment"
1616
>
1717
<BasePlaylistCreateButton
18-
v-if="isRenderCreateButton"
18+
v-if="isSelf"
1919
/>
2020

2121
<BaseLink
@@ -73,7 +73,10 @@ export default {
7373
BasePlaylistsSimpleList
7474
},
7575
props: {
76-
profileId: String
76+
profileId: {
77+
type: String,
78+
required: true
79+
}
7780
},
7881
data () {
7982
return {
@@ -82,7 +85,7 @@ export default {
8285
}
8386
},
8487
computed: {
85-
isRenderCreateButton () {
88+
isSelf () {
8689
return isCurrentProfile(
8790
this.profileId
8891
)

src/views/profile/favorites/AlbumsPage.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<template #default="slotProps">
88
<BaseAlbumsSimpleList
99
:albums="slotProps[scope]"
10-
:is-with-delete-option="isWithDeleteOption"
10+
:is-with-delete-option="isSelf"
1111
is-with-artist-name
1212
is-favorite
1313
/>
@@ -31,7 +31,10 @@ export default {
3131
BaseAlbumsSimpleList
3232
},
3333
props: {
34-
profileId: String
34+
profileId: {
35+
type: String,
36+
required: true
37+
}
3538
},
3639
data () {
3740
return {
@@ -40,7 +43,7 @@ export default {
4043
}
4144
},
4245
computed: {
43-
isWithDeleteOption () {
46+
isSelf () {
4447
return isCurrentProfile(
4548
this.profileId
4649
)

0 commit comments

Comments
 (0)