Skip to content

Commit 2ff77f2

Browse files
committed
[WIP] Add communities
1 parent c4efe78 commit 2ff77f2

37 files changed

Lines changed: 1218 additions & 67 deletions

File tree

src/assets/styles/Main.sass

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,6 @@ a
279279
@extend .text-color-base
280280
.main-options-dropdown-container
281281
@extend .visibility-visible
282-
&.main-playlist-item, &.main-profile-item
283-
& > .content
284-
& > .description
285-
@extend .no-margin
286282

287283
.main-message-item, .main-profile-item
288284
& > .image
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<div>button</div>
3+
</template>
4+
5+
<script>
6+
export default {
7+
name: 'BaseCommunityCreateButton',
8+
components: {},
9+
props: {},
10+
data () {
11+
return {}
12+
},
13+
computed: {},
14+
methods: {}
15+
}
16+
</script>
17+
18+
<style lang="sass" scoped></style>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<template>
2+
<BaseButton
3+
class="primary"
4+
icon="plus"
5+
:text="createText"
6+
@click="handleButtonClick"
7+
/>
8+
9+
<BasePlaylistCreateModal
10+
ref="modal"
11+
/>
12+
</template>
13+
14+
<script>
15+
import BaseButton from '@/buttons/BaseButton.vue'
16+
import BasePlaylistCreateModal
17+
from '@/modals/playlist/BasePlaylistCreateModal.vue'
18+
19+
export default {
20+
name: 'BasePlaylistCreateButton',
21+
components: {
22+
BaseButton,
23+
BasePlaylistCreateModal
24+
},
25+
computed: {
26+
createText () {
27+
return this.$t(
28+
'actions.add.playlist'
29+
)
30+
}
31+
},
32+
methods: {
33+
handleButtonClick () {
34+
this.$refs.modal.show()
35+
}
36+
}
37+
}
38+
</script>
39+
40+
<style lang="sass" scoped></style>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<template>
2+
<BasePageContainer
3+
:isShowLoader="!communitiesData"
4+
:isLoading="isLoading"
5+
:isError="!communitiesData && !!error"
6+
:error="error"
7+
@refresh="handleRefresh"
8+
>
9+
<slot
10+
v-if="communitiesData"
11+
:isLoading="isLoading"
12+
:error="error"
13+
:communitiesData="communitiesData"
14+
:fetchData="fetchData"
15+
:handleRefresh="handleRefresh"
16+
></slot>
17+
</BasePageContainer>
18+
</template>
19+
20+
<script>
21+
import BasePageContainer from '@/containers/pages/BasePageContainer.vue'
22+
import navigationMixin from '*/mixins/navigationMixin'
23+
import {
24+
communities as formatCommunitiesPageNavigation
25+
} from '#/formatters/navigation'
26+
import formatCommunitiesPageTab from '#/formatters/tabs/communities'
27+
import getCommunities from '#/actions/api/communities/get'
28+
29+
export default {
30+
name: 'BaseCommunitiesPageContainer',
31+
components: {
32+
BasePageContainer
33+
},
34+
mixins: [
35+
navigationMixin
36+
],
37+
props: {
38+
responsePageLimit: Number
39+
},
40+
data () {
41+
return {
42+
communitiesData: null,
43+
error: null,
44+
isLoading: false
45+
}
46+
},
47+
computed: {
48+
navigationSections () {
49+
return formatCommunitiesPageNavigation()
50+
},
51+
tabData () {
52+
return formatCommunitiesPageTab()
53+
},
54+
communitiesArgs () {
55+
return {
56+
limit: this.responsePageLimit
57+
}
58+
}
59+
},
60+
mounted () {
61+
this.setNavigation()
62+
63+
this.fetchData()
64+
},
65+
methods: {
66+
handleRefresh (page) {
67+
this.fetchData(page)
68+
},
69+
getCommunities,
70+
fetchData (page) {
71+
this.getCommunities({
72+
...this.communitiesArgs,
73+
page
74+
})
75+
}
76+
}
77+
}
78+
</script>
79+
80+
<style lang="sass" scoped></style>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<template>
2+
<BasePageContainer
3+
:isShowLoader="!communityData"
4+
:isLoading="isLoading"
5+
:isError="!communityData && !!error"
6+
:error="error"
7+
@refresh="handleRefresh"
8+
>
9+
<slot
10+
v-if="communityData"
11+
:isLoading="isLoading"
12+
:error="error"
13+
:communityData="communityData"
14+
:fetchData="fetchData"
15+
:handleRefresh="handleRefresh"
16+
></slot>
17+
</BasePageContainer>
18+
</template>
19+
20+
<script>
21+
import BasePageContainer from '@/containers/pages/BasePageContainer.vue'
22+
import navigationMixin from '*/mixins/navigationMixin'
23+
import formatCommunityPageNavigation
24+
from '#/formatters/navigation/community'
25+
import formatCommunityPageTab from '#/formatters/tabs/community'
26+
import getCommunity from '#/actions/api/community/get'
27+
28+
export default {
29+
name: 'BaseCommunityPageContainer',
30+
components: {
31+
BasePageContainer
32+
},
33+
mixins: [
34+
navigationMixin
35+
],
36+
provide () {
37+
return {
38+
setCommunityData: this.setCommunityData
39+
}
40+
},
41+
props: {
42+
communityId: String
43+
},
44+
data () {
45+
return {
46+
communityData: null,
47+
error: null,
48+
isLoading: false
49+
}
50+
},
51+
computed: {
52+
navigationSections () {
53+
return formatCommunityPageNavigation(
54+
this.navigationData
55+
)
56+
},
57+
navigationData () {
58+
return {
59+
communityId: this.communityId,
60+
communityTitle: this.communityTitleFetched
61+
}
62+
},
63+
tabData () {
64+
return formatCommunityPageTab(
65+
this.navigationData
66+
)
67+
},
68+
communityTitleFetched () {
69+
return this.communityData?.title
70+
},
71+
communityArgs () {
72+
return {
73+
communityId: this.communityId
74+
}
75+
}
76+
},
77+
watch: {
78+
communityData: 'handleNavigationDataChange'
79+
},
80+
mounted () {
81+
this.fetchData()
82+
},
83+
methods: {
84+
handleRefresh () {
85+
this.fetchData()
86+
},
87+
getCommunity,
88+
fetchData () {
89+
this.getCommunity(
90+
this.communityArgs
91+
)
92+
},
93+
setCommunityData (value) {
94+
this.communityData = value
95+
}
96+
}
97+
}
98+
</script>
99+
100+
<style lang="sass" scoped></style>

