Skip to content

Commit 60f1522

Browse files
committed
[WIP] Add communities
1 parent 545c996 commit 60f1522

73 files changed

Lines changed: 1072 additions & 259 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/assets/styles/Main.sass

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,16 @@ a
259259
& > .content
260260
@extend .flex-full, .no-padding
261261
.content-container
262-
margin-top: 1em
262+
margin-top: 0.75em
263263
.content-section
264264
margin-top: 5px !important
265265
.text
266266
font-size: 18px
267267
line-height: 1.2em
268268
& > .description
269269
margin-top: 0.25em !important
270+
&.main-timestamp
271+
@extend .no-margin
270272
.main-options-dropdown-container
271273
@extend .visibility-hidden
272274
margin-left: 0.5em
@@ -279,10 +281,8 @@ a
279281
@extend .text-color-base
280282
.main-options-dropdown-container
281283
@extend .visibility-visible
282-
283-
.main-message-item, .main-profile-item
284-
& > .image
285-
align-self: start
284+
&.main-post-item, &.main-message-item, &.main-profile-item
285+
@extend .align-items-start
286286

287287
.main-message
288288
@extend .no-shadow, .no-margin
@@ -630,8 +630,10 @@ a
630630
& > .buttons-container
631631
@extend .d-flex, .align-items-center
632632
margin-top: 1em
633-
& > .add-buttons
633+
& > .add-buttons-container
634634
@extend .flex-full
635+
& > .main-as-community-checkbox
636+
margin: 0 1em
635637
.images-tracks-section
636638
margin-top: 1em
637639

src/components/BaseTimestamp.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="main-small-container">
2+
<div class="main-small-container main-timestamp">
33
<small>
44
{{ createdText }}
55
</small>

src/components/buttons/BaseSubmitButton.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<template>
22
<button
3+
ref="button"
34
type="submit"
45
class="ui primary button main-submit-button"
56
:class="{ inverted: isDarkMode }"
67
>
8+
<i class="check icon"></i>
9+
710
{{ actionText }}
811
</button>
912
</template>
@@ -28,6 +31,11 @@ export default {
2831
`actions.${this.actionKey}`
2932
)
3033
}
34+
},
35+
methods: {
36+
click () {
37+
this.$refs.button.click()
38+
}
3139
}
3240
}
3341
</script>

src/components/buttons/community/BaseCommunityCreateButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<BaseButton
3-
class="primary"
3+
class="basic"
44
icon="plus"
55
:text="createText"
66
@click="handleButtonClick"

src/components/buttons/playlist/BasePlaylistCreateButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<BaseButton
3-
class="primary"
3+
class="basic"
44
icon="plus"
55
:text="createText"
66
@click="handleButtonClick"

src/components/containers/BaseDropdownContainer.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
:isError="isError"
3232
/>
3333

