@bettertogether/community-engine-vue 0.1.7 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/README.md +140 -1
  2. package/dist/assets/BBadge.vue_vue_type_script_setup_true_lang-IIZ8QpjG-Z9WDKHqT.js +1 -0
  3. package/dist/assets/BCardText.vue_vue_type_script_setup_true_lang-Be6CD36N-B5JCTdmm.js +3 -0
  4. package/dist/assets/BFormSelect.vue_vue_type_script_setup_true_lang-BigptVap-B_HbOOZR.js +1 -0
  5. package/dist/assets/BRow.vue_vue_type_script_setup_true_lang-69TY75-8-DJdEdyx7.js +1 -0
  6. package/dist/assets/Communities-Cx4tT-bx.js +1 -0
  7. package/dist/assets/Communities-n33ssuUH.css +1 -0
  8. package/dist/assets/CommunityConversation-bBkYBs2k.css +1 -0
  9. package/dist/assets/CommunityConversation-jHAnv_Ps.js +1 -0
  10. package/dist/assets/CommunityConversations-rEDGS7To.js +1 -0
  11. package/dist/assets/CommunityEvent-CUdT0aT4.js +1 -0
  12. package/dist/assets/CommunityEvents-rsOgcxQr.js +1 -0
  13. package/dist/assets/CommunityHome-ChuTE2Nz.js +1 -0
  14. package/dist/assets/CommunityJoaTu-CpLIY_83.js +1 -0
  15. package/dist/assets/CommunityMembers-C3UtzQGp.css +1 -0
  16. package/dist/assets/CommunityMembers-DKf74ltl.js +1 -0
  17. package/dist/assets/CommunityPage-C5x23iQl.css +1 -0
  18. package/dist/assets/CommunityPage-CRYg9-rW.js +1 -0
  19. package/dist/assets/CommunityPages-IsLTNFC3.js +1 -0
  20. package/dist/assets/CommunityPost-BOnqqxVs.js +1 -0
  21. package/dist/assets/CommunityPost-BRYtkDSY.css +1 -0
  22. package/dist/assets/CommunityPosts-DY1olmcU.js +1 -0
  23. package/dist/assets/Error404-D10VQARe.js +1 -0
  24. package/dist/assets/EventCard-vfutXTdg.js +1 -0
  25. package/dist/assets/EventList-ChtehYcJ.js +1 -0
  26. package/dist/assets/ExtensionSlot-DJKbrq4c.js +1 -0
  27. package/dist/assets/PostList-BuHrBBqX.css +1 -0
  28. package/dist/assets/PostList-DYFgxlE8.js +1 -0
  29. package/dist/assets/SyncBadge-B1JBsdUk.js +1 -0
  30. package/dist/assets/SyncBadge-FNO-QLuu.css +1 -0
  31. package/dist/assets/UserPasswordNew-D_Djldm9.css +1 -0
  32. package/dist/assets/UserPasswordNew-al9bNBTZ.js +1 -0
  33. package/dist/assets/UserPasswordReset-42zs98RW.js +1 -0
  34. package/dist/assets/UserPasswordReset-D_6OQDZY.css +1 -0
  35. package/dist/assets/UserResendConfirmation-CGavYB81.js +1 -0
  36. package/dist/assets/UserResendConfirmation-DNTHcaar.css +1 -0
  37. package/dist/assets/UserSignIn-BIRb0HkV.js +1 -0
  38. package/dist/assets/UserSignIn-C-Pol8OD.css +1 -0
  39. package/dist/assets/UserSignUp-ChkKQAd2.css +1 -0
  40. package/dist/assets/UserSignUp-Df6o3vlO.js +1 -0
  41. package/dist/assets/better-together-logo-61cxo5d5.png +0 -0
  42. package/dist/assets/index-BFt-JKVh.css +5 -0
  43. package/dist/assets/index-COo3Jb7v.js +1088 -0
  44. package/dist/assets/nodefs-Bfyh92qg.js +1 -0
  45. package/dist/assets/opfs-ahp-BLzlXf6u.js +3 -0
  46. package/dist/assets/pglite-BdRI_ZYT.wasm +0 -0
  47. package/dist/assets/pglite-COscPi1Y.data +0 -0
  48. package/dist/assets/usePages-DDjDQRCy.js +1 -0
  49. package/dist/assets/usePosts-Bf2Ccwr4.js +1 -0
  50. package/{public → dist}/index.html +9 -19
  51. package/package.json +57 -45
  52. package/src/BtApp.vue +34 -43
  53. package/src/components/BtBrandingLogo.vue +10 -18
  54. package/src/components/BtHeader.vue +31 -89
  55. package/src/components/BtMainContent.vue +12 -43
  56. package/src/components/BtNavBar.vue +25 -38
  57. package/src/components/BtNavItem.vue +25 -58
  58. package/src/components/BtNavUser.vue +65 -86
  59. package/src/components/BtProfileForm.vue +48 -39
  60. package/src/components/BtUserNewPasswordForm.vue +52 -74
  61. package/src/components/BtUserResendConfirmationForm.vue +45 -83
  62. package/src/components/BtUserResetPasswordForm.vue +45 -77
  63. package/src/components/BtUserSignInForm.vue +59 -75
  64. package/src/components/BtUserSignUpForm.vue +90 -103
  65. package/src/components/CommunityForm.vue +47 -39
  66. package/src/components/community/CommunityCard.vue +113 -0
  67. package/src/components/community/CommunityHeader.vue +91 -0
  68. package/src/components/community/CommunityList.vue +59 -0
  69. package/src/components/community/MemberRoleRow.vue +107 -0
  70. package/src/components/conversation/ConversationCard.vue +49 -0
  71. package/src/components/conversation/ConversationDetail.vue +53 -0
  72. package/src/components/conversation/ConversationList.vue +51 -0
  73. package/src/components/conversation/MessageForm.vue +45 -0
  74. package/src/components/conversation/MessageItem.vue +43 -0
  75. package/src/components/conversation/MessageList.vue +39 -0
  76. package/src/components/event/EventCard.vue +82 -0
  77. package/src/components/event/EventForm.vue +99 -0
  78. package/src/components/event/EventList.vue +47 -0
  79. package/src/components/invitation/InvitationCard.vue +56 -0
  80. package/src/components/invitation/InvitationForm.vue +70 -0
  81. package/src/components/invitation/InvitationList.vue +51 -0
  82. package/src/components/joatu/AgreementCard.vue +57 -0
  83. package/src/components/joatu/AgreementList.vue +51 -0
  84. package/src/components/joatu/OfferCard.vue +65 -0
  85. package/src/components/joatu/OfferForm.vue +82 -0
  86. package/src/components/joatu/OfferList.vue +51 -0
  87. package/src/components/joatu/RequestCard.vue +65 -0
  88. package/src/components/joatu/RequestForm.vue +82 -0
  89. package/src/components/joatu/RequestList.vue +51 -0
  90. package/src/components/page/PageCard.vue +55 -0
  91. package/src/components/page/PageDetail.vue +35 -0
  92. package/src/components/page/PageList.vue +51 -0
  93. package/src/components/person/MemberList.vue +61 -0
  94. package/src/components/person/PersonAvatar.vue +54 -0
  95. package/src/components/person/PersonCard.vue +47 -0
  96. package/src/components/post/PostCard.vue +105 -0
  97. package/src/components/post/PostDetail.vue +98 -0
  98. package/src/components/post/PostForm.vue +84 -0
  99. package/src/components/post/PostList.vue +53 -0
  100. package/src/components/role/BlockButton.vue +44 -0
  101. package/src/components/role/RoleBadge.vue +19 -0
  102. package/src/components/role/RoleGate.vue +62 -0
  103. package/src/components/role/RoleSelector.vue +29 -0
  104. package/src/components/shared/ExtensionSlot.vue +27 -0
  105. package/src/components/sync/OfflineBanner.vue +49 -0
  106. package/src/components/sync/SyncBadge.vue +108 -0
  107. package/src/components/sync/SyncStatusBar.vue +121 -0
  108. package/src/composables/useCommunities.js +19 -0
  109. package/src/composables/useConversations.js +5 -0
  110. package/src/composables/useEvents.js +28 -0
  111. package/src/composables/useInvitations.js +10 -0
  112. package/src/composables/useJoaTuAgreements.js +11 -0
  113. package/src/composables/useJoaTuOffers.js +10 -0
  114. package/src/composables/useJoaTuRequests.js +10 -0
  115. package/src/composables/useMembers.js +30 -0
  116. package/src/composables/useMessages.js +5 -0
  117. package/src/composables/useNotifications.js +5 -0
  118. package/src/composables/usePages.js +6 -0
  119. package/src/composables/usePersonBlocks.js +65 -0
  120. package/src/composables/usePosts.js +27 -0
  121. package/src/composables/useResource.js +137 -0
  122. package/src/composables/useRoles.js +94 -0
  123. package/src/composables/useSyncStatus.js +22 -0
  124. package/src/composables/useToaster.js +20 -0
  125. package/src/context.js +18 -0
  126. package/src/db/client.js +343 -0
  127. package/src/db/migrations/001_initial.sql +131 -0
  128. package/src/db/migrations/003_conversations_invitations_pages_joatu.sql +76 -0
  129. package/src/db/sync.js +276 -0
  130. package/src/endpoints/BtApiAuth.js +1 -1
  131. package/src/endpoints/BtApiV1.js +1 -1
  132. package/src/extension.js +45 -0
  133. package/src/i18n/index.js +103 -0
  134. package/src/i18n/locales/en.json +275 -0
  135. package/src/i18n/locales/es.json +275 -0
  136. package/src/i18n/locales/fr.json +223 -0
  137. package/src/i18n/locales/uk.json +275 -0
  138. package/src/index.js +168 -22
  139. package/src/layouts/CommunityLayout.vue +89 -0
  140. package/src/main.js +16 -12
  141. package/src/mixins/error-handling.js +6 -15
  142. package/src/mixins/toaster.js +15 -10
  143. package/src/pages/Communities.vue +59 -0
  144. package/src/pages/Error404.vue +10 -14
  145. package/src/pages/Home.vue +11 -18
  146. package/src/pages/Me.vue +39 -59
  147. package/src/pages/UserPasswordNew.vue +12 -68
  148. package/src/pages/UserPasswordReset.vue +15 -64
  149. package/src/pages/UserResendConfirmation.vue +39 -113
  150. package/src/pages/UserSignIn.vue +18 -67
  151. package/src/pages/UserSignUp.vue +15 -64
  152. package/src/pages/community/CommunityConversation.vue +31 -0
  153. package/src/pages/community/CommunityConversations.vue +18 -0
  154. package/src/pages/community/CommunityEvent.vue +39 -0
  155. package/src/pages/community/CommunityEvents.vue +58 -0
  156. package/src/pages/community/CommunityHome.vue +49 -0
  157. package/src/pages/community/CommunityJoaTu.vue +115 -0
  158. package/src/pages/community/CommunityMembers.vue +23 -0
  159. package/src/pages/community/CommunityPage.vue +31 -0
  160. package/src/pages/community/CommunityPages.vue +25 -0
  161. package/src/pages/community/CommunityPost.vue +28 -0
  162. package/src/pages/community/CommunityPosts.vue +58 -0
  163. package/src/pages/community/CommunitySettingsPage.vue +117 -0
  164. package/src/pages/community/RoleManagerPage.vue +93 -0
  165. package/src/plugins/bootstrap-vue.js +5 -5
  166. package/src/plugins/font-awesome.js +3 -2
  167. package/src/plugins/index.js +9 -4
  168. package/src/plugins/progress.js +16 -0
  169. package/src/pwa/index.js +156 -0
  170. package/src/pwa/sw-helpers.js +130 -0
  171. package/src/router/communityRoutes.js +78 -0
  172. package/src/router/index.js +30 -144
  173. package/src/slot-registry.js +15 -0
  174. package/src/stores/auth.js +134 -0
  175. package/src/stores/communities.js +59 -0
  176. package/src/stores/index.js +5 -0
  177. package/src/stores/menus.js +14 -0
  178. package/src/stores/people.js +48 -0
  179. package/src/stores/sync.js +93 -0
  180. package/src/stylesheets/sync-indicators.scss +34 -0
  181. package/.env.sample +0 -1
  182. package/.eslintrc.js +0 -51
  183. package/.gitlab-ci.yml +0 -14
  184. package/.travis/.rbenv-gemsets +0 -1
  185. package/.travis/.ruby-version +0 -1
  186. package/.travis.yml +0 -31
  187. package/babel.config.js +0 -5
  188. package/cypress.json +0 -3
  189. package/deploy/build.sh +0 -8
  190. package/eslint.config.js +0 -16
  191. package/postcss.config.js +0 -5
  192. package/src/eslint.config.js +0 -16
  193. package/src/forms/BtProfileFormSchema.js +0 -19
  194. package/src/forms/BtUserConfirmationFormSchema.js +0 -20
  195. package/src/forms/BtUserNewPasswordFormSchema.js +0 -29
  196. package/src/forms/BtUserResetPasswordFormSchema.js +0 -20
  197. package/src/forms/BtUserSignInFormSchema.js +0 -29
  198. package/src/forms/BtUserSignUpFormSchema.js +0 -63
  199. package/src/forms/CommunityFormSchema.js +0 -19
  200. package/src/plugins/vue-form-generator.js +0 -4
  201. package/src/plugins/vue-loading.js +0 -10
  202. package/src/registerServiceWorker.js +0 -32
  203. package/src/store/index.js +0 -32
  204. package/src/store/modules/authentication.js +0 -170
  205. package/src/store/modules/communities.js +0 -98
  206. package/src/store/modules/community-engine.js +0 -14
  207. package/src/store/modules/menus.js +0 -52
  208. package/src/store/modules/people.js +0 -88
  209. package/src/vue.config.js +0 -0
  210. package/tests/e2e/.eslintrc.js +0 -12
  211. package/tests/e2e/plugins/index.js +0 -26
  212. package/tests/e2e/specs/home.js +0 -8
  213. package/tests/e2e/support/commands.js +0 -25
  214. package/tests/e2e/support/index.js +0 -20
  215. package/tests/unit/.eslintrc.js +0 -5
  216. package/tests/unit/example.spec.js +0 -13
  217. package/vue.config.js +0 -11
  218. package/webpack.config.js +0 -28
  219. /package/{public → dist}/_redirects +0 -0
  220. /package/{public → dist}/favicon.ico +0 -0
  221. /package/{public → dist}/img/favicon.ico +0 -0
  222. /package/{public → dist}/img/icons/android-chrome-192x192.png +0 -0
  223. /package/{public → dist}/img/icons/android-chrome-384x384.png +0 -0
  224. /package/{public → dist}/img/icons/apple-touch-icon.png +0 -0
  225. /package/{public → dist}/img/icons/favicon-16x16.png +0 -0
  226. /package/{public → dist}/img/icons/favicon-32x32.png +0 -0
  227. /package/{public → dist}/img/icons/favicon.ico +0 -0
  228. /package/{public → dist}/img/icons/mstile-150x150.png +0 -0
  229. /package/{public → dist}/img/icons/safari-pinned-tab.svg +0 -0
  230. /package/{public → dist}/robots.txt +0 -0
