@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
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div class="bt-page-community-conversation">
3
+ <div
4
+ v-if="loading"
5
+ class="text-center p-4 text-muted"
6
+ >
7
+ {{ t('bt.pages.loading') }}
8
+ </div>
9
+ <div
10
+ v-else-if="!current"
11
+ class="text-center p-4 text-muted"
12
+ >
13
+ {{ t('bt.conversations.not_found') }}
14
+ </div>
15
+ <ConversationDetail
16
+ v-else
17
+ :conversation="current"
18
+ />
19
+ </div>
20
+ </template>
21
+ <script setup>
22
+ import { onMounted } from 'vue'
23
+ import { useI18n } from 'vue-i18n'
24
+ import { useRoute } from 'vue-router'
25
+ import ConversationDetail from '../../components/conversation/ConversationDetail.vue'
26
+ import { useConversations } from '../../composables/useConversations'
27
+ const { t } = useI18n()
28
+ const route = useRoute()
29
+ const { current, loading, get } = useConversations()
30
+ onMounted(() => get(route.params.id))
31
+ </script>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <div class="bt-community-conversations">
3
+ <h2>{{ t('bt.navigation.conversations') }}</h2>
4
+ <BAlert
5
+ variant="info"
6
+ :model-value="true"
7
+ >
8
+ {{ t('bt.conversations.coming_soon') }}
9
+ </BAlert>
10
+ </div>
11
+ </template>
12
+
13
+ <script setup>
14
+ import { useI18n } from 'vue-i18n'
15
+ import { BAlert } from 'bootstrap-vue-next'
16
+
17
+ const { t } = useI18n()
18
+ </script>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <div class="bt-community-event">
3
+ <RouterLink
4
+ :to="{ name: 'CommunityEvents', params: { communitySlug: route.params.communitySlug } }"
5
+ class="btn btn-link ps-0"
6
+ >
7
+ {{ t('bt.actions.back') }}
8
+ </RouterLink>
9
+ <div v-if="loading">
10
+ <BSpinner :label="t('bt.events.loading')" />
11
+ </div>
12
+ <EventCard
13
+ v-else-if="current"
14
+ :event="current"
15
+ />
16
+ <BAlert
17
+ v-else
18
+ variant="warning"
19
+ :model-value="true"
20
+ >
21
+ {{ t('bt.events.not_found') }}
22
+ </BAlert>
23
+ </div>
24
+ </template>
25
+
26
+ <script setup>
27
+ import { onMounted } from 'vue'
28
+ import { useI18n } from 'vue-i18n'
29
+ import { useRoute } from 'vue-router'
30
+ import { BSpinner, BAlert } from 'bootstrap-vue-next'
31
+ import { useEvents } from '../../composables/useEvents'
32
+ import EventCard from '../../components/event/EventCard.vue'
33
+
34
+ const { t } = useI18n()
35
+
36
+ const route = useRoute()
37
+ const { current, loading, get } = useEvents(route.params.communitySlug)
38
+ onMounted(() => get(route.params.id))
39
+ </script>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <div class="bt-community-events">
3
+ <div class="d-flex align-items-center justify-content-between mb-3">
4
+ <h2>{{ t('bt.navigation.events') }}</h2>
5
+ <BButton
6
+ v-if="authStore.isAuthenticated"
7
+ variant="primary"
8
+ @click="showForm = true"
9
+ >
10
+ {{ t('bt.events.create') }}
11
+ </BButton>
12
+ </div>
13
+ <BModal
14
+ v-model="showForm"
15
+ :title="t('bt.events.create')"
16
+ hide-footer
17
+ >
18
+ <EventForm
19
+ :community-id="communitySlug"
20
+ @submit="createEvent"
21
+ />
22
+ </BModal>
23
+ <EventList
24
+ :events="items"
25
+ :loading="loading"
26
+ @view="goToEvent"
27
+ />
28
+ </div>
29
+ </template>
30
+
31
+ <script setup>
32
+ import { ref, onMounted } from 'vue'
33
+ import { useI18n } from 'vue-i18n'
34
+ import { useRoute, useRouter } from 'vue-router'
35
+ import { BButton, BModal } from 'bootstrap-vue-next'
36
+ import { useAuthStore } from '../../stores/auth'
37
+ import { useEvents } from '../../composables/useEvents'
38
+ import EventList from '../../components/event/EventList.vue'
39
+ import EventForm from '../../components/event/EventForm.vue'
40
+
41
+ const { t } = useI18n()
42
+
43
+ const route = useRoute()
44
+ const router = useRouter()
45
+ const authStore = useAuthStore()
46
+ const communitySlug = route.params.communitySlug
47
+ const { items, loading, listUpcoming, create } = useEvents(communitySlug)
48
+ const showForm = ref(false)
49
+
50
+ onMounted(() => listUpcoming())
51
+ async function createEvent(formData) {
52
+ await create(formData)
53
+ showForm.value = false
54
+ }
55
+ function goToEvent(event) {
56
+ router.push({ name: 'CommunityEvent', params: { ...route.params, id: event.id } })
57
+ }
58
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div class="bt-community-home">
3
+ <BRow>
4
+ <BCol md="8">
5
+ <h2>{{ t('bt.posts.recent') }}</h2>
6
+ <PostList
7
+ :posts="recentPosts"
8
+ :loading="postsLoading"
9
+ @view="goToPost"
10
+ />
11
+ </BCol>
12
+ <BCol md="4">
13
+ <h2>{{ t('bt.events.upcoming') }}</h2>
14
+ <EventList
15
+ :events="upcomingEvents"
16
+ :loading="eventsLoading"
17
+ @view="goToEvent"
18
+ />
19
+ </BCol>
20
+ </BRow>
21
+ </div>
22
+ </template>
23
+
24
+ <script setup>
25
+ import { onMounted } from 'vue'
26
+ import { useI18n } from 'vue-i18n'
27
+ import { useRoute, useRouter } from 'vue-router'
28
+ import { BRow, BCol } from 'bootstrap-vue-next'
29
+ import { usePosts } from '../../composables/usePosts'
30
+ import { useEvents } from '../../composables/useEvents'
31
+ import PostList from '../../components/post/PostList.vue'
32
+ import EventList from '../../components/event/EventList.vue'
33
+
34
+ const { t } = useI18n()
35
+
36
+ const route = useRoute()
37
+ const router = useRouter()
38
+ const communityId = route.params.communitySlug
39
+
40
+ const { items: recentPosts, loading: postsLoading, listPublished } = usePosts(communityId)
41
+ const { items: upcomingEvents, loading: eventsLoading, listUpcoming } = useEvents(communityId)
42
+
43
+ onMounted(async () => {
44
+ await Promise.all([listPublished(), listUpcoming()])
45
+ })
46
+
47
+ function goToPost(post) { router.push({ name: 'CommunityPost', params: { ...route.params, id: post.id } }) }
48
+ function goToEvent(event) { router.push({ name: 'CommunityEvent', params: { ...route.params, id: event.id } }) }
49
+ </script>
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <div class="bt-page-community-joatu">
3
+ <div class="d-flex align-items-center justify-content-between mb-4">
4
+ <h2>{{ t('bt.joatu.heading') }}</h2>
5
+ <p class="text-muted mb-0">
6
+ {{ t('bt.joatu.tagline') }}
7
+ </p>
8
+ </div>
9
+
10
+ <BTabs>
11
+ <BTab :title="t('bt.joatu.tabs.offers')">
12
+ <div class="pt-3">
13
+ <div class="d-flex justify-content-end mb-3">
14
+ <BButton
15
+ variant="success"
16
+ size="sm"
17
+ @click="showOfferForm = !showOfferForm"
18
+ >
19
+ {{ showOfferForm ? t('bt.actions.cancel') : t('bt.joatu.offers.add') }}
20
+ </BButton>
21
+ </div>
22
+ <OfferForm
23
+ v-if="showOfferForm"
24
+ class="mb-4"
25
+ @submit="handleCreateOffer"
26
+ @cancel="showOfferForm = false"
27
+ />
28
+ <OfferList
29
+ :offers="offers"
30
+ :loading="offersLoading"
31
+ @view="viewOffer"
32
+ />
33
+ </div>
34
+ </BTab>
35
+ <BTab :title="t('bt.joatu.tabs.requests')">
36
+ <div class="pt-3">
37
+ <div class="d-flex justify-content-end mb-3">
38
+ <BButton
39
+ variant="warning"
40
+ size="sm"
41
+ @click="showRequestForm = !showRequestForm"
42
+ >
43
+ {{ showRequestForm ? t('bt.actions.cancel') : t('bt.joatu.requests.add') }}
44
+ </BButton>
45
+ </div>
46
+ <RequestForm
47
+ v-if="showRequestForm"
48
+ class="mb-4"
49
+ @submit="handleCreateRequest"
50
+ @cancel="showRequestForm = false"
51
+ />
52
+ <RequestList
53
+ :requests="requests"
54
+ :loading="requestsLoading"
55
+ @view="viewRequest"
56
+ />
57
+ </div>
58
+ </BTab>
59
+ <BTab :title="t('bt.joatu.tabs.agreements')">
60
+ <div class="pt-3">
61
+ <AgreementList
62
+ :agreements="agreements"
63
+ :loading="agreementsLoading"
64
+ @view="viewAgreement"
65
+ />
66
+ </div>
67
+ </BTab>
68
+ </BTabs>
69
+ </div>
70
+ </template>
71
+ <script setup>
72
+ import { ref, onMounted } from 'vue'
73
+ import { useI18n } from 'vue-i18n'
74
+ import { useRoute, useRouter } from 'vue-router'
75
+ import { BTabs, BTab, BButton } from 'bootstrap-vue-next'
76
+ import OfferList from '../../components/joatu/OfferList.vue'
77
+ import OfferForm from '../../components/joatu/OfferForm.vue'
78
+ import RequestList from '../../components/joatu/RequestList.vue'
79
+ import RequestForm from '../../components/joatu/RequestForm.vue'
80
+ import AgreementList from '../../components/joatu/AgreementList.vue'
81
+ import { useJoaTuOffers } from '../../composables/useJoaTuOffers'
82
+ import { useJoaTuRequests } from '../../composables/useJoaTuRequests'
83
+ import { useJoaTuAgreements } from '../../composables/useJoaTuAgreements'
84
+
85
+ const { t } = useI18n()
86
+
87
+ const route = useRoute()
88
+ const router = useRouter()
89
+ const communitySlug = route.params.communitySlug
90
+
91
+ const { items: offers, loading: offersLoading, list: listOffers, create: createOffer } = useJoaTuOffers(communitySlug)
92
+ const { items: requests, loading: requestsLoading, list: listRequests, create: createRequest } = useJoaTuRequests(communitySlug)
93
+ const { items: agreements, loading: agreementsLoading, list: listAgreements } = useJoaTuAgreements(communitySlug)
94
+
95
+ const showOfferForm = ref(false)
96
+ const showRequestForm = ref(false)
97
+
98
+ onMounted(async () => {
99
+ await Promise.all([listOffers(), listRequests(), listAgreements()])
100
+ })
101
+
102
+ async function handleCreateOffer(formData) {
103
+ await createOffer(formData)
104
+ showOfferForm.value = false
105
+ }
106
+
107
+ async function handleCreateRequest(formData) {
108
+ await createRequest(formData)
109
+ showRequestForm.value = false
110
+ }
111
+
112
+ function viewOffer(offer) { router.push({ name: 'CommunityOffer', params: { id: offer.id } }) }
113
+ function viewRequest(req) { router.push({ name: 'CommunityRequest', params: { id: req.id } }) }
114
+ function viewAgreement() {}
115
+ </script>
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <div class="bt-community-members">
3
+ <h2>{{ t('bt.navigation.members') }}</h2>
4
+ <MemberList
5
+ :members="items"
6
+ :loading="loading"
7
+ />
8
+ </div>
9
+ </template>
10
+
11
+ <script setup>
12
+ import { onMounted } from 'vue'
13
+ import { useI18n } from 'vue-i18n'
14
+ import { useRoute } from 'vue-router'
15
+ import { useMembers } from '../../composables/useMembers'
16
+ import MemberList from '../../components/person/MemberList.vue'
17
+
18
+ const { t } = useI18n()
19
+
20
+ const route = useRoute()
21
+ const { items, loading, listActive } = useMembers(route.params.communitySlug)
22
+ onMounted(() => listActive())
23
+ </script>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div class="bt-page-community-page">
3
+ <div
4
+ v-if="loading"
5
+ class="text-center p-4 text-muted"
6
+ >
7
+ {{ t('bt.pages.loading') }}
8
+ </div>
9
+ <div
10
+ v-else-if="!current"
11
+ class="text-center p-4 text-muted"
12
+ >
13
+ {{ t('bt.pages.not_found') }}
14
+ </div>
15
+ <PageDetail
16
+ v-else
17
+ :page="current"
18
+ />
19
+ </div>
20
+ </template>
21
+ <script setup>
22
+ import { onMounted } from 'vue'
23
+ import { useI18n } from 'vue-i18n'
24
+ import { useRoute } from 'vue-router'
25
+ import PageDetail from '../../components/page/PageDetail.vue'
26
+ import { usePages } from '../../composables/usePages'
27
+ const { t } = useI18n()
28
+ const route = useRoute()
29
+ const { current, loading, get } = usePages()
30
+ onMounted(() => get(route.params.id))
31
+ </script>
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <div class="bt-page-community-pages">
3
+ <h2 class="mb-4">
4
+ {{ t('bt.pages.heading') }}
5
+ </h2>
6
+ <PageList
7
+ :pages="items"
8
+ :loading="loading"
9
+ @view="viewPage"
10
+ />
11
+ </div>
12
+ </template>
13
+ <script setup>
14
+ import { onMounted } from 'vue'
15
+ import { useI18n } from 'vue-i18n'
16
+ import { useRoute, useRouter } from 'vue-router'
17
+ import PageList from '../../components/page/PageList.vue'
18
+ import { usePages } from '../../composables/usePages'
19
+ const { t } = useI18n()
20
+ const route = useRoute()
21
+ const router = useRouter()
22
+ const { items, loading, list } = usePages(route.params.communitySlug)
23
+ onMounted(() => list())
24
+ function viewPage(page) { router.push({ name: 'CommunityPage', params: { id: page.id } }) }
25
+ </script>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div class="bt-community-post">
3
+ <RouterLink
4
+ :to="{ name: 'CommunityPosts', params: { communitySlug: route.params.communitySlug } }"
5
+ class="btn btn-link ps-0"
6
+ >
7
+ {{ t('bt.actions.back') }}
8
+ </RouterLink>
9
+ <PostDetail
10
+ :post="current"
11
+ :loading="loading"
12
+ />
13
+ </div>
14
+ </template>
15
+
16
+ <script setup>
17
+ import { onMounted } from 'vue'
18
+ import { useI18n } from 'vue-i18n'
19
+ import { useRoute } from 'vue-router'
20
+ import { usePosts } from '../../composables/usePosts'
21
+ import PostDetail from '../../components/post/PostDetail.vue'
22
+
23
+ const { t } = useI18n()
24
+
25
+ const route = useRoute()
26
+ const { current, loading, get } = usePosts(route.params.communitySlug)
27
+ onMounted(() => get(route.params.id))
28
+ </script>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <div class="bt-community-posts">
3
+ <div class="d-flex align-items-center justify-content-between mb-3">
4
+ <h2>{{ t('bt.navigation.posts') }}</h2>
5
+ <BButton
6
+ v-if="authStore.isAuthenticated"
7
+ variant="primary"
8
+ @click="showForm = true"
9
+ >
10
+ {{ t('bt.posts.create') }}
11
+ </BButton>
12
+ </div>
13
+ <BModal
14
+ v-model="showForm"
15
+ :title="t('bt.posts.create')"
16
+ hide-footer
17
+ >
18
+ <PostForm
19
+ :community-id="communitySlug"
20
+ @submit="createPost"
21
+ />
22
+ </BModal>
23
+ <PostList
24
+ :posts="items"
25
+ :loading="loading"
26
+ @view="goToPost"
27
+ />
28
+ </div>
29
+ </template>
30
+
31
+ <script setup>
32
+ import { ref, onMounted } from 'vue'
33
+ import { useI18n } from 'vue-i18n'
34
+ import { useRoute, useRouter } from 'vue-router'
35
+ import { BButton, BModal } from 'bootstrap-vue-next'
36
+ import { useAuthStore } from '../../stores/auth'
37
+ import { usePosts } from '../../composables/usePosts'
38
+ import PostList from '../../components/post/PostList.vue'
39
+ import PostForm from '../../components/post/PostForm.vue'
40
+
41
+ const { t } = useI18n()
42
+
43
+ const route = useRoute()
44
+ const router = useRouter()
45
+ const authStore = useAuthStore()
46
+ const communitySlug = route.params.communitySlug
47
+ const { items, loading, listPublished, create } = usePosts(communitySlug)
48
+ const showForm = ref(false)
49
+
50
+ onMounted(() => listPublished())
51
+ async function createPost(formData) {
52
+ await create(formData)
53
+ showForm.value = false
54
+ }
55
+ function goToPost(post) {
56
+ router.push({ name: 'CommunityPost', params: { ...route.params, id: post.id } })
57
+ }
58
+ </script>
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <div class="bt-community-settings-page">
3
+ <RoleGate
4
+ role="admin"
5
+ :resource-type="'community'"
6
+ :resource-id="communitySlug"
7
+ >
8
+ <h1 class="h4 mb-4">
9
+ {{ t('bt.community.settings.title') }}
10
+ </h1>
11
+
12
+ <!-- General Settings -->
13
+ <BCard class="mb-4">
14
+ <template #header>
15
+ <h2 class="h6 mb-0">
16
+ {{ t('bt.community.settings.general') }}
17
+ </h2>
18
+ </template>
19
+ <div
20
+ v-if="loadingCommunity"
21
+ class="text-center py-3"
22
+ >
23
+ <BSpinner :label="t('bt.communities.loading')" />
24
+ </div>
25
+ <CommunityForm
26
+ v-else-if="community"
27
+ :model="community"
28
+ @submit="handleSave"
29
+ />
30
+ </BCard>
31
+
32
+ <!-- Members / Role Management -->
33
+ <BCard class="mb-4">
34
+ <template #header>
35
+ <h2 class="h6 mb-0">
36
+ {{ t('bt.community.settings.members') }}
37
+ </h2>
38
+ </template>
39
+ <RouterLink
40
+ :to="{ name: 'community-role-manager', params: { communitySlug } }"
41
+ class="btn btn-outline-secondary btn-sm"
42
+ >
43
+ {{ t('bt.roles.title') }}
44
+ </RouterLink>
45
+ </BCard>
46
+
47
+ <!-- Danger Zone -->
48
+ <BCard border-variant="danger">
49
+ <template #header>
50
+ <h2 class="h6 mb-0 text-danger">
51
+ {{ t('bt.community.settings.danger_zone') }}
52
+ </h2>
53
+ </template>
54
+ <BButton
55
+ variant="outline-danger"
56
+ @click="confirmLeave"
57
+ >
58
+ {{ t('bt.community.settings.leave') }}
59
+ </BButton>
60
+ </BCard>
61
+
62
+ <BModal
63
+ v-model="showLeaveConfirm"
64
+ :title="t('bt.community.settings.leave')"
65
+ ok-variant="danger"
66
+ :ok-title="t('bt.community.settings.leave')"
67
+ @ok="handleLeave"
68
+ >
69
+ {{ t('bt.community.settings.leave_confirm') }}
70
+ </BModal>
71
+
72
+ <template #fallback>
73
+ <BAlert
74
+ variant="warning"
75
+ :model-value="true"
76
+ >
77
+ {{ t('bt.errors.not_found') }}
78
+ </BAlert>
79
+ </template>
80
+ </RoleGate>
81
+ </div>
82
+ </template>
83
+
84
+ <script setup>
85
+ import { ref, onMounted } from 'vue'
86
+ import { useI18n } from 'vue-i18n'
87
+ import { useRoute, useRouter } from 'vue-router'
88
+ import { BCard, BButton, BSpinner, BAlert, BModal } from 'bootstrap-vue-next'
89
+ import { useCommunities } from '../../composables/useCommunities'
90
+ import RoleGate from '../../components/role/RoleGate.vue'
91
+ import CommunityForm from '../../components/CommunityForm.vue'
92
+
93
+ const { t } = useI18n()
94
+ const route = useRoute()
95
+ const router = useRouter()
96
+ const communitySlug = route.params.communitySlug
97
+
98
+ const { current: community, loading: loadingCommunity, findBySlug, update } = useCommunities()
99
+
100
+ const showLeaveConfirm = ref(false)
101
+
102
+ onMounted(() => findBySlug(communitySlug))
103
+
104
+ async function handleSave(formData) {
105
+ if (!community.value) return
106
+ await update(community.value.id, formData)
107
+ }
108
+
109
+ function confirmLeave() {
110
+ showLeaveConfirm.value = true
111
+ }
112
+
113
+ function handleLeave() {
114
+ showLeaveConfirm.value = false
115
+ router.push({ name: 'Communities' })
116
+ }
117
+ </script>