@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,54 +1,41 @@
1
1
  <template>
2
- <b-navbar-nav
2
+ <BNavbarNav
3
3
  :class="navbarClass"
4
4
  pills
5
5
  align="center"
6
6
  >
7
7
  <BtNavItem
8
- v-for="menuItem in headerMenuItems"
9
- :id="menuItem.id"
10
- :key="menuItem.id"
11
- :external="menuItem.external"
12
- :label="menuItem.label"
13
- :target="menuItem.target"
14
- :title="menuItem.title"
15
- :path="menuItem.path"
16
- :url="menuItem.url"
8
+ v-for="item in menuStore.headerMenuItems"
9
+ :id="item.id"
10
+ :key="item.id"
11
+ :external="item.external"
12
+ :label="item.label"
13
+ :target="item.target"
14
+ :title="item.title"
15
+ :path="item.path"
16
+ :url="item.url"
17
17
  :navitem-class="navitemClass"
18
18
  />
19
- <BtNavUser v-if="isAuthenticated" />
20
- </b-navbar-nav>
19
+ <BtNavUser v-if="authStore.isAuthenticated" />
20
+ </BNavbarNav>
21
21
  </template>
22
22
 
23
- <script>
24
- import { mapGetters } from 'vuex'
25
-
23
+ <script setup>
24
+ import { BNavbarNav } from 'bootstrap-vue-next'
25
+ import { useAuthStore } from '../stores/auth'
26
+ import { useMenuStore } from '../stores/menus'
26
27
  import BtNavItem from './BtNavItem.vue'
28
+ import BtNavUser from './BtNavUser.vue'
29
+
30
+ defineProps({
31
+ navbarClass: { type: String, default: '' },
32
+ navitemClass: { type: String, default: '' },
33
+ })
27
34
 
28
- export default {
29
- name: 'NavBar',
30
- components: {
31
- BtNavItem,
32
- },
33
- props: {
34
- navbarClass: {
35
- type: String,
36
- default: '',
37
- },
38
- navitemClass: {
39
- type: String,
40
- default: '',
41
- },
42
- },
43
- computed: {
44
- ...mapGetters('CommunityEngine/Authentication', ['isAuthenticated']),
45
- ...mapGetters('CommunityEngine/Menus', ['headerMenuItems']),
46
- },
47
- }
35
+ const authStore = useAuthStore()
36
+ const menuStore = useMenuStore()
48
37
  </script>
49
38
 
50
39
  <style scoped lang="scss">
51
- .center {
52
- text-align: center;
53
- }
40
+ .center { text-align: center; }
54
41
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <b-nav-item
2
+ <BNavItem
3
3
  :class="navitemClass"
4
4
  :href="localHref"
5
5
  :target="target"
@@ -8,78 +8,45 @@
8
8
  >
9
9
  <nobr>
10
10
  {{ label }}
11
- <font-awesome-icon
11
+ <FontAwesomeIcon
12
12
  v-if="external"
13
13
  icon="external-link-alt"
14
14
  size="xs"
15
15
  title="External Link"
16
16
  />
17
17
  </nobr>
18
- </b-nav-item>
18
+ </BNavItem>
19
19
  </template>
20
20
 
21
- <script>
22
- export default {
23
- name: 'BtNavItem',
24
- props: {
25
- id: {
26
- type: Number,
27
- default: 0,
28
- },
29
- external: {
30
- type: Boolean,
31
- default: false,
32
- },
33
- label: {
34
- type: String,
35
- default: 'Label',
36
- },
37
- navitemClass: {
38
- type: String,
39
- default: '',
40
- },
41
- path: {
42
- type: String,
43
- default: '#',
44
- },
45
- sortOrder: {
46
- type: Number,
47
- default: 0,
48
- },
49
- target: {
50
- type: String,
51
- default: '_self',
52
- },
53
- title: {
54
- type: String,
55
- default: '',
56
- },
57
- url: {
58
- type: String,
59
- default: '#',
60
- },
61
- },
62
- computed: {
63
- localHref() { return this.external ? this.url : undefined },
64
- localTitle() { return this.title !== '' ? this.title : this.label },
65
- localTo() { return !this.external ? this.path : undefined },
66
- },
67
- }
21
+ <script setup>
22
+ import { computed } from 'vue'
23
+ import { BNavItem } from 'bootstrap-vue-next'
24
+
25
+ const props = defineProps({
26
+ id: { type: Number, default: 0 },
27
+ external: { type: Boolean, default: false },
28
+ label: { type: String, default: 'Label' },
29
+ navitemClass: { type: String, default: '' },
30
+ path: { type: String, default: '#' },
31
+ sortOrder: { type: Number, default: 0 },
32
+ target: { type: String, default: '_self' },
33
+ title: { type: String, default: '' },
34
+ url: { type: String, default: '#' },
35
+ })
36
+
37
+ const localHref = computed(() => props.external ? props.url : undefined)
38
+ const localTitle = computed(() => props.title !== '' ? props.title : props.label)
39
+ const localTo = computed(() => !props.external ? props.path : undefined)
68
40
  </script>
