TicketCreate.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed, toRef } from 'vue'
  4. import { type UserTaskbarItemEntityTicketCreate } from '#shared/graphql/types.ts'
  5. import { useUserTaskbarTabLink } from '#desktop/composables/useUserTaskbarTabLink.ts'
  6. import { useTicketCreateTitle } from '#desktop/entities/ticket/composables/useTicketCreateTitle.ts'
  7. import type { UserTaskbarTabEntityProps } from '../types.ts'
  8. const props =
  9. defineProps<UserTaskbarTabEntityProps<UserTaskbarItemEntityTicketCreate>>()
  10. const { tabLinkInstance, taskbarTabActive } = useUserTaskbarTabLink(
  11. toRef(props, 'taskbarTab'),
  12. )
  13. const currentTitle = computed(() => {
  14. return (props.context?.formValues?.title ||
  15. props.taskbarTab.entity?.title) as string
  16. })
  17. const currentArticleType = computed(() => {
  18. return (props.context?.formValues?.articleSenderType ||
  19. props.taskbarTab.entity?.createArticleTypeKey) as string
  20. })
  21. const { currentViewTitle } = useTicketCreateTitle(
  22. currentTitle,
  23. currentArticleType,
  24. )
  25. </script>
  26. <template>
  27. <CommonLink
  28. v-if="taskbarTabLink"
  29. ref="tabLinkInstance"
  30. v-tooltip="currentViewTitle"
  31. class="flex grow gap-2 rounded-md px-2 py-3 hover:no-underline focus-visible:rounded-md focus-visible:outline-none group-hover/tab:bg-blue-600 group-hover/tab:dark:bg-blue-900"
  32. :class="{
  33. ['!bg-blue-800 text-white']: taskbarTabActive,
  34. }"
  35. :link="taskbarTabLink"
  36. internal
  37. >
  38. <CommonIcon
  39. class="-:text-stone-200 -:dark:text-neutral-500 shrink-0 group-focus-visible/link:text-white"
  40. :class="{
  41. '!text-white': taskbarTabActive,
  42. }"
  43. name="pencil"
  44. size="small"
  45. decorative
  46. />
  47. <CommonLabel
  48. class="-:text-gray-300 -:dark:text-neutral-400 block truncate group-hover/tab:text-white group-focus-visible/link:text-white"
  49. :class="{
  50. '!text-white': taskbarTabActive,
  51. }"
  52. >
  53. {{ currentViewTitle }}
  54. </CommonLabel>
  55. </CommonLink>
  56. </template>