@@ -1,45 +1,53 @@
1
1
  <template>
2
- <vue-form-generator
3
- tag="div"
4
- :schema="schema"
5
- :model="localModel"
6
- rows="3"
7
- max-rows="6"
8
- :is-new-model="true"
9
- />
2
+ <BForm @submit.prevent="handleSubmit">
3
+ <BFormGroup
4
+ :label="t('bt.communities.name_label')"
5
+ label-for="community-name"
6
+ >
7
+ <BFormInput
8
+ id="community-name"
9
+ v-model="form.name"
10
+ type="text"
11
+ required
12
+ :placeholder="t('bt.communities.name_label')"
13
+ />
14
+ </BFormGroup>
15
+ <BFormGroup
16
+ :label="t('bt.communities.description_label')"
17
+ label-for="community-description"
18
+ >
19
+ <BFormTextarea
20
+ id="community-description"
21
+ v-model="form.description"
22
+ rows="3"
23
+ required
24
+ :placeholder="t('bt.communities.description_label')"
25
+ />
26
+ </BFormGroup>
27
+ <BButton
28
+ type="submit"
29
+ variant="primary"
30
+ >
31
+ {{ t('bt.communities.save') }}
32
+ </BButton>
33
+ </BForm>
10
34
  </template>
11
35
 
