Skip to content

Commit ca66481

Browse files
committed
[WIP] Add communities
1 parent d17e6b8 commit ca66481

36 files changed

Lines changed: 1218 additions & 40 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 '*/components/buttons/BaseButton.vue'
16+
import BasePlaylistCreateModal
17+
from '*/components/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: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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
22+
from '*/components/containers/pages/BasePageContainer.vue'
23+
import navigationMixin from '*/mixins/navigationMixin'
24+
import {
25+
communities as formatCommunitiesPageNavigation
26+
} from '*/helpers/formatters/navigation'
27+
import formatCommunitiesPageTab from '*/helpers/formatters/tabs/communities'
28+
import getCommunities from '*/helpers/actions/api/communities/get'
29+
30+
export default {
31+
name: 'BaseCommunitiesPageContainer',
32+
components: {
33+
BasePageContainer
34+
},
35+
mixins: [
36+
navigationMixin
37+
],
38+
props: {
39+
responsePageLimit: Number
40+
},
41+
data () {
42+
return {
43+
communitiesData: null,
44+
error: null,
45+
isLoading: false
46+
}
47+
},
48+
computed: {
49+
navigationSections () {
50+
return formatCommunitiesPageNavigation()
51+
},
52+
tabData () {
53+
return formatCommunitiesPageTab()
54+
},
55+
communitiesArgs () {
56+
return {
57+
limit: this.responsePageLimit
58+
}
59+
}
60+
},
61+
mounted () {
62+
this.setNavigation()
63+
64+
this.fetchData()
65+
},
66+
methods: {
67+
handleRefresh (page) {
68+
this.fetchData(page)
69+
},
70+
getCommunities,
71+
fetchData (page) {
72+
this.getCommunities({
73+
...this.communitiesArgs,
74+
page
75+
})
76+
}
77+
}
78+
}
79+
</script>
80+
81+
<style lang="sass" scoped></style>
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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
22+
from '*/components/containers/pages/BasePageContainer.vue'
23+
import navigationMixin from '*/mixins/navigationMixin'
24+
import formatCommunityPageNavigation
25+
from '*/helpers/formatters/navigation/community'
26+
import formatCommunityPageTab from '*/helpers/formatters/tabs/community'
27+
import getCommunity from '*/helpers/actions/api/community/get'
28+
29+
export default {
30+
name: 'BaseCommunityPageContainer',
31+
components: {
32+
BasePageContainer
33+
},
34+
mixins: [
35+
navigationMixin
36+
],
37+
provide () {
38+
return {
39+
setCommunityData: this.setCommunityData
40+
}
41+
},
42+
props: {
43+
communityId: String
44+
},
45+
data () {
46+
return {
47+
communityData: null,
48+
error: null,
49+
isLoading: false
50+
}
51+
},
52+
computed: {
53+
navigationSections () {
54+
return formatCommunityPageNavigation(
55+
this.navigationData
56+
)
57+
},
58+
navigationData () {
59+
return {
60+
communityId: this.communityId,
61+
communityTitle: this.communityTitleFetched
62+
}
63+
},
64+
tabData () {
65+
return formatCommunityPageTab(
66+
this.navigationData
67+
)
68+
},
69+
communityTitleFetched () {
70+
return this.communityData?.title
71+
},
72+
communityArgs () {
73+
return {
74+
communityId: this.communityId
75+
}
76+
}
77+
},
78+
watch: {
79+
communityData: 'handleNavigationDataChange'
80+
},
81+
mounted () {
82+
this.fetchData()
83+
},
84+
methods: {
85+
handleRefresh () {
86+
this.fetchData()
87+
},
88+
getCommunity,
89+
fetchData () {
90+
this.getCommunity(
91+
this.communityArgs
92+
)
93+
},
94+
setCommunityData (value) {
95+
this.communityData = value
96+
}
97+
}
98+
}
99+
</script>
100+
101+
<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
@@ -32,6 +32,8 @@ import formatProfileFavoritesPageTab
3232
import formatProfilePlaylistsPageTab
3333
from '*/helpers/formatters/tabs/profile/playlists'
3434
import formatProfilePostsPageTab from '*/helpers/formatters/tabs/profile/posts'
35+
import formatProfileCommunitiesPageTab
36+
from '*/helpers/formatters/tabs/profile/communities'
3537
import getProfile from '*/helpers/actions/api/profile/get'
3638
3739
export default {
@@ -108,6 +110,10 @@ export default {
108110
return formatProfilePostsPageTab(
109111
this.navigationData
110112
)
113+
case 'communities':
114+
return formatProfileCommunitiesPageTab(
115+
this.navigationData
116+
)
111117
default:
112118
return formatProfilePageTab(
113119
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 '*/components/BaseSidebarItem.vue'
12+
import {
13+
communities as formatProfileCommunitiesLink
14+
} from '*/helpers/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: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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
13+
from '*/components/containers/lists/BaseListContainer.vue'
14+
import CommunityItem from './BaseCommunitiesSimpleList/CommunityItem.vue'
15+
import { collection as formatCollection } from '*/helpers/formatters'
16+
17+
export default {
18+
name: 'BaseCommunitiesSimpleList',
19+
components: {
20+
BaseListContainer,
21+
CommunityItem
22+
},
23+
props: {
24+
communities: {
25+
type: Array,
26+
default () {
27+
return []
28+
}
29+
}
30+
},
31+
computed: {
32+
communitiesCollection () {
33+
return formatCollection(
34+
this.communities
35+
)
36+
}
37+
}
38+
}
39+
</script>
40+
41+
<style lang="sass" scoped></style>

0 commit comments

Comments
 (0)