34-
<div class="menu">
34+
<div
35+
class="menu"
36+
:class="menuDirection"
37+
>
3538
<slot></slot>
3639
</div>
3740
</div>
@@ -63,7 +66,8 @@ export default {
6366
header: String,
6467
isDisabled: Boolean,
6568
isLoading: Boolean,
66-
isError: Boolean
69+
isError: Boolean,
70+
menuDirection: String
6771
},
6872
emits: [
6973
'change'

src/components/containers/forms/BaseFormContainer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<form
3-
class="ui form main-form"
43
ref="form"
4+
class="ui form main-form"
55
:class="{
66
loading: isLoading,
77
inverted: isDarkMode

src/components/containers/forms/community/BaseCommunityCreateFormContainer.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import BaseFormContainer
1515
import { communityFormOptions } from '*/helpers/data/plugins/semantic'
1616
import createCommunity from '*/helpers/actions/api/community/create'
1717
import {
18-
community as formatCommunityLink
19-
} from '*/helpers/formatters/links/communities'
18+
main as formatCommunityMainLink
19+
} from '*/helpers/formatters/links/community'
2020
2121
export default {
2222
name: 'BaseCommunityCreateFormContainer',
@@ -44,7 +44,7 @@ export default {
4444
})
4545
},
4646
communityUrl () {
47-
return formatCommunityLink({
47+
return formatCommunityMainLink({
4848
communityId: this.communityId
4949
})
5050
}

src/components/containers/forms/post/BasePostCreateFormContainer.vue

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import BaseFormContainer
1313
from '*/components/containers/forms/BaseFormContainer.vue'
1414
import { postFormOptions } from '*/helpers/data/plugins/semantic'
15-
import createPost from '*/helpers/actions/api/post/create'
15+
import createProfilePost from '*/helpers/actions/api/profile/post/create'
16+
import createCommunityPost from '*/helpers/actions/api/community/post/create'
1617
import { artistName as formatArtistName } from '*/helpers/formatters'
1718
1819
export default {
@@ -21,7 +22,7 @@ export default {
2122
BaseFormContainer
2223
},
2324
props: {
24-
profileId: {
25+
postType: {
2526
type: String,
2627
required: true
2728
},
@@ -36,7 +37,9 @@ export default {
3637
default () {
3738
return []
3839
}
39-
}
40+
},
41+
profileId: String,
42+
communityId: String
4043
},
4144
emits: [
4245
'success'
@@ -82,17 +85,25 @@ export default {
8285
8386
this.createPost(
8487
createArgs
85-
).then(
86-
this.handleCreateSuccess
8788
)
8889
}
8990
},
90-
handleCreateSuccess () {
91-
this.$emit(
92-
'success'
93-
)
91+
createProfilePost,
92+
createCommunityPost,
93+
createPost (args) {
94+
switch (this.postType) {
95+
case 'profile':
96+
return this.createProfilePost(
97+
args
98+
)
99+
case 'community':
100+
return this.createCommunityPost(
101+
args
102+
)
103+
default:
104+
return null
105+
}
94106
},
95-
createPost,
96107
formatTrack (trackData) {
97108
const artistName =
98109
formatArtistName(
@@ -112,6 +123,8 @@ export default {
112123
formatCreateArgs (fields) {
113124
return {
114125
otherProfileId: this.profileId,
126+
communityId: this.communityId,
127+
byCommunity: !!fields.community,
115128
content: fields.content,
116129
tracks: this.tracksFormatted,
117130
images: this.imagesFormatted

src/components/containers/forms/post/BasePostUpdateFormContainer.vue

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import BaseFormContainer
1313
from '*/components/containers/forms/BaseFormContainer.vue'
1414
import { postFormOptions } from '*/helpers/data/plugins/semantic'
15-
import updatePost from '*/helpers/actions/api/post/update'
15+
import updateProfilePost from '*/helpers/actions/api/profile/post/update'
16+
import updateCommunityPost from '*/helpers/actions/api/community/post/update'
1617
import { artistName as formatArtistName } from '*/helpers/formatters'
1718
1819
export default {
@@ -21,8 +22,8 @@ export default {
2122
BaseFormContainer
2223
},
2324
props: {
24-
postId: {
25-
type: String,
25+
postData: {
26+
type: Object,
2627
required: true
2728
},
2829
tracks: {
@@ -39,16 +40,24 @@ export default {
3940
}
4041
},
4142
emits: [
42-
'postDataChange'
43+
'success'
4344
],
4445
data () {
4546
return {
46-
postData: null,
4747
error: null,
4848
isLoading: false
4949
}
5050
},
5151
computed: {
52+
postId () {
53+
return this.postData.id
54+
},
55+
postType () {
56+
return this.postData.post_type
57+
},
58+
communityId () {
59+
return this.postData.community?.id
60+
},
5261
options () {
5362
return postFormOptions({
5463
onSuccess: this.handleSuccess
@@ -60,18 +69,11 @@ export default {
6069
)
6170
},
6271
imagesFormatted () {
63-
if (this.images.length) {
64-
return this.images.map(
65-
this.formatImage
66-
)
67-
} else {
68-
return 'DELETED'
69-
}
72+
return this.images.map(
73+
this.formatImage
74+
)
7075
}
7176
},
72-
watch: {
73-
postData: 'handlePostDataChange'
74-
},
7577
methods: {
7678
handleSuccess (event, fields) {
7779
event.preventDefault()
@@ -93,13 +95,22 @@ export default {
9395
)
9496
}
9597
},
96-
handlePostDataChange (value) {
97-
this.$emit(
98-
'postDataChange',
99-
value
100-
)
98+
updateProfilePost,
99+
updateCommunityPost,
100+
updatePost (args) {
101+
switch (this.postType) {
102+
case 'profile':
103+
return this.updateProfilePost(
104+
args
105+
)
106+
case 'community':
107+
return this.updateCommunityPost(
108+
args
109+
)
110+
default:
111+
return null
112+
}
101113
},
102-
updatePost,
103114
formatTrack (trackData) {
104115
const artistName =
105116
formatArtistName(
@@ -119,7 +130,9 @@ export default {
119130
},
120131
formatUpdateArgs (fields) {
121132
return {
133+
communityId: this.communityId,
122134
postId: this.postId,
135+
byCommunity: !!fields.community,
123136
content: fields.content,
124137
tracks: this.tracksFormatted,
125138
images: this.imagesFormatted

0 commit comments

Comments
 (0)