TicketViewerItem.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed, toRef } from 'vue'
  4. import CommonUserAvatar from '#shared/components/CommonUserAvatar/CommonUserAvatar.vue'
  5. import {
  6. type AvatarUser,
  7. type AvatarUserLive,
  8. } from '#shared/components/CommonUserAvatar/types.ts'
  9. import { useAvatarIndicator } from '#shared/composables/useAvatarIndicator.ts'
  10. import { EnumTaskbarApp } from '#shared/graphql/types.ts'
  11. import { getIdFromGraphQLId } from '#shared/graphql/utils.ts'
  12. export interface Props {
  13. user: AvatarUser
  14. editing: boolean
  15. idle?: boolean
  16. app: EnumTaskbarApp
  17. }
  18. const props = defineProps<Props>()
  19. const liveUser = computed<AvatarUserLive>(() => ({
  20. editing: props.editing,
  21. app: props.app,
  22. isIdle: props.idle,
  23. }))
  24. const { indicatorIcon, indicatorLabel, indicatorIsIdle } = useAvatarIndicator(
  25. toRef(props.user),
  26. false,
  27. liveUser,
  28. )
  29. </script>
  30. <template>
  31. <CommonLink
  32. :key="user.id"
  33. :link="`/users/${getIdFromGraphQLId(user.id)}`"
  34. class="flex items-center justify-between px-3 first:pt-1 last:pb-1"
  35. >
  36. <div class="flex items-center">
  37. <CommonUserAvatar :entity="user" :live="{ isIdle: idle }" />
  38. <div class="ltr:ml-3 rtl:mr-3">{{ user.fullname }}</div>
  39. </div>
  40. <div v-if="indicatorIcon" class="flex items-center">
  41. <CommonIcon
  42. :class="{ 'fill-gray': indicatorIsIdle }"
  43. :label="indicatorLabel"
  44. :name="indicatorIcon"
  45. />
  46. </div>
  47. </CommonLink>
  48. </template>