69
41
 
70
42
  <style scoped lang="scss">
71
43
  @import '../stylesheets/theme.scss';
72
- .nav-item {
73
- color: red;
74
44
 
75
- ::v-deep > a.nav-link {
45
+ .nav-item {
46
+ :deep(> a.nav-link) {
76
47
  font-weight: bold;
77
48
  color: $default-text-color-bg-dark;
78
-
79
- &.router-link-exact-active,
80
- &:hover {
81
- color: $accent-color;
82
- }
49
+ &.router-link-exact-active, &:hover { color: $accent-color; }
83
50
  }
84
51
  }
85
52
  </style>
@@ -1,108 +1,87 @@
1
1
  <template>
2
- <b-nav-item-dropdown
2
+ <BNavItemDropdown
3
3
  class="user-dropdown"
4
4
  :text="dropdownText"
5
- right
5
+ end
6
6
  >
7
- <b-dropdown-item
8
- v-if="isAuthenticated"
7
+ <BDropdownItem
8
+ v-if="authStore.isAuthenticated"
9
9
  to="/me"
10
10
  >
11
- Me
12
- </b-dropdown-item>
13
- <b-dropdown-item
14
- v-if="isAuthenticated"
15
- @click="signOutAction"
11
+ {{ t('bt.navigation.me') }}
12
+ </BDropdownItem>
13
+ <BDropdownItem
14
+ v-if="authStore.isAuthenticated"
15
+ @click="handleSignOut"
16
16
  >
17
- Sign Out
18
- </b-dropdown-item>
19
- <b-dropdown-item
20
- v-if="!isAuthenticated"
17
+ {{ t('bt.auth.sign_out') }}
18
+ </BDropdownItem>
19
+ <BDropdownItem
20
+ v-if="!authStore.isAuthenticated"
21
21
  to="/users/sign-in"
22
22
  >
23
- Sign In
24
- </b-dropdown-item>
25
- <b-dropdown-item
26
- v-if="!isAuthenticated"
23
+ {{ t('bt.auth.sign_in') }}
24
+ </BDropdownItem>
25
+ <BDropdownItem
26
+ v-if="!authStore.isAuthenticated"
27
27
  to="/users/sign-up"
28
28
  >
29
- Sign Up
30
- </b-dropdown-item>
31
- <b-dropdown-item
32
- to="/"
33
- >
34
- Better Together
35
- </b-dropdown-item>
36
- </b-nav-item-dropdown>
29
+ {{ t('bt.auth.sign_up') }}
30
+ </BDropdownItem>
31
+ <BDropdownItem to="/">
32
+ {{ t('bt.app.name') }}
33
+ </BDropdownItem>
34
+ </BNavItemDropdown>
37
35
  </template>
38
36
 
39
- <script>
40
- import { mapActions, mapGetters, mapState } from 'vuex'
41
- import toaster from '../mixins/toaster'
37
+ <script setup>
38
+ import { computed } from 'vue'
39
+ import { useI18n } from 'vue-i18n'
40
+ import { useRouter } from 'vue-router'
41
+ import { BNavItemDropdown, BDropdownItem } from 'bootstrap-vue-next'
42
+ import { useAuthStore } from '../stores/auth'
43
+ import { usePeopleStore } from '../stores/people'
44
+ import { useToaster } from '../composables/useToaster'
45
+
46
+ const { t } = useI18n()
47
+ const authStore = useAuthStore()
48
+ const peopleStore = usePeopleStore()
49
+ const router = useRouter()
50
+ const { toast } = useToaster()
42
51
 
43
- export default {
44
- name: 'NavUser',
45
- mixins: [toaster],
46
- computed: {
47
- ...mapState('CommunityEngine/Authentication', ['currentUser']),
48
- ...mapGetters('CommunityEngine/Authentication', ['isAuthenticated']),
49
- ...mapState('CommunityEngine/People', ['currentPerson']),
50
- ...mapGetters('CommunityEngine/People', ['hasCurrentPerson']),
51
- dropdownText() {
52
- if (this.isAuthenticated) {
53
- if (this.hasCurrentPerson) return this.currentPerson.name
54
- return this.currentUser.email
55
- }
52
+ const dropdownText = computed(() => {
53
+ if (authStore.isAuthenticated) {
54
+ if (peopleStore.hasCurrentPerson) return peopleStore.currentPerson.name
55
+ return authStore.currentUser.email
56
+ }
57
+ return t('bt.auth.sign_in')
58
+ })
56
59
 
57
- return 'Sign In'
58
- },
59
- },
60
- methods: {
61
- ...mapActions('CommunityEngine/Authentication', ['signOut']),
62
- signOutAction() {
63
- this.signOut().then(() => {
64
- if (this.$route.path !== '/') {
65
- this.$router.push('/').then(() => {
66
- this.$toaster('You are now signed out!', 'info')
67
- })
68
- } else {
69
- this.$toaster('You are now signed out!', 'info')
70
- }
71
- })
72
- },
73
- },
60
+ async function handleSignOut() {
61
+ await authStore.signOut()
62
+ peopleStore.clearCurrentPerson()
63
+ if (router.currentRoute.value.path !== '/') {
64
+ await router.push('/')
65
+ }
66
+ toast('You are now signed out!', 'info')
74
67
  }
75
68
  </script>
76
69
 
77
70
  <style scoped lang="scss">
78
- @import '../stylesheets/theme.scss';
79
-
80
- .user-dropdown {
81
- ::v-deep a.dropdown-item {
82
- font-weight: bold;
83
- color: $default-text-color;
84
- text-align: right;
71
+ @import '../stylesheets/theme.scss';
85
72
 
86
- &.router-link-exact-active,
87
- &:hover {
88
- color: $accent-color;
89
- }
90
- }
91
-
92
- ::v-deep a.dropdown-toggle {
93
- font-weight: bold;
94
- color: $default-text-color-bg-dark;
95
-
96
- &.router-link-exact-active,
97
- &:hover {
98
- color: $accent-color;
99
- }
100
-
101
- > span {
102
- max-width: 75px;
103
- display: inline-block;
104
- overflow: clip;
105
- }
106
- }
73
+ .user-dropdown {
74
+ :deep(a.dropdown-item) {
75
+ font-weight: bold;
76
+ color: $default-text-color;
77
+ text-align: right;
78
+ &.router-link-exact-active, &:hover { color: $accent-color; }
107
79
  }
80
+ :deep(a.dropdown-toggle) {
81
+ font-weight: bold;
82
+ color: $default-text-color-bg-dark;
83
+ &.router-link-exact-active, &:hover { color: $accent-color; }
84
+ > span { max-width: 75px; display: inline-block; overflow: clip; }
85
+ }
86
+ }
108
87
  </style>
@@ -1,45 +1,54 @@
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.person.name_label')"
5
+ label-for="profile-name"
6
+ >
7
+ <BFormInput
8
+ id="profile-name"
9
+ v-model="localModel.name"
10
+ type="text"
11
+ :placeholder="t('bt.person.name_label')"
12
+ />
13
+ </BFormGroup>
14
+ <BFormGroup
15
+ :label="t('bt.person.description_label')"
16
+ label-for="profile-description"
17
+ >
18
+ <BFormTextarea
19
+ id="profile-description"
20
+ v-model="localModel.description"
21
+ rows="3"
22
+ :placeholder="t('bt.person.description_label')"
23
+ />
24
+ </BFormGroup>
25
+ <BButton
26
+ type="submit"
27
+ variant="primary"
28
+ >
29
+ {{ t('bt.actions.save') }}
30
+ </BButton>
31
+ </BForm>
10
32
  </template>
11
33
 
12
- <script>
13
- import VueFormGenerator from 'vue-form-generator'
14
- import BtProfileFormSchema from '../forms/BtProfileFormSchema'
34
+ <script setup>
35
+ import { computed } from 'vue'
36
+ import { useI18n } from 'vue-i18n'
37
+ import { BForm, BFormGroup, BFormInput, BFormTextarea, BButton } from 'bootstrap-vue-next'
15
38
 
16
- export default {
17
- name: 'BtProfileForm',
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: BtProfileFormSchema,
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>
39
+ const { t } = useI18n()
40
+
41
+ const props = defineProps({
42
+ model: { type: Object, required: true },
43
+ })
44
+ const emit = defineEmits(['update:model'])
42
45
 
43
- <style scoped lang="scss">
46
+ const localModel = computed({
47
+ get: () => props.model,
48
+ set: (val) => emit('update:model', val),
49
+ })
44
50
 
45
- </style>
51
+ function handleSubmit() {
52
+ emit('update:model', localModel.value)
53
+ }
54
+ </script>
@@ -1,83 +1,61 @@
1
1
  <template>
2
- <vue-form-generator
3
- id="new-password-form"
4
- tag="div"
5
- :schema="schema"
6
- :model="localModel"
7
- rows="3"
8
- max-rows="6"
9
- @validated="onValidated"
10
- />
2
+ <BForm @submit.prevent="handleSubmit">
3
+ <BFormGroup
4
+ :label="t('bt.auth.new_password')"
5
+ label-for="new-password"
6
+ >
7
+ <BFormInput
8
+ id="new-password"
9
+ v-model="password"
10
+ type="password"
11
+ required
12
+ minlength="12"
13
+ :placeholder="t('bt.auth.new_password')"
14
+ />
15
+ <BFormText>{{ t('bt.auth.password_hint') }}</BFormText>
16
+ </BFormGroup>
17
+ <BButton
18
+ type="submit"
19
+ variant="primary"
20
+ class="w-100"
21
+ :disabled="loading"
22
+ >
23
+ {{ t('bt.auth.change_password') }}
24
+ </BButton>
25
+ </BForm>
11
26
  </template>
12
27
 
13
- <script>
14
- import { mapActions } from 'vuex'
15
- import VueFormGenerator from 'vue-form-generator'
16
- import BtUserNewPasswordFormSchema from '../forms/BtUserNewPasswordFormSchema'
17
- import toaster from '../mixins/toaster'
28
+ <script setup>
29
+ import { ref } from 'vue'
30
+ import { useI18n } from 'vue-i18n'
31
+ import { useRouter } from 'vue-router'
32
+ import { BForm, BFormGroup, BFormInput, BFormText, BButton } from 'bootstrap-vue-next'
33
+ import { useAuthStore } from '../stores/auth'
34
+ import { useToaster } from '../composables/useToaster'
18
35
 
19
- export default {
20
- name: 'BtUserNewPasswordForm',
21
- components: {
22
- 'vue-form-generator': VueFormGenerator.component,
23
- },
24
- mixins: [toaster],
25
- props: {
26
- model: {
27
- type: Object,
28
- required: true,
29
- },
30
- },
31
- data() {
32
- return {
33
- schema: BtUserNewPasswordFormSchema,
34
- }
35
- },
36
- computed: {
37
- localModel: {
38
- get() { return this.model },
39
- set(model) { this.$emit('input', model) },
40
- },
41
- },
42
- methods: {
43
- ...mapActions('CommunityEngine/Authentication', ['newPassword']),
44
- onValidated(isValid) {
45
- if (isValid) {
46
- this.newPassword(this.model).then(() => {
47
- if (this.$route.path !== '/') {
48
- this.$router.push('/users/sign-in').then(() => {
49
- this.$toaster(
50
- 'You can now log in with your new password',
51
- 'success',
52
- {
53
- title: 'Your password has been changed',
54
- },
55
- )
56
- })
57
- }
58
- }).catch((response) => {
59
- console.log(response)
60
- })
61
- }
62
- },
63
- },
64
- }
65
- </script>
36
+ const { t } = useI18n()
66
37
 
67
- <style scoped lang="scss">
68
- @import 'bootstrap/scss/_functions.scss';
69
- @import 'bootstrap/scss/_variables.scss';
38
+ const props = defineProps({
39
+ resetPasswordToken: { type: String, default: '' },
40
+ })
70
41
 
71
- #new-password-form {
72
- ::v-deep .help-block {
73
- margin-top: 5px;
42
+ const authStore = useAuthStore()
43
+ const router = useRouter()
44
+ const { toast } = useToaster()
45
+ const loading = ref(false)
46
+ const password = ref('')
74
47
 
75
- &.errors {
76
- color: theme-color('danger')
77
- }
78
- }
79
- ::v-deep .hint {
80
- margin-top: 5px;
48
+ async function handleSubmit() {
49
+ loading.value = true
50
+ try {
51
+ await authStore.newPassword({ user: { reset_password_token: props.resetPasswordToken, password: password.value } })
52
+ await router.push('/users/sign-in')
53
+ toast('Password changed. You can now sign in.', 'success')
54
+ } catch (err) {
55
+ const msg = err?.response?.data?.error || 'Failed to change password.'
56
+ toast(msg, 'danger')
57
+ } finally {
58
+ loading.value = false
81
59
  }
82
60
  }
83
- </style>
61
+ </script>