src/components/containers/pages/profile/BaseProfilePageContainer.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import formatProfileLibraryPageTab from '#/formatters/tabs/profile/library'
2727
import formatProfileFavoritesPageTab from '#/formatters/tabs/profile/favorites'
2828
import formatProfilePlaylistsPageTab from '#/formatters/tabs/profile/playlists'
2929
import formatProfilePostsPageTab from '#/formatters/tabs/profile/posts'
30+
import formatProfileCommunitiesPageTab
31+
from '#/formatters/tabs/profile/communities'
3032
import getProfile from '#/actions/api/profile/get'
3133
3234
export default {
@@ -103,6 +105,10 @@ export default {
103105
return formatProfilePostsPageTab(
104106
this.navigationData
105107
)
108+
case 'communities':
109+
return formatProfileCommunitiesPageTab(
110+
this.navigationData
111+
)
106112
default:
107113
return formatProfilePageTab(
108114
this.navigationData

src/components/images/BaseImage.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default {
2828
track: 'https://lastfm.freetls.fastly.net/i/u/300x300/4128a6eb29f94943c9d206c08e625904.png',
2929
playlist: 'https://lastfm.freetls.fastly.net/i/u/300x300/4128a6eb29f94943c9d206c08e625904.png',
3030
profile: 'https://lastfm.freetls.fastly.net/i/u/300x300/818148bf682d429dc215c1705eb27b98.png',
31+
community: 'https://lastfm.freetls.fastly.net/i/u/300x300/818148bf682d429dc215c1705eb27b98.png',
3132
video: 'https://i.ytimg.com'
3233
}
3334
}

src/components/layout/panels/TheSidebarPanel.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<BookmarksItem />
1616
<TopItem />
1717
<RadioItem />
18+
<CommunitiesItem />
1819
</div>
1920

2021
<div>
@@ -37,6 +38,7 @@ import FavoritesItem from './TheSidebarPanel/FavoritesItem.vue'
3738
import BookmarksItem from './TheSidebarPanel/BookmarksItem.vue'
3839
import TopItem from './TheSidebarPanel/TopItem.vue'
3940
import RadioItem from './TheSidebarPanel/RadioItem.vue'
41+
import CommunitiesItem from './TheSidebarPanel/CommunitiesItem.vue'
4042
import SettingsItem from './TheSidebarPanel/SettingsItem.vue'
4143
import LogoutItem from './TheSidebarPanel/LogoutItem.vue'
4244
@@ -53,6 +55,7 @@ export default {
5355
BookmarksItem,
5456
TopItem,
5557
RadioItem,
58+
CommunitiesItem,
5659
SettingsItem,
5760
LogoutItem
5861
},
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<template>
2+
<BaseSidebarItem
3+
icon="users"
4+
:text="communitiesText"
5+
:link="profileCommunitiesLink"
6+
/>
7+
</template>
8+
9+
<script>
10+
import { mapState } from 'vuex'
11+
import BaseSidebarItem from '@/BaseSidebarItem.vue'
12+
import {
13+
communities as formatProfileCommunitiesLink
14+
} from '#/formatters/links/profile'
15+
16+
export default {
17+
name: 'CommunitiesItem',
18+
components: {
19+
BaseSidebarItem
20+
},
21+
computed: {
22+
...mapState('profile', {
23+
profileInfo: 'info'
24+
}),
25+
communitiesText () {
26+
return this.$t(
27+
'navigation.communities'
28+
)
29+
},
30+
profileCommunitiesLink () {
31+
return formatProfileCommunitiesLink({
32+
profileId: this.profileId
33+
})
34+
},
35+
profileId () {
36+
return this.profileInfo.id.toString()
37+
}
38+
}
39+
}
40+
</script>
41+
42+
<style lang="sass" scoped></style>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<template>
2+
<BaseListContainer class="selection">
3+
<CommunityItem
4+
v-for="communityData in communitiesCollection"
5+
:key="communityData.uuid"
6+
:communityData="communityData"
7+
/>
8+
</BaseListContainer>
9+
</template>
10+
11+
<script>
12+
import BaseListContainer from '@/containers/lists/BaseListContainer.vue'
13+
import CommunityItem from './BaseCommunitiesSimpleList/CommunityItem.vue'
14+
import { collection as formatCollection } from '#/formatters'
15+
16+
export default {
17+
name: 'BaseCommunitiesSimpleList',
18+
components: {
19+
BaseListContainer,
20+
CommunityItem
21+
},
22+
props: {
23+
communities: {
24+
type: Array,
25+
default () {
26+
return []
27+
}
28+
}
29+
},
30+
computed: {
31+
communitiesCollection () {
32+
return formatCollection(
33+
this.communities
34+
)
35+
}
36+
}
37+
}
38+
</script>
39+
40+
<style lang="sass" scoped></style>

0 commit comments

Comments
 (0)