| 1 | <html> |
| 2 | |
| 3 | <head> |
| 4 | <title>Projects</title> |
| 5 | <script type="module"> |
| 6 | import { store as projectsStore } from "/components/projects/projects-store.js"; |
| 7 | import { store as chatsStore } from "/components/sidebar/chats/chats-store.js"; |
| 8 | </script> |
| 9 | </head> |
| 10 | |
| 11 | <body> |
| 12 | <div x-data> |
| 13 | <template x-if="$store.projects && $store.chats"> |
| 14 | <div> |
| 15 | <p class="projects-intro">Projects in Agent Zero are used to separate different use cases with custom |
| 16 | instructions and files. |
| 17 | You can create projects for your tasks and switch between them easily.</p> |
| 18 | <div class="projects-list-header"> |
| 19 | <div x-show="$store.chats.selectedContext && $store.chats.selectedContext?.project" class="active-project-display"> |
| 20 | <span style="display: inline-flex; align-items: center; gap: 0.5em;"> |
| 21 | <span>Active:</span> |
| 22 | <span class="project-color-ball" :style="$store.chats.selectedContext?.project?.color ? { backgroundColor: $store.chats.selectedContext?.project?.color } : { border: '1px solid var(--color-border)' }"></span> |
| 23 | <strong x-text="$store.chats.selectedContext?.project?.name"></strong> |
| 24 | </span> |
| 25 | <button type="button" class="button cancel icon-button" title="Deactivate" @click="$store.projects.deactivateProject()"> |
| 26 | <x-icon class="icon" name="close"></x-icon> |
| 27 | </button> |
| 28 | <button type="button" class="button icon-button" title="Edit" @click="$store.projects.openEditModal($store.chats.selectedContext?.project?.name)"> |
| 29 | <x-icon class="icon" name="edit"></x-icon> |
| 30 | </button> |
| 31 | </div> |
| 32 | <button @click="$store.projects.openCreateModal()" type="button" |
| 33 | class="button projects-create-btn-top"> |
| 34 | <x-icon class="icon" name="add"></x-icon> Create project |
| 35 | </button> |
| 36 | </div> |
| 37 | |
| 38 | <template :key="project.name" x-for="project in $store.projects.projectList"> |
| 39 | <div class="projects-project-card" :class="{ 'projects-active': project.name === $store.chats.selectedContext?.project?.name }"> |
| 40 | <div class="projects-project-card-header"> |
| 41 | <div class="projects-project-card-info"> |
| 42 | <div class="projects-project-card-title"> |
| 43 | <span class="project-color-ball" :style="project.color ? { backgroundColor: project.color } : { border: '1px solid var(--color-border)' }"></span> |
| 44 | <span class="projects-project-card-title-text" x-text="project.title"></span> |
| 45 | </div> |
| 46 | <div class="projects-project-card-name">/<span x-text="project.name"></span></div> |
| 47 | </div> |
| 48 | <div class="projects-project-card-actions"> |
| 49 | <template x-if="$store.chats.selectedContext && project.name === $store.chats.selectedContext?.project?.name"> |
| 50 | <button type="button" class="button cancel projects-project-card-state-action" title="Deactivate" @click="$store.projects.deactivateProject()"> |
| 51 | <x-icon class="icon" name="close"></x-icon> |
| 52 | <span class="projects-project-card-action-text">Deactivate</span> |
| 53 | </button> |
| 54 | </template> |
| 55 | <template x-if="$store.chats.selectedContext && project.name !== $store.chats.selectedContext?.project?.name"> |
| 56 | <button type="button" class="button confirm projects-project-card-state-action" title="Activate" @click="$store.projects.activateProject(project.name)"> |
| 57 | <x-icon class="icon" name="play_arrow"></x-icon> |
| 58 | <span class="projects-project-card-action-text">Activate</span> |
| 59 | </button> |
| 60 | </template> |
| 61 | <button type="button" class="button icon-button" title="Edit" @click="$store.projects.openEditModal(project.name)"> |
| 62 | <x-icon class="icon" name="edit"></x-icon> |
| 63 | </button> |
| 64 | <button type="button" class="button cancel icon-button" title="Delete" @click="$confirmClick($event, () => $store.projects.deleteProject(project.name))"> |
| 65 | <x-icon class="icon" name="delete"></x-icon> |
| 66 | </button> |
| 67 | </div> |
| 68 | </div> |
| 69 | <!-- <div class="projects-project-card-description"><span x-text="project.description"></span></div> --> |
| 70 | </div> |
| 71 | </template> |
| 72 | |
| 73 | <template x-if="$store.projects.projectList.length === 0"> |
| 74 | <div class="projects-no-projects"> |
| 75 | <div class="projects-project-card-title">There are no projects yet</div> |
| 76 | <div class="projects-no-projects-actions"> |
| 77 | <button @click="$store.projects.openCreateModal()" type="button" |
| 78 | class="button"><x-icon class="icon" name="add"></x-icon>Create project</button> |
| 79 | </div> |
| 80 | </div> |
| 81 | </template> |
| 82 | |
| 83 | </div> |
| 84 | </template> |
| 85 | </div> |
| 86 | </body> |
| 87 | <style> |
| 88 | .projects-project-card { |
| 89 | border: 1px solid var(--color-border); |
| 90 | border-radius: 0.5em; |
| 91 | padding: 1em; |
| 92 | margin-top: 1em; |
| 93 | } |
| 94 | |
| 95 | .projects-project-card.projects-active { |
| 96 | border-color: var(--color-highlight); |
| 97 | } |
| 98 | |
| 99 | .projects-project-card-header { |
| 100 | display: flex; |
| 101 | align-items: flex-start; |
| 102 | justify-content: space-between; |
| 103 | gap: 1em; |
| 104 | } |
| 105 | |
| 106 | .projects-project-card-info { |
| 107 | min-width: 0; |
| 108 | flex: 1 1 auto; |
| 109 | } |
| 110 | |
| 111 | .projects-project-card-title { |
| 112 | font-weight: bold; |
| 113 | font-size: 1.2em; |
| 114 | display: flex; |
| 115 | align-items: center; |
| 116 | min-width: 0; |
| 117 | line-height: 1.25; |
| 118 | } |
| 119 | |
| 120 | .projects-project-card-title-text { |
| 121 | min-width: 0; |
| 122 | overflow: hidden; |
| 123 | text-overflow: ellipsis; |
| 124 | white-space: nowrap; |
| 125 | } |
| 126 | |
| 127 | .projects-project-card-name { |
| 128 | margin-top: var(--spacing-xs); |
| 129 | min-width: 0; |
| 130 | overflow: hidden; |
| 131 | text-overflow: ellipsis; |
| 132 | white-space: nowrap; |
| 133 | } |
| 134 | |
| 135 | .projects-project-card-actions { |
| 136 | display: flex; |
| 137 | align-items: center; |
| 138 | gap: 0.5em; |
| 139 | flex: 0 0 auto; |
| 140 | } |
| 141 | |
| 142 | .projects-project-card-state-action { |
| 143 | gap: 0.35em; |
| 144 | min-width: 9em; |
| 145 | } |
| 146 | |
| 147 | .project-color-ball { |
| 148 | width: 0.6em; |
| 149 | height: 0.6em; |
| 150 | border-radius: 50%; |
| 151 | display: inline-block; |
| 152 | margin-right: 0.5em; |
| 153 | flex-shrink: 0; |
| 154 | box-sizing: border-box; |
| 155 | } |
| 156 | |
| 157 | .projects-project-card-description { |
| 158 | font-size: 0.9em; |
| 159 | color: var(--color-text); |
| 160 | } |
| 161 | |
| 162 | .projects-no-projects { |
| 163 | border: 1px dashed var(--color-border); |
| 164 | border-radius: 0.5em; |
| 165 | padding: 2em; |
| 166 | margin: 1em; |
| 167 | text-align: center; |
| 168 | background: var(--color-panel); |
| 169 | } |
| 170 | |
| 171 | .projects-no-projects-actions { |
| 172 | margin-top: 1em; |
| 173 | display: flex; |
| 174 | justify-content: center; |
| 175 | } |
| 176 | |
| 177 | .projects-create-btn-top { |
| 178 | float: right; |
| 179 | margin: var(--spacing-xs) var(--spacing-md); |
| 180 | } |
| 181 | |
| 182 | .projects-list-header { |
| 183 | width: 100%; |
| 184 | display: flex; |
| 185 | justify-content: flex-end; |
| 186 | align-items: center; |
| 187 | margin-bottom: 0.5em; |
| 188 | } |
| 189 | |
| 190 | .active-project-display { |
| 191 | display: flex; |
| 192 | align-items: center; |
| 193 | gap: 0.5em; |
| 194 | border: 1px solid var(--color-highlight); |
| 195 | padding: 0.5em; |
| 196 | border-radius: 0.5em; |
| 197 | margin-right: auto; |
| 198 | } |
| 199 | |
| 200 | @media (max-width: 600px) { |
| 201 | .projects-list-header { |
| 202 | flex-wrap: wrap; |
| 203 | gap: 1em; |
| 204 | } |
| 205 | |
| 206 | .projects-project-card-header { |
| 207 | flex-direction: row; |
| 208 | gap: 0.75em; |
| 209 | } |
| 210 | |
| 211 | .projects-project-card-title { |
| 212 | font-size: 1.1em; |
| 213 | } |
| 214 | |
| 215 | .projects-project-card-actions { |
| 216 | gap: 0.4em; |
| 217 | padding-top: 0.08em; |
| 218 | } |
| 219 | |
| 220 | .projects-project-card-state-action { |
| 221 | min-width: 2.75rem; |
| 222 | padding-left: 0.75rem; |
| 223 | padding-right: 0.75rem; |
| 224 | } |
| 225 | |
| 226 | .projects-project-card-action-text { |
| 227 | display: none; |
| 228 | } |
| 229 | |
| 230 | .active-project-display { |
| 231 | width: 100%; |
| 232 | justify-content: space-between; |
| 233 | } |
| 234 | } |
| 235 | </style> |
| 236 | </html> |