Skip to content

TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.

1.1 KB
Raw Blame
<template>
  <UInput
    v-model="name"
    :placeholder="t('collaboration.roles.namePlaceholder')"
    data-testid="collab-role-name-input"
    size="xl"
    variant="soft"
    class="w-full"
    :ui="{
      base: 'bg-tv-ui-bg-elevated',
    }"
    @keydown.enter="addRole"
  >
    <template #trailing>
      <UButton
        v-if="name.trim()"
        icon="i-lucide-corner-down-left"
        color="primary"
        variant="ghost"
        size="xs"
        :aria-label="t('collaboration.roles.create')"
        data-testid="collab-role-add-button"
        @click="addRole"
      />
      <UIcon
        v-else
        name="i-lucide-keyboard"
        class="size-4 text-dimmed"
      />
    </template>
  </UInput>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useI18n } from 'vue-i18n'

defineProps<{
  loading?: boolean
}>()

const emit = defineEmits<{
  add: [name: string]
}>()

const { t } = useI18n()

const name = ref('')

function addRole() {
  const trimmed = name.value.trim()
  if (trimmed) {
    emit('add', trimmed)
    name.value = ''
  }
}
</script>