12
- <script>
13
- import VueFormGenerator from 'vue-form-generator'
14
- import CommunityFormSchema from '../forms/CommunityFormSchema'
36
+ <script setup>
37
+ import { reactive } from 'vue'
38
+ import { useI18n } from 'vue-i18n'
39
+ import { BForm, BFormGroup, BFormInput, BFormTextarea, BButton } from 'bootstrap-vue-next'
15
40
 
16
- export default {
17
- name: 'CommunityForm',
18
- components: {
19
- 'vue-form-generator': VueFormGenerator.component,
20
- },
21
- props: {
22
- model: {
23
- type: Object,
24
- required: true,
25
- },
26
- },
27
- data() {
28
- return {
29
- schema: CommunityFormSchema,
30
- name: '',
31
- description: '',
32
- }
33
- },
34
- computed: {
35
- localModel: {
36
- get() { return this.model },
37
- set(model) { this.$emit('input', model) },
38
- },
39
- },
40
- }
41
- </script>
41
+ const { t } = useI18n()
42
+
43
+ const props = defineProps({
44
+ model: { type: Object, default: () => ({}) },
45
+ })
46
+ const emit = defineEmits(['submit'])
42
47
 
43
- <style scoped lang="scss">
48
+ const form = reactive({ name: props.model.name || '', description: props.model.description || '' })
44
49
 
