Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

ProfileCard.vue 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template lang="pug">
  2. w-card.profile-card-list--card.xs12
  3. header.xs12.w-flex.column.center
  4. NamePlate(
  5. :ethnicity='card.ethnicity'
  6. :is-list='isList'
  7. :is-paired='isPaired'
  8. :locale='card.locale'
  9. :name='card.name'
  10. :pid='card.pid'
  11. :pronouns='card.pronouns'
  12. :role='card.role'
  13. )
  14. template(v-if='!isList')
  15. w-button.text-upper.xs12.pa6(v-if='currentTab == 0 && isPaired')
  16. w-icon.mr1.icon-chat(xl)
  17. | start chat
  18. //- TODO: Uncomment me
  19. //- SummaryBar(
  20. //- :aspects='aspects'
  21. //- :is-tab='isPaired'
  22. //- :tab-content='card.summary'
  23. //- @tab-change='onTab'
  24. //- )
  25. //- This version forces tabs on
  26. SummaryBar(
  27. :aspects='aspects'
  28. :is-tab='true'
  29. :name='card.name'
  30. :tab-content='card.summary'
  31. @tab-change='onTab'
  32. )
  33. TagList(v-if='!isPaired || isList')
  34. article.xs12.w-flex.column.justify-space-between
  35. AspectBar(
  36. :key='aspect.name'
  37. :labels='aspect.labels'
  38. :percentage='aspect.percentage'
  39. v-for='aspect in aspects'
  40. v-if='!isPaired || isList'
  41. )
  42. footer(v-if='!isList && !isPaired')
  43. .px3
  44. p {{ card.summary.about.tab }}
  45. PairingButton(@pair='onPair' @pass='onPass' v-if='!isPaired')
  46. w-button.text-upper.xs12.pa6(v-else-if='currentTab != 0')
  47. w-icon.mr1.icon-chat(xl)
  48. | start chat
  49. </template>
  50. <script setup>
  51. import { ref } from 'vue'
  52. import { useRouter } from 'vue-router'
  53. import { postMembershipByProfileId, currentProfile } from '../services'
  54. import NamePlate from './NamePlate.vue'
  55. import AspectBar from './AspectBar.vue'
  56. import SummaryBar from './SummaryBar.vue'
  57. import TagList from './TagList.vue'
  58. import PairingButton from './PairingButton.vue'
  59. const router = useRouter()
  60. const isPaired = ref(true)
  61. //const isPaired = ref(false)
  62. const props = defineProps({
  63. card: {
  64. type: Object,
  65. required: true,
  66. },
  67. aspects: {
  68. type: Array,
  69. required: true,
  70. },
  71. isList: {
  72. type: Boolean,
  73. required: false,
  74. default: true,
  75. },
  76. })
  77. /**
  78. * Track tab state for conditional rendering
  79. */
  80. const currentTab = ref(0)
  81. const onTab = tabIndex => {
  82. if (currentTab.value == tabIndex) return
  83. currentTab.value = tabIndex
  84. }
  85. /**
  86. * Attempt to pair with target profile
  87. * Creates a grouping, and a membership
  88. * for both profileId and targetId
  89. */
  90. const onPair = async () => {
  91. currentProfile._loading = true
  92. const profileId = currentProfile.id.value
  93. const targetId = props.card.pid
  94. await postMembershipByProfileId({
  95. profileId,
  96. targetId,
  97. })
  98. await currentProfile.updateQueue(profileId, targetId, false)
  99. await currentProfile.getGroupings()
  100. currentProfile._loading = false
  101. let goToRoute = { name: 'HomeView' }
  102. router.push(goToRoute)
  103. }
  104. /**
  105. * Send to the back of the matchQueue
  106. * and forward back home
  107. */
  108. const onPass = async () => {
  109. currentProfile._loading = true
  110. await currentProfile.updateQueue(
  111. currentProfile.id.value,
  112. props.card.pid,
  113. true,
  114. )
  115. currentProfile._loading = false
  116. let goToRoute = { name: 'HomeView' }
  117. router.push(goToRoute)
  118. }
  119. </script>
  120. <style lang="sass">
  121. @import '../assets/sass/main'
  122. .profile-card-list--card
  123. background-color: $black
  124. color: #fff
  125. width: 100%
  126. max-width: 450px
  127. margin: 11px auto
  128. header > .w-button
  129. background-color: $dark-green
  130. color: #fff
  131. footer
  132. margin-bottom: 22px
  133. p
  134. font-family: Source Pro, AppleGothic, sans-serif
  135. margin: 11px auto
  136. padding: 0 7px
  137. line-height: 1.619em
  138. </style>