|
| 1 | +<script setup lang="ts"> |
| 2 | +import { Task, TaskContent, TaskItem, TaskItemFile, TaskTrigger } from '@repo/elements/task' |
| 3 | +import { nanoid } from 'nanoid' |
| 4 | +import { ref } from 'vue' |
| 5 | +
|
| 6 | +interface TaskEntry { |
| 7 | + key: string |
| 8 | + type?: 'text' | 'file' |
| 9 | + text?: string |
| 10 | + filename?: string |
| 11 | +} |
| 12 | +
|
| 13 | +const tasks = ref<TaskEntry[]>([ |
| 14 | + { key: nanoid(), text: 'Searching "app/page.tsx, components structure"' }, |
| 15 | + { key: nanoid(), type: 'file', text: 'Read', filename: 'index.vue' }, |
| 16 | + { key: nanoid(), text: 'Scanning 52 files' }, |
| 17 | + { key: nanoid(), text: 'Scanning 2 files' }, |
| 18 | + { key: nanoid(), type: 'file', text: 'Reading files', filename: 'layout.vue' }, |
| 19 | +]) |
| 20 | +</script> |
| 21 | + |
| 22 | +<template> |
| 23 | + <div style="height: 200px"> |
| 24 | + <Task class="w-full"> |
| 25 | + <TaskTrigger title="Found project files" /> |
| 26 | + <TaskContent> |
| 27 | + <TaskItem |
| 28 | + v-for="task in tasks" |
| 29 | + :key="task.key" |
| 30 | + > |
| 31 | + <!-- If task is text --> |
| 32 | + <template v-if="!task.type"> |
| 33 | + {{ task.text }} |
| 34 | + </template> |
| 35 | + |
| 36 | + <!-- If task includes a file --> |
| 37 | + <template v-else> |
| 38 | + <span class="inline-flex items-center gap-1"> |
| 39 | + {{ task.text }} |
| 40 | + <TaskItemFile> |
| 41 | + <svg |
| 42 | + viewBox="0 0 32 32" |
| 43 | + fill="none" |
| 44 | + xmlns="http://www.w3.org/2000/svg" |
| 45 | + class="size-4" |
| 46 | + > |
| 47 | + <path d="M2 4L16 28L30 4H24.5L16 18.5L7.5 4H2Z" fill="#41B883" /> |
| 48 | + <path |
| 49 | + d="M7.5 4L16 18.5L24.5 4H19.5L16.0653 10.0126L12.5 4H7.5Z" |
| 50 | + fill="#35495E" |
| 51 | + /> |
| 52 | + </svg> |
| 53 | + <span>{{ task.filename }}</span> |
| 54 | + </TaskItemFile> |
| 55 | + </span> |
| 56 | + </template> |
| 57 | + </TaskItem> |
| 58 | + </TaskContent> |
| 59 | + </Task> |
| 60 | + </div> |
| 61 | +</template> |
0 commit comments