You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template lang="pug">
  2. w-app
  3. w-drawer(v-model="openDrawer")
  4. w-flex.my12(:gap="3" align-center wrap)
  5. w-button.ma1(@click="$waveui.notify('Information.')" bg-color="info") Notify info
  6. w-button.ma1(@click="$waveui.notify('Success!', 'success')" bg-color="success") Notify success
  7. w-button.ma1(@click="$waveui.notify('Warning!', 'warning')" bg-color="warning") Notify warning
  8. w-button.ma1(@click="$waveui.notify('Error :(', 'error', 0)" bg-color="error") Permanent error
  9. w-flex.my12(align-center wrap)
  10. w-spinner(bounce)
  11. w-input Label
  12. w-checkbox Single option
  13. w-flex.my12
  14. w-button(@click="openDrawer = true" outline="")
  15. | Open drawer
  16. w-flex.my12(grow column)
  17. w-slider(:model-value="40" thumb-label step-label :step="20" color="primary-light3").mt12
  18. .mt4 v-model:
  19. code.ml1 {{ sliderVal }}
  20. w-flex.my12(:gap="3" align-center wrap)
  21. | Show menu on:
  22. w-menu
  23. template(#activator="{ on }")
  24. w-button(v-on="on") Show menu
  25. | Menu content
  26. w-badge.mr10(bg-color="error")
  27. template(#badge) 3
  28. w-icon(color="grey-light1" size="2.5em") mdi mdi-email
  29. SideBar(
  30. v-if="showSidebar"
  31. :pid="getPid"
  32. @updatePid="setPid"
  33. @hide="showSidebar = false"
  34. )
  35. RouterView(
  36. :pid="getPid"
  37. @updatePid="setPid"
  38. @show-sidebar="showSidebar = !showSidebar"
  39. )
  40. </template>
  41. <script>
  42. import 'wave-ui/dist/wave-ui.css'
  43. import SideBar from './components/SideBar.vue'
  44. import { currentProfile } from './services'
  45. import { surveyFactory } from './utils'
  46. const DEV_MODE = import.meta.env.VITE_DEV == 'true'
  47. const DEV_PID = 45
  48. export default {
  49. components: { SideBar },
  50. data: () => ({
  51. showSidebar: false,
  52. sliderVal: 1,
  53. openDrawer: false,
  54. }),
  55. computed: {
  56. getPid: () => (currentProfile.id.value ? currentProfile.id.value : 999),
  57. },
  58. async created() {
  59. /** Get questions so we can compare against profile responses */
  60. await surveyFactory.getQuestions()
  61. /**
  62. * Development mode turns router guards off so
  63. * we hard set the profile id instead of
  64. * using the login form
  65. */
  66. if (DEV_MODE) {
  67. this.setPid(DEV_PID)
  68. }
  69. },
  70. methods: {
  71. /**
  72. * Sync up this components state with
  73. * the currentProfile handler
  74. */
  75. async setPid(profileId) {
  76. if (currentProfile.isLoggedIn) {
  77. currentProfile.logout()
  78. }
  79. await currentProfile.login(profileId)
  80. if (currentProfile.isLoggedIn) {
  81. console.warn(
  82. `setting up Chatter and Toaster for ${this.getPid}...`,
  83. )
  84. currentProfile.setupChatter()
  85. currentProfile.setupToaster(this.$waveui.notify)
  86. }
  87. console.log('---')
  88. },
  89. },
  90. }
  91. </script>