feat: sidebar user menu Notion-style + settings page + tag colors + preview images/PDF
- Sidebar header: user menu dropdown (Settings, Switch workspace, Log out) avec avatar + nom + email, chevron animé, fond opaque #1E1E1E - Nouvelle page /settings avec gestion globale des tags: créer tag avec couleur, changer couleur, supprimer, liste avec compteurs - API tag management: POST/PUT/DELETE /api/settings/tags, GET /api/settings/tags/all - Preview panel: affichage images (img tag), PDF (lien viewer), détection format - workspace-chevron CSS: rotation 180° quand menu ouvert
This commit is contained in:
@@ -1155,19 +1155,49 @@ document.addEventListener('alpine:init', function() {
|
||||
this.previewPanelContent = '<div style="text-align:center;padding:40px;color:var(--text-secondary)">'
|
||||
+ '<span style="font-size:48px;display:block;margin-bottom:12px">📁</span>'
|
||||
+ '<div style="font-size:14px">' + (node.child_count||0) + ' item(s)</div>'
|
||||
+ '<button class="btn btn-secondary" style="margin-top:16px" onclick="window.location=\'/local-workspace?folder=' + node.id + '\'">Open folder</button>'
|
||||
+ '<button class="btn btn-secondary" style="margin-top:16px" onclick="window.location=\\'/local-workspace?folder=' + node.id + '\\'">Open folder</button>'
|
||||
+ '</div>';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
var name = (node.name || '').toLowerCase();
|
||||
// Image preview
|
||||
if (/\.(png|jpe?g|gif|webp|svg|bmp|ico)$/.test(name)) {
|
||||
var wsId = 1; // from workspace
|
||||
var imgUrl = '/api/files/' + wsId + '/' + encodeURIComponent(node.name);
|
||||
this.previewPanelContent = '<div style="text-align:center;padding:12px;">'
|
||||
+ '<img src="' + imgUrl + '" style="max-width:100%;max-height:50vh;border-radius:8px;" onerror="this.parentElement.innerHTML=\\'<div style=padding:20px;color:var(--text-tertiary)>Image not available</div>\\'">'
|
||||
+ '</div>';
|
||||
return;
|
||||
}
|
||||
// PDF preview
|
||||
if (/\.pdf$/.test(name)) {
|
||||
this.previewPanelContent = '<div style="text-align:center;padding:24px;color:var(--text-secondary);">'
|
||||
+ '<span style="font-size:48px;display:block;margin-bottom:8px;">📕</span>'
|
||||
+ '<div style="font-size:14px;margin-bottom:4px;">' + this._escHtml(node.name) + '</div>'
|
||||
+ '<div style="font-size:12px;color:var(--text-tertiary);margin-bottom:16px;">' + (node.size_display || '') + '</div>'
|
||||
+ '<a href="/pages/' + node.id + '" class="btn btn-secondary" style="display:inline-block;text-decoration:none;">Open in viewer</a>'
|
||||
+ '</div>';
|
||||
return;
|
||||
}
|
||||
var r = await this._fetchRetry('/api/local-workspace/page-content/' + node.id, true);
|
||||
var content = r.content || '';
|
||||
var format = r.format || '';
|
||||
var preview = '';
|
||||
if (format === 'file') {
|
||||
// Try to detect image/pdf from content metadata
|
||||
try {
|
||||
var meta = JSON.parse(content);
|
||||
if (meta.file_path && /\.(png|jpe?g|gif|webp|svg|bmp|ico)$/i.test(meta.file_path)) {
|
||||
var wsId2 = 1;
|
||||
var imgUrl2 = '/api/files/' + wsId2 + '/' + encodeURIComponent(meta.file_path);
|
||||
this.previewPanelContent = '<img src="' + imgUrl2 + '" style="max-width:100%;max-height:50vh;border-radius:8px;">';
|
||||
return;
|
||||
}
|
||||
} catch(e) {}
|
||||
preview = '<div style="text-align:center;padding:20px;color:var(--text-secondary)">'
|
||||
+ '<span style="font-size:48px;display:block;margin-bottom:8px">📄</span>'
|
||||
+ 'Uploaded file — open to view</div>';
|
||||
+ (node.size_display || '') + ' — open to view</div>';
|
||||
} else if (format === 'blocks') {
|
||||
try {
|
||||
var blocks = typeof content === 'string' ? JSON.parse(content) : content;
|
||||
|
||||
Reference in New Issue
Block a user