Newer
Older
navi-1 / webclient / src / components / settings / skills / composables / useCatalogLabels.js
import { computed } from 'vue'

import { t } from '@/i18n/index.js'

/**
 * The panel's copy: one catalog rendered as either skills or protocols, so
 * every label picks the slug that matches the kind.
 */
export function useCatalogLabels({ getKind, items }) {
  const isProtocol = computed(() => getKind() === 'protocol')
  const title = computed(() =>
    t(isProtocol.value ? 'settings.tabProtocols' : 'settings.tabSkills')
  )
  const hint = computed(() =>
    t(isProtocol.value ? 'settings.skillsHintProtocols' : 'settings.skillsHintSkills')
  )
  const addLabel = computed(() =>
    t(isProtocol.value ? 'settings.skillsAddProtocol' : 'settings.skillsAddSkill')
  )
  const emptyLabel = computed(() =>
    t(isProtocol.value ? 'settings.skillsEmptyProtocols' : 'settings.skillsEmptySkills')
  )
  const countLabel = computed(() =>
    t(
      isProtocol.value ? 'settings.skillsCountProtocols' : 'settings.skillsCountSkills',
      { n: items.value.length },
    )
  )
  const newTitle = computed(() =>
    t(isProtocol.value ? 'settings.skillsNewProtocol' : 'settings.skillsNewSkill')
  )

  return { isProtocol, title, hint, addLabel, emptyLabel, countLabel, newTitle }
}