Changeset 0.19.2 (#84)

This commit is contained in:
2026-03-01 01:05:54 +00:00
parent 37a9b1a68e
commit eb74180611
9 changed files with 473 additions and 18 deletions

View File

@@ -302,9 +302,15 @@ const UI = {
};
// ── Project groups ──────────────────────
if (projects.length > 0) {
projects.forEach(proj => {
const projChats = chats.filter(c => c.projectId === proj.id);
const showArchived = App.showArchivedProjects || false;
const visibleProjects = showArchived ? projects : projects.filter(p => !p.isArchived);
const hasArchived = projects.some(p => p.isArchived);
if (visibleProjects.length > 0) {
visibleProjects.forEach(proj => {
const projChats = typeof _getReorderedProjectChats === 'function'
? _getReorderedProjectChats(proj.id, chats)
: chats.filter(c => c.projectId === proj.id);
if (projChats.length === 0 && query) return; // hide empty projects during search
const isCollapsed = App.collapsedProjects[proj.id];
const colorDot = proj.color
@@ -314,7 +320,9 @@ const UI = {
const isActive = App.activeProjectId === proj.id;
html += `<div class="project-group${isActive ? ' active' : ''}"
const groupClasses = 'project-group' + (isActive ? ' active' : '') + (proj.isArchived ? ' archived' : '');
html += `<div class="${groupClasses}"
ondragover="onProjectDragOver(event)"
ondragleave="onProjectDragLeave(event)"
ondrop="onProjectDrop(event,'${proj.id}')">
@@ -336,14 +344,25 @@ const UI = {
}
html += '</div>';
});
// "Show archived" toggle
if (hasArchived) {
html += `<button class="project-show-archived" onclick="App.showArchivedProjects=!App.showArchivedProjects;UI.renderChatList()">
${showArchived ? '▾ Hide archived' : '▸ Show archived (' + projects.filter(p => p.isArchived).length + ')'}
</button>`;
}
}
// ── Recent (unassigned) chats ───────────
const recentChats = chats.filter(c => !c.projectId);
// Include chats from archived-and-hidden projects so they don't vanish
const hiddenProjectIds = new Set(
projects.filter(p => p.isArchived && !showArchived).map(p => p.id)
);
const recentChats = chats.filter(c => !c.projectId || hiddenProjectIds.has(c.projectId));
if (recentChats.length > 0 || projects.length > 0) {
if (recentChats.length > 0 || visibleProjects.length > 0) {
// Only show "Recent" label if there are also projects
if (projects.length > 0) {
if (visibleProjects.length > 0) {
html += `<div class="recent-section"
ondragover="onProjectDragOver(event)"
ondragleave="onProjectDragLeave(event)"
@@ -373,9 +392,7 @@ const UI = {
const renderGroup = (label, items) => {
if (items.length === 0) return;
// Only show time labels when there are no projects (preserve original look)
// or when inside the Recent section
if (projects.length > 0) {
if (visibleProjects.length > 0) {
html += `<div class="chat-group-label chat-time-label">${label}</div>`;
} else {
html += `<div class="chat-group-label">${label}</div>`;
@@ -388,10 +405,9 @@ const UI = {
renderGroup('Previous 7 days', groups.week);
renderGroup('Older', groups.older);
if (projects.length > 0 && recentChats.length > 0) {
if (visibleProjects.length > 0 && recentChats.length > 0) {
html += '</div>'; // close recent-section
} else if (projects.length > 0 && recentChats.length === 0) {
// Close the recent-section div we opened
} else if (visibleProjects.length > 0 && recentChats.length === 0) {
html += '</div>';
}