Spaces:
Running
Running
File size: 5,359 Bytes
19f0249 657ff42 19f0249 657ff42 19f0249 657ff42 19f0249 657ff42 19f0249 657ff42 19f0249 657ff42 19f0249 657ff42 19f0249 657ff42 19f0249 657ff42 19f0249 657ff42 |
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 |
class ProjectManager extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.projects = [
{ id: 'projet1', name: 'Espace Codage - Projet 1', active: true },
{ id: 'projet2', name: 'Espace Codage - Projet 2', active: false }
];
this.tools = [
{ name: 'La Baleine IA', icon: 'image', href: 'baleine.html', description: 'Générateur multimédia IA' },
{ name: 'Rosalinda IA', icon: 'message-circle', href: 'rosalinda.html', description: 'Assistante conversationnelle' },
{ name: 'Bibliothèque', icon: 'book', href: '#', description: 'Ressources et templates' },
{ name: 'Paramètres', icon: 'settings', href: '#', description: 'Configuration du workspace' }
];
this.currentProject = this.projects[0];
}
connectedCallback() {
this.render();
this.setupEventListeners();
}
render() {
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
width: 100%;
height: 100%;
background: var(--bg-color, #1e293b);
color: var(--text-color, #f8fafc);
}
.sidebar {
padding: 1rem;
height: 100%;
display: flex;
flex-direction: column;
}
.project-info {
padding: 1rem;
margin-bottom: 1rem;
border-radius: 0.5rem;
background: rgba(255, 255, 255, 0.05);
}
.project-title {
font-weight: 600;
margin-bottom: 0.5rem;
}
.project-status {
font-size: 0.75rem;
color: rgba(156, 163, 175, 1);
}
.projects {
flex-grow: 1;
overflow-y: auto;
}
.project {
padding: 0.75rem 1rem;
margin-bottom: 0.5rem;
border-radius: 0.5rem;
cursor: pointer;
display: flex;
align-items: center;
gap: 0.75rem;
border: 1px solid transparent;
transition: all 0.2s ease;
}
.project:hover {
background: rgba(255, 255, 255, 0.05);
}
.project.active {
background: rgba(59, 130, 246, 0.1);
border-color: rgba(59, 130, 246, 0.2);
color: rgba(191, 219, 254, 1);
}
.project-icon {
width: 1.5rem;
height: 1.5rem;
border-radius: 0.375rem;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.1);
}
.tools {
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.tool {
padding: 0.75rem 1rem;
margin-bottom: 0.5rem;
border-radius: 0.5rem;
cursor: pointer;
display: flex;
align-items: center;
gap: 0.75rem;
transition: all 0.2s ease;
}
.tool:hover {
background: rgba(255, 255, 255, 0.05);
}
.tool-description {
font-size: 0.75rem;
color: rgba(156, 163, 175, 1);
margin-top: 0.25rem;
}
h3 {
margin: 0 0 1rem 0;
font-size: 0.875rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: rgba(156, 163, 175, 1);
}
</style>
<div class="sidebar">
<div class="project-info">
<div class="project-title">${this.currentProject.name}</div>
<div class="project-status">Modifié il y a 2 heures</div>
</div>
<div class="projects">
<h3>Projets</h3>
${this.projects.map(project => `
<div class="project ${project.active ? 'active' : ''}" data-id="${project.id}">
<div class="project-icon">
<i data-feather="folder"></i>
</div>
<span>${project.name}</span>
</div>
`).join('')}
</div>
<div class="tools">
<h3>Outils IA</h3>
${this.tools.map(tool => `
<a href="${tool.href}" class="tool">
<div class="project-icon">
<i data-feather="${tool.icon}"></i>
</div>
<div>
<div>${tool.name}</div>
<div class="tool-description">${tool.description}</div>
</div>
</a>
`).join('')}
</div>
</div>
`;
feather.replace();
}
setupEventListeners() {
this.shadowRoot.querySelectorAll('.project').forEach(project => {
project.addEventListener('click', () => {
this.projects.forEach(p => p.active = false);
const selectedProject = this.projects.find(p => p.id === project.dataset.id);
if (selectedProject) {
selectedProject.active = true;
this.currentProject = selectedProject;
this.render();
// Dispatch event to update other components
this.dispatchEvent(new CustomEvent('project-changed', {
detail: {
project: selectedProject,
tools: this.tools
}
}));
}
});
});
}
}
customElements.define('project-manager', ProjectManager); |