File size: 9,022 Bytes
6918275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<html>

<head>
    <title>Projects</title>
    <script type="module">
        import { store as projectsStore } from "/components/projects/projects-store.js";
        import { store as chatsStore } from "/components/sidebar/chats/chats-store.js";
    </script>
</head>

<body>
    <div x-data>
        <template x-if="$store.projects && $store.chats">
            <div>
                <p class="projects-intro">Projects in Agent Zero are used to separate different use cases with custom
                    instructions and files.
                    You can create projects for your tasks and switch between them easily.</p>
                <div class="projects-list-header">
                    <div x-show="$store.chats.selectedContext && $store.chats.selectedContext?.project" class="active-project-display">
                        <span style="display: inline-flex; align-items: center; gap: 0.5em;">
                            <span>Active:</span>
                            <span class="project-color-ball" :style="$store.chats.selectedContext?.project?.color ? { backgroundColor: $store.chats.selectedContext?.project?.color } : { border: '1px solid var(--color-border)' }"></span>
                            <strong x-text="$store.chats.selectedContext?.project?.name"></strong>
                        </span>
                        <button type="button" class="button cancel icon-button" title="Deactivate" @click="$store.projects.deactivateProject()">
                            <x-icon class="icon" name="close"></x-icon>
                        </button>
                        <button type="button" class="button icon-button" title="Edit" @click="$store.projects.openEditModal($store.chats.selectedContext?.project?.name)">
                            <x-icon class="icon" name="edit"></x-icon>
                        </button>
                    </div>
                    <button @click="$store.projects.openCreateModal()" type="button"
                        class="button projects-create-btn-top">
                        <x-icon class="icon" name="add"></x-icon> Create project
                    </button>
                </div>

                <template :key="project.name" x-for="project in $store.projects.projectList">
                    <div class="projects-project-card" :class="{ 'projects-active': project.name === $store.chats.selectedContext?.project?.name }">
                        <div class="projects-project-card-header">
                            <div class="projects-project-card-info">
                                <div class="projects-project-card-title">
                                    <span class="project-color-ball" :style="project.color ? { backgroundColor: project.color } : { border: '1px solid var(--color-border)' }"></span>
                                    <span class="projects-project-card-title-text" x-text="project.title"></span>
                                </div>
                                <div class="projects-project-card-name">/<span x-text="project.name"></span></div>
                            </div>
                            <div class="projects-project-card-actions">
                                <template x-if="$store.chats.selectedContext && project.name === $store.chats.selectedContext?.project?.name">
                                    <button type="button" class="button cancel projects-project-card-state-action" title="Deactivate" @click="$store.projects.deactivateProject()">
                                        <x-icon class="icon" name="close"></x-icon>
                                        <span class="projects-project-card-action-text">Deactivate</span>
                                    </button>
                                </template>
                                <template x-if="$store.chats.selectedContext && project.name !== $store.chats.selectedContext?.project?.name">
                                    <button type="button" class="button confirm projects-project-card-state-action" title="Activate" @click="$store.projects.activateProject(project.name)">
                                        <x-icon class="icon" name="play_arrow"></x-icon>
                                        <span class="projects-project-card-action-text">Activate</span>
                                    </button>
                                </template>
                                <button type="button" class="button icon-button" title="Edit" @click="$store.projects.openEditModal(project.name)">
                                    <x-icon class="icon" name="edit"></x-icon>
                                </button>
                                <button type="button" class="button cancel icon-button" title="Delete" @click="$confirmClick($event, () => $store.projects.deleteProject(project.name))">
                                    <x-icon class="icon" name="delete"></x-icon>
                                </button>
                            </div>
                        </div>
                        <!-- <div class="projects-project-card-description"><span x-text="project.description"></span></div> -->
                    </div>
                </template>

                <template x-if="$store.projects.projectList.length === 0">
                    <div class="projects-no-projects">
                        <div class="projects-project-card-title">There are no projects yet</div>
                        <div class="projects-no-projects-actions">
                            <button @click="$store.projects.openCreateModal()" type="button"
                                class="button"><x-icon class="icon" name="add"></x-icon>Create project</button>
                        </div>
                    </div>
                </template>

            </div>
        </template>
    </div>
</body>
<style>
    .projects-project-card {
        border: 1px solid var(--color-border);
        border-radius: 0.5em;
        padding: 1em;
        margin-top: 1em;
    }

    .projects-project-card.projects-active {
        border-color: var(--color-highlight);
    }

    .projects-project-card-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1em;
    }

    .projects-project-card-info {
        min-width: 0;
        flex: 1 1 auto;
    }

    .projects-project-card-title {
        font-weight: bold;
        font-size: 1.2em;
        display: flex;
        align-items: center;
        min-width: 0;
        line-height: 1.25;
    }

    .projects-project-card-title-text {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .projects-project-card-name {
        margin-top: var(--spacing-xs);
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .projects-project-card-actions {
        display: flex;
        align-items: center;
        gap: 0.5em;
        flex: 0 0 auto;
    }

    .projects-project-card-state-action {
        gap: 0.35em;
        min-width: 9em;
    }

    .project-color-ball {
        width: 0.6em;
        height: 0.6em;
        border-radius: 50%;
        display: inline-block;
        margin-right: 0.5em;
        flex-shrink: 0;
        box-sizing: border-box;
    }

    .projects-project-card-description {
        font-size: 0.9em;
        color: var(--color-text);
    }

    .projects-no-projects {
        border: 1px dashed var(--color-border);
        border-radius: 0.5em;
        padding: 2em;
        margin: 1em;
        text-align: center;
        background: var(--color-panel);
    }

    .projects-no-projects-actions {
        margin-top: 1em;
        display: flex;
        justify-content: center;
    }

    .projects-create-btn-top {
        float: right;
        margin: var(--spacing-xs) var(--spacing-md);
    }

    .projects-list-header {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        margin-bottom: 0.5em;
    }

    .active-project-display {
        display: flex;
        align-items: center;
        gap: 0.5em;
        border: 1px solid var(--color-highlight);
        padding: 0.5em;
        border-radius: 0.5em;
        margin-right: auto;
    }

  @media (max-width: 600px) {
    .projects-list-header {
      flex-wrap: wrap;
      gap: 1em;
    }

    .projects-project-card-header {
      flex-direction: row;
      gap: 0.75em;
    }

    .projects-project-card-title {
      font-size: 1.1em;
    }

    .projects-project-card-actions {
      gap: 0.4em;
      padding-top: 0.08em;
    }

    .projects-project-card-state-action {
      min-width: 2.75rem;
      padding-left: 0.75rem;
      padding-right: 0.75rem;
    }

    .projects-project-card-action-text {
      display: none;
    }

    .active-project-display {
      width: 100%;
      justify-content: space-between;
    }
  }
</style>
</html>