45
- </style>
50
+ function handleSubmit() {
51
+ emit('submit', { ...form })
52
+ }
53
+ </script>
@@ -0,0 +1,113 @@
1
+ <template>
2
+ <BCard class="bt-community-card">
3
+ <template #header>
4
+ <slot name="header">
5
+ <div
6
+ class="bt-community-card__cover"
7
+ :style="coverStyle"
8
+ >
9
+ <slot name="sync-badge">
10
+ <SyncBadge :item="community" />
11
+ </slot>
12
+ </div>
13
+ </slot>
14
+ </template>
15
+
16
+ <BCardBody>
17
+ <slot name="title">
18
+ <h5 class="bt-community-card__name">
19
+ {{ community.name }}
20
+ </h5>
21
+ </slot>
22
+
23
+ <slot name="meta">
24
+ <div class="bt-community-card__meta">
25
+ <BBadge
26
+ :variant="privacyVariant"
27
+ class="me-1"
28
+ >
29
+ {{ community.privacy }}
30
+ </BBadge>
31
+ </div>
32
+ </slot>
33
+
34
+ <slot name="body">
35
+ <BCardText class="bt-community-card__description">
36
+ {{ truncatedDescription }}
37
+ </BCardText>
38
+ </slot>
39
+ </BCardBody>
40
+
41
+ <template #footer>
42
+ <slot name="footer">
43
+ <div class="bt-community-card__actions">
44
+ <BButton
45
+ variant="outline-primary"
46
+ size="sm"
47
+ @click="$emit('view', community)"
48
+ >
49
+ {{ t('bt.communities.view') }}
50
+ </BButton>
51
+ <ExtensionSlot
52
+ slot="footer"
53
+ target="CommunityCard"
54
+ :context="{ item: community }"
55
+ />
56
+ </div>
57
+ </slot>
58
+ </template>
59
+ </BCard>
60
+ </template>
61
+
62
+ <script setup>
63
+ import { computed } from 'vue'
64
+ import { useI18n } from 'vue-i18n'
65
+ import { BCard, BCardBody, BCardText, BBadge, BButton } from 'bootstrap-vue-next'
66
+ import SyncBadge from '../sync/SyncBadge.vue'
67
+ import ExtensionSlot from '../shared/ExtensionSlot.vue'
68
+
69
+ const { t } = useI18n()
70
+
71
+ const props = defineProps({
72
+ community: { type: Object, required: true },
73
+ })
74
+ defineEmits(['view'])
75
+
76
+ const coverStyle = computed(() => {
77
+ if (props.community.cover_image_url) {
78
+ return {
79
+ backgroundImage: `url(${props.community.cover_image_url})`,
80
+ backgroundSize: 'cover',
81
+ backgroundPosition: 'center',
82
+ }
83
+ }
84
+ return { backgroundColor: 'var(--bt-primary, #4f46e5)' }
85
+ })
86
+
87
+ const privacyVariant = computed(() => ({
88
+ public: 'success', private: 'danger', protected: 'warning',
89
+ }[props.community.privacy] ?? 'secondary'))
90
+
91
+ const truncatedDescription = computed(() => {
92
+ const desc = props.community.description || ''
93
+ return desc.length > 120 ? desc.slice(0, 120) + '…' : desc
94
+ })
95
+ </script>
96
+
97
+ <style scoped lang="scss">
98
+ .bt-community-card__cover {
99
+ height: 120px;
100
+ position: relative;
101
+ border-radius: 4px 4px 0 0;
102
+
103
+ .sync-badge {
104
+ position: absolute;
105
+ top: 8px;
106
+ right: 8px;
107
+ }
108
+ }
109
+ .bt-community-card__name { font-weight: 600; margin-bottom: 0.25rem; }
110
+ .bt-community-card__meta { margin-bottom: 0.5rem; }
111
+ .bt-community-card__description { font-size: 0.875rem; color: #6b7280; }
112
+ .bt-community-card__actions { display: flex; gap: 0.5rem; align-items: center; }
113
+ </style>
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <div
3
+ class="bt-community-header"
4
+ :style="coverStyle"
5
+ >
6
+ <div class="bt-community-header__overlay">
7
+ <div class="bt-community-header__content">
8
+ <slot name="logo">
9
+ <img
10
+ v-if="community.logo_url"
11
+ :src="community.logo_url"
12
+ class="bt-community-header__logo"
13
+ :alt="community.name"
14
+ >
15
+ </slot>
16
+ <slot name="title">
17
+ <h1 class="bt-community-header__name">
18
+ {{ community.name }}
19
+ </h1>
20
+ </slot>
21
+ <slot name="description">
22
+ <p
23
+ v-if="community.description"
24
+ class="bt-community-header__description"
25
+ >
26
+ {{ community.description }}
27
+ </p>
28
+ </slot>
29
+ <slot name="actions" />
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </template>
34
+
35
+ <script setup>
36
+ import { computed } from 'vue'
37
+
38
+ const props = defineProps({
39
+ community: { type: Object, required: true },
40
+ })
41
+
42
+ const coverStyle = computed(() => {
43
+ if (props.community.cover_image_url) {
44
+ return {
45
+ backgroundImage: `url(${props.community.cover_image_url})`,
46
+ backgroundSize: 'cover',
47
+ backgroundPosition: `center ${props.community.cover_image_position_y || 'center'}`,
48
+ }
49
+ }
50
+ return { backgroundColor: 'var(--bt-primary, #4f46e5)' }
51
+ })
52
+ </script>
53
+
54
+ <style scoped lang="scss">
55
+ .bt-community-header {
56
+ min-height: 200px;
57
+ position: relative;
58
+
59
+ &__overlay {
60
+ position: absolute;
61
+ inset: 0;
62
+ background: linear-gradient(to bottom, transparent 30%, rgba(0,0,0,0.6));
63
+ display: flex;
64
+ align-items: flex-end;
65
+ }
66
+
67
+ &__content {
68
+ padding: 1.5rem;
69
+ color: white;
70
+ }
71
+
72
+ &__logo {
73
+ width: 64px;
74
+ height: 64px;
75
+ border-radius: 8px;
76
+ object-fit: cover;
77
+ margin-bottom: 0.5rem;
78
+ }
79
+
80
+ &__name {
81
+ font-size: 2rem;
82
+ font-weight: 700;
83
+ margin-bottom: 0.25rem;
84
+ }
85
+
86
+ &__description {
87
+ opacity: 0.9;
88
+ margin-bottom: 0;
89
+ }
90
+ }
91
+ </style>
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <div class="bt-community-list">
3
+ <slot name="header" />
4
+ <div
5
+ v-if="loading"
6
+ class="bt-community-list__loading"
7
+ >
8
+ <slot name="loading">
9
+ <BSpinner :label="t('bt.communities.loading')" />
10
+ </slot>
11
+ </div>
12
+ <div
13
+ v-else-if="!communities.length"
14
+ class="bt-community-list__empty"
15
+ >
16
+ <slot name="empty">
17
+ <p class="text-muted">
18
+ {{ t('bt.communities.list_empty') }}
19
+ </p>
20
+ </slot>
21
+ </div>
22
+ <BRow v-else>
23
+ <BCol
24
+ v-for="(community, index) in communities"
25
+ :key="community.id"
26
+ cols="12"
27
+ md="6"
28
+ lg="4"
29
+ class="mb-4"
30
+ >
31
+ <slot
32
+ name="item"
33
+ :item="community"
34
+ :index="index"
35
+ >
36
+ <CommunityCard
37
+ :community="community"
38
+ @view="$emit('view', community)"
39
+ />
40
+ </slot>
41
+ </BCol>
42
+ </BRow>
43
+ <slot name="footer" />
44
+ </div>
45
+ </template>
46
+
47
+ <script setup>
48
+ import { useI18n } from 'vue-i18n'
49
+ import { BRow, BCol, BSpinner } from 'bootstrap-vue-next'
50
+ import CommunityCard from './CommunityCard.vue'
51
+
52
+ const { t } = useI18n()
53
+
54
+ defineProps({
55
+ communities: { type: Array, default: () => [] },
56
+ loading: { type: Boolean, default: false },
57
+ })
58
+ defineEmits(['view'])
59
+ </script>
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <tr class="bt-member-role-row">
3
+ <td class="align-middle">
4
+ <div class="d-flex align-items-center gap-2">
5
+ <PersonAvatar :person="member" :size="32" />
6
+ <span>{{ member.name || member.handle || t('bt.person.unknown') }}</span>
7
+ </div>
8
+ </td>
9
+ <td class="align-middle">
10
+ <span v-if="memberRoles.length" class="d-flex flex-wrap gap-1">
11
+ <RoleBadge
12
+ v-for="role in memberRoles"
13
+ :key="role.id"
14
+ :role="role"
15
+ />
16
+ </span>
17
+ <span v-else class="text-muted small">{{ t('bt.roles.no_roles') }}</span>
18
+ </td>
19
+ <td class="align-middle" style="min-width: 180px">
20
+ <RoleSelector
21
+ v-model="selectedRoleId"
22
+ :resource-type="resourceType"
23
+ :resource-id="resourceId"
24
+ />
25
+ </td>
26
+ <td class="align-middle">
27
+ <div class="d-flex gap-1">
28
+ <BButton
29
+ variant="outline-primary"
30
+ size="sm"
31
+ :disabled="!selectedRoleId || grantPending"
32
+ @click="handleGrant"
33
+ >
34
+ {{ t('bt.roles.assign') }}
35
+ </BButton>
36
+ <BButton
37
+ v-for="pr in memberAssignments"
38
+ :key="pr.id"
39
+ variant="outline-danger"
40
+ size="sm"
41
+ :disabled="revokePending"
42
+ @click="handleRevoke(pr.id)"
43
+ >
44
+ {{ t('bt.roles.revoke') }}
45
+ </BButton>
46
+ </div>
47
+ </td>
48
+ </tr>
49
+ </template>
50
+
51
+ <script setup>
52
+ import { ref, computed } from 'vue'
53
+ import { useI18n } from 'vue-i18n'
54
+ import { BButton } from 'bootstrap-vue-next'
55
+ import { useRoles } from '../../composables/useRoles'
56
+ import PersonAvatar from '../person/PersonAvatar.vue'
57
+ import RoleBadge from '../role/RoleBadge.vue'
58
+ import RoleSelector from '../role/RoleSelector.vue'
59
+
60
+ const { t } = useI18n()
61
+
62
+ const props = defineProps({
63
+ member: { type: Object, required: true },
64
+ resourceType: { type: String, default: null },
65
+ resourceId: { type: String, default: null },
66
+ })
67
+
68
+ const { roles, personRoles, grantRole, revokeRole } = useRoles(props.resourceType, props.resourceId)
69
+
70
+ const selectedRoleId = ref(null)
71
+ const grantPending = ref(false)
72
+ const revokePending = ref(false)
73
+
74
+ const memberAssignments = computed(() =>
75
+ personRoles.value.filter(
76
+ (pr) =>
77
+ pr.person_id === props.member.person_id &&
78
+ pr.resource_type === props.resourceType &&
79
+ pr.resource_id === props.resourceId,
80
+ ),
81
+ )
82
+
83
+ const memberRoles = computed(() => {
84
+ const ids = new Set(memberAssignments.value.map((pr) => pr.role_id))
85
+ return roles.value.filter((r) => ids.has(r.id))
86
+ })
87
+
88
+ async function handleGrant() {
89
+ if (!selectedRoleId.value) return
90
+ grantPending.value = true
91
+ try {
92
+ await grantRole(props.member.person_id, selectedRoleId.value)
93
+ selectedRoleId.value = null
94
+ } finally {
95
+ grantPending.value = false
96
+ }
97
+ }
98
+
99
+ async function handleRevoke(personRoleId) {
100
+ revokePending.value = true
101
+ try {
102
+ await revokeRole(personRoleId)
103
+ } finally {
104
+ revokePending.value = false
105
+ }
106
+ }
107
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <BCard class="bt-conversation-card">
3
+ <BCardBody>
4
+ <slot name="title">
5
+ <div class="d-flex align-items-start justify-content-between gap-2 mb-1">
6
+ <h5 class="bt-conversation-card__subject mb-0">
7
+ {{ conversation.subject || t('bt.conversations.no_subject') }}
8
+ </h5>
9
+ <slot name="sync-badge">
10
+ <SyncBadge :item="conversation" />
11
+ </slot>
12
+ </div>
13
+ </slot>
14
+ <slot name="meta">
15
+ <small class="text-muted">{{ t('bt.conversations.participants', memberCount) }}</small>
16
+ </slot>
17
+ <slot name="body" />
18
+ </BCardBody>
19
+ <template #footer>
20
+ <slot name="footer">
21
+ <div class="bt-conversation-card__actions d-flex align-items-center gap-2">
22
+ <BButton
23
+ variant="outline-primary"
24
+ size="sm"
25
+ @click="$emit('view', conversation)"
26
+ >
27
+ {{ t('bt.conversations.open') }}
28
+ </BButton>
29
+ <ExtensionSlot
30
+ slot="footer"
31
+ target="ConversationCard"
32
+ :context="{ item: conversation }"
33
+ />
34
+ </div>
35
+ </slot>
36
+ </template>
37
+ </BCard>
38
+ </template>
39
+ <script setup>
40
+ import { computed } from 'vue'
41
+ import { useI18n } from 'vue-i18n'
42
+ import { BCard, BCardBody, BButton } from 'bootstrap-vue-next'
43
+ import SyncBadge from '../sync/SyncBadge.vue'
44
+ import ExtensionSlot from '../shared/ExtensionSlot.vue'
45
+ const { t } = useI18n()
46
+ const props = defineProps({ conversation: { type: Object, required: true } })
47
+ defineEmits(['view'])
48
+ const memberCount = computed(() => props.conversation.member_count ?? 0)
49
+ </script>
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <div class="bt-conversation-detail">
3
+ <div
4
+ v-if="conversation"
5
+ class="bt-conversation-detail__header mb-3"
6
+ >
7
+ <h4>{{ conversation.subject || t('bt.conversations.no_subject') }}</h4>
8
+ <SyncBadge :item="conversation" />
9
+ </div>
10
+ <slot name="messages">
11
+ <MessageList
12
+ :messages="messages"
13
+ :loading="messagesLoading"
14
+ class="mb-3"
15
+ />
16
+ </slot>
17
+ <slot name="form">
18
+ <MessageForm @submit="handleSend" />
19
+ </slot>
20
+ </div>
21
+ </template>
22
+ <script setup>
23
+ import { computed, watch } from 'vue'
24
+ import { useI18n } from 'vue-i18n'
25
+ import MessageList from './MessageList.vue'
26
+ import MessageForm from './MessageForm.vue'
27
+ import SyncBadge from '../sync/SyncBadge.vue'
28
+ import { useMessages } from '../../composables/useMessages'
29
+ import { useAuthStore } from '../../stores/auth'
30
+
31
+ const { t } = useI18n()
32
+
33
+ const props = defineProps({
34
+ conversation: { type: Object, default: null },
35
+ })
36
+
37
+ const conversationId = computed(() => props.conversation?.id ?? null)
38
+ const { items: messages, loading: messagesLoading, list: listMessages, create: createMessage } = useMessages(conversationId.value)
39
+ const authStore = useAuthStore()
40
+
41
+ watch(conversationId, async (id) => {
42
+ if (id) await listMessages()
43
+ }, { immediate: true })
44
+
45
+ async function handleSend({ content }) {
46
+ if (!content?.trim() || !props.conversation) return
47
+ await createMessage({
48
+ content: content.trim(),
49
+ conversation_id: props.conversation.id,
50
+ author_id: authStore.currentPersonId ?? null,
51
+ })
52
+ }
53
+ </script>
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <div class="bt-conversation-list">
3
+ <slot name="header" />
4
+ <div
5
+ v-if="loading"
6
+ class="bt-conversation-list__loading"
7
+ >
8
+ <slot name="loading">
9
+ <div class="text-center p-4 text-muted">
10
+ {{ t('bt.conversations.loading') }}
11
+ </div>
12
+ </slot>
13
+ </div>
14
+ <div
15
+ v-else-if="!conversations.length"
16
+ class="bt-conversation-list__empty"
17
+ >
18
+ <slot name="empty">
19
+ <div class="text-center p-4 text-muted">
20
+ {{ t('bt.conversations.list_empty') }}
21
+ </div>
22
+ </slot>
23
+ </div>
24
+ <template v-else>
25
+ <slot
26
+ v-for="(conversation, index) in conversations"
27
+ :key="conversation.id"
28
+ name="item"
29
+ :item="conversation"
30
+ :index="index"
31
+ >
32
+ <ConversationCard
33
+ :conversation="conversation"
34
+ class="mb-3"
35
+ @view="$emit('view', conversation)"
36
+ />
37
+ </slot>
38
+ </template>
39
+ <slot name="footer" />
40
+ </div>
41
+ </template>
42
+ <script setup>
43
+ import { useI18n } from 'vue-i18n'
44
+ import ConversationCard from './ConversationCard.vue'
45
+ const { t } = useI18n()
46
+ defineProps({
47
+ conversations: { type: Array, default: () => [] },
48
+ loading: { type: Boolean, default: false },
49
+ })
50
+ defineEmits(['view'])
51
+ </script>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <BForm
3
+ class="bt-message-form"
4
+ @submit.prevent="handleSubmit"
5
+ >
6
+ <BFormGroup>
7
+ <BFormTextarea
8
+ v-model="content"
9
+ :placeholder="t('bt.messages.placeholder')"
10
+ rows="2"
11
+ :disabled="submitting"
12
+ @keydown.enter.ctrl.prevent="handleSubmit"
13
+ />
14
+ </BFormGroup>
15
+ <div class="d-flex justify-content-end gap-2 mt-2">
16
+ <BButton
17
+ type="submit"
18
+ variant="primary"
19
+ size="sm"
20
+ :disabled="!content.trim() || submitting"
21
+ >
22
+ {{ t('bt.messages.send') }}
23
+ </BButton>
24
+ </div>
25
+ </BForm>
26
+ </template>
27
+ <script setup>
28
+ import { ref } from 'vue'
29
+ import { useI18n } from 'vue-i18n'
30
+ import { BForm, BFormGroup, BFormTextarea, BButton } from 'bootstrap-vue-next'
31
+ const { t } = useI18n()
32
+ const emit = defineEmits(['submit'])
33
+ const content = ref('')
34
+ const submitting = ref(false)
35
+ async function handleSubmit() {
36
+ if (!content.value.trim()) return
37
+ submitting.value = true
38
+ try {
39
+ await emit('submit', { content: content.value })
40
+ content.value = ''
41
+ } finally {
42
+ submitting.value = false
43
+ }
44
+ }
45
+ </script>