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.

App.vue 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template lang="pug">
  2. SideBar(v-if="showSidebar" :pid="pid" @updatePid="setPid" @hide="showSidebar = false")
  3. RouterView(:pid="pid" @show-sidebar="showSidebar = true")
  4. </template>
  5. <script>
  6. import * as sss from '@/sss/import.css'
  7. import SideBar from './components/SideBar.vue'
  8. import { Chatter, StonkAlert, currentProfile } from '@/services'
  9. import { surveyFactory } from '@/utils'
  10. const DEFAULT_PID = 45
  11. export default {
  12. components: { SideBar },
  13. data: () => ({
  14. showSidebar: false
  15. }),
  16. computed:{
  17. pid: () => {
  18. return currentProfile.id ? currentProfile.id : DEFAULT_PID
  19. }
  20. },
  21. async created() {
  22. await this.setupSurveyFactory()
  23. this.setupChatter()
  24. this.setupToaster()
  25. },
  26. methods: {
  27. /**
  28. * For push notifications and chat group initiation
  29. */
  30. setupToaster() {
  31. const t = new StonkAlert(this.pid)
  32. },
  33. /**
  34. * Pubnub stuff
  35. */
  36. setupChatter() {
  37. const c = new Chatter()
  38. const testAccountUUID = import.meta.env.VITE_TEST_ACCOUNT_UUID
  39. c.setup(testAccountUUID)
  40. console.log('---')
  41. },
  42. /**
  43. * Get all the questions early because lots
  44. * of things depend on the count
  45. *
  46. * Note: only make the survey if the
  47. * SurveyView is accessed
  48. */
  49. async setupSurveyFactory() {
  50. await surveyFactory.getQuestions()
  51. }
  52. },
  53. }
  54. </script>
  55. <style lang="postcss">
  56. // prettier-ignore
  57. @import './sss/theme.sss'
  58. html
  59. background-color: #e90d77
  60. #app
  61. display: flex
  62. flex-direction: row
  63. text-align: center
  64. color: $primary
  65. font-family: $sans
  66. background-color: $secondary
  67. overflow-x: hidden
  68. height: 100%
  69. > main
  70. position: relative
  71. height: 100%
  72. > article
  73. height: 100%
  74. width: 100%
  75. flex-direction: column
  76. </style>