File size: 7,009 Bytes
8d1819a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<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()">
                            <span class="icon material-symbols-outlined">close</span>
                        </button>
                        <button type="button" class="button icon-button" title="Edit" @click="$store.projects.openEditModal($store.chats.selectedContext?.project?.name)">
                            <span class="icon material-symbols-outlined">edit</span>
                        </button>
                    </div>
                    <button @click="$store.projects.openCreateModal()" type="button"
                        class="button projects-create-btn-top">
                        <span class="icon material-symbols-outlined">add</span> 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" style="display: flex; align-items: start; justify-content: space-between; gap: 1em;">
  <div>
    <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 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" style="display: flex; gap: 0.5em;">
    <template x-if="$store.chats.selectedContext && project.name === $store.chats.selectedContext?.project?.name">
      <button type="button" class="button cancel" title="Deactivate" style="width:9em" @click="$store.projects.deactivateProject()">
        <span class="icon material-symbols-outlined">close</span> Deactivate
      </button>
    </template>
    <template x-if="$store.chats.selectedContext && project.name !== $store.chats.selectedContext?.project?.name">
      <button type="button" class="button confirm" title="Activate" style="width:9em" @click="$store.projects.activateProject(project.name)">
        <span class="icon material-symbols-outlined">play_arrow</span> Activate
      </button>
    </template>
    <button type="button" class="button icon-button" title="Edit" @click="$store.projects.openEditModal(project.name)">
      <span class="icon material-symbols-outlined">edit</span>
    </button>
    <button type="button" class="button cancel icon-button" title="Delete" @click="$store.projects.deleteProject(project.name)">
      <span class="icon material-symbols-outlined">delete</span>
    </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"><span class="icon material-symbols-outlined">add</span>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-title {
        font-weight: bold;
        font-size: 1.2em;
        display: flex;
        align-items: center;
    }
    .projects-project-card-name {
        margin-top: var(--spacing-xs);
    }

    .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: column;
      gap: 1em;
    }
    .active-project-display {
      width: 100%;
      justify-content: space-between;
    }
  }
</style>
</html>