|
@@ -1,4 +1,4 @@
|
|
|
-import { ChangeDetectionStrategy, Component, HostListener, computed, inject, input, model, output, signal } from '@angular/core';
|
|
|
|
|
|
|
+import { ChangeDetectionStrategy, Component, ElementRef, HostListener, computed, inject, input, model, output, signal, viewChild } from '@angular/core';
|
|
|
import { isMatrixReady } from '../../../core/format';
|
|
import { isMatrixReady } from '../../../core/format';
|
|
|
import { ChatSessionService } from '../../../core/chat-session.service';
|
|
import { ChatSessionService } from '../../../core/chat-session.service';
|
|
|
import { LiveService } from '../../../core/live.service';
|
|
import { LiveService } from '../../../core/live.service';
|
|
@@ -9,193 +9,270 @@ import { MAvatarComponent } from '../m-avatar/m-avatar';
|
|
|
import { LockScrollDirective } from '../../directives/lock-scroll.directive';
|
|
import { LockScrollDirective } from '../../directives/lock-scroll.directive';
|
|
|
import { UiMToastService } from '../../../ui/mobile/components/toast/toast.service';
|
|
import { UiMToastService } from '../../../ui/mobile/components/toast/toast.service';
|
|
|
|
|
|
|
|
-/** 会话页里的项目快捷切换器。项目沿用现有工作区数据,不另建一层项目模型。 */
|
|
|
|
|
-/** 「未分类」虚拟分组的 id(承接所属项目已被删除的会话,不落库) */
|
|
|
|
|
-const ORPHAN_PROJECT_ID = '__orphan__';
|
|
|
|
|
-
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 会话页里的项目快捷切换器。
|
|
|
|
|
+ *
|
|
|
|
|
+ * ## 形态(2026-11-23 按豆包参考重做)
|
|
|
|
|
+ *
|
|
|
|
|
+ * ```
|
|
|
|
|
+ * ┌──────────────────────────────────┐ ← 输入框上方的胶囊行,可横向滚动
|
|
|
|
|
+ * │ [📁 硅胶材质外观产品 ▾] │ 当前项目:浅主色底;未选:虚线框「选择项目」
|
|
|
|
|
+ * │ [+] │ 一个新增按钮,贴在胶囊后面
|
|
|
|
|
+ * └──────────────────────────────────┘
|
|
|
|
|
+ * ↓ 点击
|
|
|
|
|
+ * ┌──────────────────────────────────┐ ← 底部圆角浮卡(不是全屏抽屉)
|
|
|
|
|
+ * │ ── ✕ │ 抓杆 + 右上圆形关闭
|
|
|
|
|
+ * │ 选择项目 │ 标题 17px 400,小标题灰字
|
|
|
|
|
+ * │ ┌──────────────────────────────┐ │
|
|
|
|
|
+ * │ │ 🔍 搜索项目 │ │ 6 个及以上才有搜索框
|
|
|
|
|
+ * │ └──────────────────────────────┘ │
|
|
|
|
|
+ * │ + 创建新项目 / 或卡内表单 │ 点「创建」→ 同一位置换成输入表单
|
|
|
|
|
+ * │ ──────────────────────────────── │
|
|
|
|
|
+ * │ [📁] 硅胶材质外观产品 ✓ │ 当前项目:整行主色浅底
|
|
|
|
|
+ * │ 3 条对话 · 10 分钟前 │
|
|
|
|
|
+ * │ [📁] 外壳 3D 设计 › │
|
|
|
|
|
+ * │ 12 条对话 · 昨天 │
|
|
|
|
|
+ * └──────────────────────────────────┘
|
|
|
|
|
+ * ```
|
|
|
|
|
+ *
|
|
|
|
|
+ * **为什么是一条胶囊而不是「当前项目 · 切换 ›」的细条**:
|
|
|
|
|
+ * 细条把「项目名」当成状态标签、把「切换」当成按钮,读起来是两件事;
|
|
|
|
|
+ * 胶囊把两者合成一个可点元素 —— 看到的就是可点的,省一次扫描。
|
|
|
|
|
+ *
|
|
|
|
|
+ * **为什么不再做「项目列表 → 对话列表」两级全屏抽屉**:
|
|
|
|
|
+ * 全屏抽屉占满屏幕、与输入区完全断开,切换完还得慢慢滑下来;
|
|
|
|
|
+ * 现在是**底部圆角浮卡**,贴住输入区,选中项目后在**同一张卡内**滑到
|
|
|
|
|
+ * 对话列表(顶部出现「‹ 返回」),卡片高度不变,视线不跳。
|
|
|
|
|
+ */
|
|
|
@Component({
|
|
@Component({
|
|
|
selector: 'app-m-project-switcher',
|
|
selector: 'app-m-project-switcher',
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
|
imports: [MAvatarComponent, LockScrollDirective],
|
|
imports: [MAvatarComponent, LockScrollDirective],
|
|
|
template: `
|
|
template: `
|
|
|
- <div class="m-project-entry">
|
|
|
|
|
- <span class="m-project-context">当前项目</span>
|
|
|
|
|
|
|
+ <!-- ① 入口:胶囊行(与输入区同一条水平带,横向滚动不换行) -->
|
|
|
|
|
+ <div class="mps-bar" role="list">
|
|
|
<button
|
|
<button
|
|
|
type="button"
|
|
type="button"
|
|
|
- class="m-project-trigger"
|
|
|
|
|
|
|
+ role="listitem"
|
|
|
|
|
+ class="mps-pill"
|
|
|
[class.is-set]="currentWorkspace()"
|
|
[class.is-set]="currentWorkspace()"
|
|
|
|
|
+ [class.is-empty]="!currentWorkspace()"
|
|
|
[attr.aria-expanded]="open()"
|
|
[attr.aria-expanded]="open()"
|
|
|
aria-controls="m-project-sheet"
|
|
aria-controls="m-project-sheet"
|
|
|
- aria-label="选择项目并切换对话"
|
|
|
|
|
|
|
+ [attr.aria-label]="currentWorkspace() ? '切换项目,当前为 ' + currentWorkspace()!.name : '选择项目'"
|
|
|
(click)="openPicker()"
|
|
(click)="openPicker()"
|
|
|
>
|
|
>
|
|
|
- <i class="fa-regular fa-folder-open" aria-hidden="true"></i>
|
|
|
|
|
- <span class="m-project-name">{{ currentWorkspace()?.name ?? '选择项目' }}</span>
|
|
|
|
|
- <span class="m-project-switch">切换</span>
|
|
|
|
|
- <i class="fa-solid fa-chevron-right m-project-chevron" aria-hidden="true"></i>
|
|
|
|
|
|
|
+ <i class="fa-regular" [class.fa-folder-open]="currentWorkspace()" [class.fa-folder]="!currentWorkspace()" aria-hidden="true"></i>
|
|
|
|
|
+ <span class="mps-pill-name">{{ currentWorkspace()?.name ?? '选择项目' }}</span>
|
|
|
|
|
+ @if (currentWorkspace()) {
|
|
|
|
|
+ <span class="mps-pill-count">{{ currentWorkspaceConversations() }}</span>
|
|
|
|
|
+ }
|
|
|
|
|
+ <i class="fa-solid fa-chevron-down mps-pill-chevron" aria-hidden="true"></i>
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+ <!-- ② 弹层:底部圆角浮卡 -->
|
|
|
@if (open()) {
|
|
@if (open()) {
|
|
|
- <div class="m-project-root" role="dialog" aria-modal="true" [attr.aria-label]="step() === 'projects' ? '选择项目' : selectedWorkspace()?.name" [appLockScroll]="true" (keydown.escape)="close()">
|
|
|
|
|
- <button type="button" class="m-project-mask" aria-label="关闭项目选择" (click)="close()"></button>
|
|
|
|
|
- <section class="m-project-sheet" id="m-project-sheet">
|
|
|
|
|
- <div class="m-project-grabber" aria-hidden="true"></div>
|
|
|
|
|
- <header class="m-project-head">
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="mps-root"
|
|
|
|
|
+ role="dialog"
|
|
|
|
|
+ aria-modal="true"
|
|
|
|
|
+ [attr.aria-label]="step() === 'projects' ? '选择项目' : selectedWorkspace()?.name"
|
|
|
|
|
+ [appLockScroll]="true"
|
|
|
|
|
+ (keydown.escape)="close()"
|
|
|
|
|
+ >
|
|
|
|
|
+ <button type="button" class="mps-mask" aria-label="关闭项目选择" (click)="close()"></button>
|
|
|
|
|
+ <section class="mps-card" id="m-project-sheet">
|
|
|
|
|
+ <div class="mps-grabber" aria-hidden="true"></div>
|
|
|
|
|
+ <button type="button" class="mps-close" aria-label="关闭" (click)="close()">
|
|
|
|
|
+ <i class="fa-solid fa-xmark" aria-hidden="true"></i>
|
|
|
|
|
+ </button>
|
|
|
|
|
+
|
|
|
|
|
+ <header class="mps-head">
|
|
|
@if (step() === 'sessions') {
|
|
@if (step() === 'sessions') {
|
|
|
- <button type="button" class="m-project-back" aria-label="返回项目列表" (click)="showProjects()">
|
|
|
|
|
- <i class="fa-solid fa-arrow-left" aria-hidden="true"></i>
|
|
|
|
|
|
|
+ <button type="button" class="mps-back" aria-label="返回项目列表" (click)="showProjects()">
|
|
|
|
|
+ <i class="fa-solid fa-chevron-left" aria-hidden="true"></i>
|
|
|
</button>
|
|
</button>
|
|
|
}
|
|
}
|
|
|
- <div class="m-project-head-copy">
|
|
|
|
|
|
|
+ <div class="mps-head-copy">
|
|
|
<h2>{{ step() === 'projects' ? '选择项目' : selectedWorkspace()?.name }}</h2>
|
|
<h2>{{ step() === 'projects' ? '选择项目' : selectedWorkspace()?.name }}</h2>
|
|
|
- <p>{{ step() === 'projects' ? '按项目查看和继续最近的对话' : '选择一条对话继续,或在此项目中新建' }}</p>
|
|
|
|
|
|
|
+ <!-- 副标题放**实时有效的数字**,不放「选一个项目继续」这类废话 -->
|
|
|
|
|
+ <p>
|
|
|
|
|
+ @if (step() === 'projects') {
|
|
|
|
|
+ {{ realProjectCount() }} 个项目 · 当前 {{ currentWorkspace()?.name ?? '无' }}
|
|
|
|
|
+ } @else {
|
|
|
|
|
+ {{ selectedWorkspaceRows().length }} 条对话
|
|
|
|
|
+ }
|
|
|
|
|
+ </p>
|
|
|
</div>
|
|
</div>
|
|
|
- <button type="button" class="m-project-close" aria-label="关闭" (click)="close()">
|
|
|
|
|
- <i class="fa-solid fa-xmark" aria-hidden="true"></i>
|
|
|
|
|
- </button>
|
|
|
|
|
</header>
|
|
</header>
|
|
|
|
|
|
|
|
- <label class="m-project-search">
|
|
|
|
|
- <i class="fa-solid fa-magnifying-glass" aria-hidden="true"></i>
|
|
|
|
|
- <input
|
|
|
|
|
- type="search"
|
|
|
|
|
- [value]="query()"
|
|
|
|
|
- [placeholder]="step() === 'projects' ? '搜索项目' : '搜索此项目的对话'"
|
|
|
|
|
- [attr.aria-label]="step() === 'projects' ? '搜索项目' : '搜索项目内对话'"
|
|
|
|
|
- (input)="query.set($any($event.target).value)"
|
|
|
|
|
- />
|
|
|
|
|
- @if (query()) {
|
|
|
|
|
- <button type="button" aria-label="清除搜索" (click)="query.set('')">
|
|
|
|
|
- <i class="fa-solid fa-xmark" aria-hidden="true"></i>
|
|
|
|
|
- </button>
|
|
|
|
|
|
|
+ @if (step() === 'projects') {
|
|
|
|
|
+ @if (showSearch()) {
|
|
|
|
|
+ <label class="mps-search">
|
|
|
|
|
+ <i class="fa-solid fa-magnifying-glass" aria-hidden="true"></i>
|
|
|
|
|
+ <input
|
|
|
|
|
+ type="search"
|
|
|
|
|
+ [value]="query()"
|
|
|
|
|
+ placeholder="搜索项目"
|
|
|
|
|
+ aria-label="搜索项目"
|
|
|
|
|
+ (input)="query.set($any($event.target).value)"
|
|
|
|
|
+ />
|
|
|
|
|
+ @if (query()) {
|
|
|
|
|
+ <button type="button" aria-label="清除搜索" (click)="query.set('')">
|
|
|
|
|
+ <i class="fa-solid fa-xmark" aria-hidden="true"></i>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ }
|
|
|
|
|
+ </label>
|
|
|
}
|
|
}
|
|
|
- </label>
|
|
|
|
|
-
|
|
|
|
|
- <div class="m-project-list">
|
|
|
|
|
- @if (step() === 'projects') {
|
|
|
|
|
- @if (!creatingProject()) {
|
|
|
|
|
- <button type="button" class="m-project-create" (click)="createProject()">
|
|
|
|
|
- <span class="m-project-create-icon"><i class="fa-solid fa-plus" aria-hidden="true"></i></span>
|
|
|
|
|
- <span><b>创建新项目</b><small>将相关对话集中在一起</small></span>
|
|
|
|
|
- <i class="fa-solid fa-chevron-right" aria-hidden="true"></i>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 创建:与项目行同高同节奏,只是图标换成主色圆底加号;展开后原地换成表单 -->
|
|
|
|
|
+ @if (!creatingProject()) {
|
|
|
|
|
+ <div class="mps-list mps-list-first">
|
|
|
|
|
+ <button type="button" class="mps-row mps-create-row" (click)="beginCreate()">
|
|
|
|
|
+ <span class="mps-icon is-create"><i class="fa-solid fa-plus" aria-hidden="true"></i></span>
|
|
|
|
|
+ <span class="mps-row-copy">
|
|
|
|
|
+ <b>创建新项目</b>
|
|
|
|
|
+ <small>把相关对话归在一起</small>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <i class="fa-solid fa-chevron-right mps-row-chevron" aria-hidden="true"></i>
|
|
|
</button>
|
|
</button>
|
|
|
- } @else {
|
|
|
|
|
- <div class="m-project-form">
|
|
|
|
|
- <label for="m-new-project-name">项目名称</label>
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
+ } @else {
|
|
|
|
|
+ <div class="mps-form">
|
|
|
|
|
+ <div class="mps-form-field">
|
|
|
|
|
+ <i class="fa-regular fa-folder" aria-hidden="true"></i>
|
|
|
<input
|
|
<input
|
|
|
|
|
+ #createInput
|
|
|
id="m-new-project-name"
|
|
id="m-new-project-name"
|
|
|
type="text"
|
|
type="text"
|
|
|
maxlength="24"
|
|
maxlength="24"
|
|
|
autocomplete="off"
|
|
autocomplete="off"
|
|
|
|
|
+ aria-label="项目名称"
|
|
|
[value]="newProjectName()"
|
|
[value]="newProjectName()"
|
|
|
- placeholder="例如:外壳 3D 设计"
|
|
|
|
|
|
|
+ placeholder="输入项目名称"
|
|
|
(input)="newProjectName.set($any($event.target).value)"
|
|
(input)="newProjectName.set($any($event.target).value)"
|
|
|
(keydown.enter)="confirmProjectCreation()"
|
|
(keydown.enter)="confirmProjectCreation()"
|
|
|
(keydown.escape)="$event.stopPropagation(); cancelProjectCreation()"
|
|
(keydown.escape)="$event.stopPropagation(); cancelProjectCreation()"
|
|
|
/>
|
|
/>
|
|
|
- @if (projectNameTaken()) {
|
|
|
|
|
- <p role="alert">已有同名项目,请换一个名称</p>
|
|
|
|
|
- }
|
|
|
|
|
- <div class="m-project-form-actions">
|
|
|
|
|
- <button type="button" class="m-project-cancel" (click)="cancelProjectCreation()">取消</button>
|
|
|
|
|
- <button type="button" class="m-project-confirm" [disabled]="!newProjectName().trim() || projectNameTaken()" (click)="confirmProjectCreation()">创建项目</button>
|
|
|
|
|
- </div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
- }
|
|
|
|
|
|
|
+ @if (projectNameTaken()) {
|
|
|
|
|
+ <p class="mps-form-error" role="alert">已有同名项目,请换一个名称</p>
|
|
|
|
|
+ }
|
|
|
|
|
+ <div class="mps-form-actions">
|
|
|
|
|
+ <button type="button" class="mps-btn-ghost" (click)="cancelProjectCreation()">取消</button>
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ class="mps-btn-primary"
|
|
|
|
|
+ [disabled]="!newProjectName().trim() || projectNameTaken()"
|
|
|
|
|
+ (click)="confirmProjectCreation()"
|
|
|
|
|
+ >
|
|
|
|
|
+ 创建项目
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ <div class="mps-list">
|
|
|
@for (project of filteredProjects(); track project.id) {
|
|
@for (project of filteredProjects(); track project.id) {
|
|
|
- <button type="button" class="m-project-row" [class.is-current]="project.id === currentWorkspaceId()" (click)="selectProject(project.id)">
|
|
|
|
|
- <span class="m-project-folder"><i class="fa-regular fa-folder" aria-hidden="true"></i></span>
|
|
|
|
|
- <span class="m-project-row-copy"><b>{{ project.name }}</b><small>{{ project.rows.length }} 条对话</small></span>
|
|
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ class="mps-row"
|
|
|
|
|
+ [class.is-current]="project.id === currentWorkspaceId()"
|
|
|
|
|
+ [class.is-orphan]="project.orphan"
|
|
|
|
|
+ (click)="selectProject(project.id)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <span class="mps-icon">
|
|
|
|
|
+ <i [class]="project.orphan ? 'fa-solid fa-box-archive' : 'fa-regular fa-folder'" aria-hidden="true"></i>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span class="mps-row-copy">
|
|
|
|
|
+ <b>{{ project.name }}</b>
|
|
|
|
|
+ <small>{{ projectSubtitle(project) }}</small>
|
|
|
|
|
+ </span>
|
|
|
@if (project.id === currentWorkspaceId()) {
|
|
@if (project.id === currentWorkspaceId()) {
|
|
|
- <span class="m-project-current">当前</span>
|
|
|
|
|
|
|
+ <i class="fa-solid fa-check mps-current" aria-label="当前项目"></i>
|
|
|
|
|
+ } @else {
|
|
|
|
|
+ <i class="fa-solid fa-chevron-right mps-row-chevron" aria-hidden="true"></i>
|
|
|
}
|
|
}
|
|
|
- <i class="fa-solid fa-chevron-right m-project-row-chevron" aria-hidden="true"></i>
|
|
|
|
|
</button>
|
|
</button>
|
|
|
} @empty {
|
|
} @empty {
|
|
|
- <div class="m-project-empty">
|
|
|
|
|
|
|
+ <div class="mps-empty">
|
|
|
<i class="fa-regular fa-folder-open" aria-hidden="true"></i>
|
|
<i class="fa-regular fa-folder-open" aria-hidden="true"></i>
|
|
|
<b>{{ query() ? '没有匹配的项目' : '还没有项目' }}</b>
|
|
<b>{{ query() ? '没有匹配的项目' : '还没有项目' }}</b>
|
|
|
- <span>{{ query() ? '换个名称试试' : '创建项目后,把相关对话归在一起' }}</span>
|
|
|
|
|
|
|
+ <span>{{ query() ? '换个名称试试' : '点上方「创建新项目」开始' }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
}
|
|
}
|
|
|
- } @else if (selectedWorkspace(); as project) {
|
|
|
|
|
- @if (project.orphan) {
|
|
|
|
|
- <!-- 未分类:只能查看/继续对话;不能往里放新会话,也不能"在其中新建" -->
|
|
|
|
|
- <div class="m-project-load-note" role="status">
|
|
|
|
|
- <i class="fa-solid fa-circle-info" aria-hidden="true"></i>
|
|
|
|
|
- <span>这些对话所属的项目已被删除。点开可继续对话,也可用左侧「⋯」把它们移到其它项目。</span>
|
|
|
|
|
- </div>
|
|
|
|
|
- } @else {
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
+ } @else if (selectedWorkspace(); as project) {
|
|
|
|
|
+ @if (project.orphan) {
|
|
|
|
|
+ <div class="mps-note" role="status">
|
|
|
|
|
+ <i class="fa-solid fa-circle-info" aria-hidden="true"></i>
|
|
|
|
|
+ <span>这些对话所属的项目已被删除。点开可继续对话,也可用左侧「⋯」把它们移到其它项目。</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ } @else {
|
|
|
|
|
+ <div class="mps-actions">
|
|
|
@if (currentSessionId() && currentWorkspaceId() !== project.id) {
|
|
@if (currentSessionId() && currentWorkspaceId() !== project.id) {
|
|
|
- <button type="button" class="m-project-move" (click)="moveCurrentConversation(project.id)">
|
|
|
|
|
|
|
+ <button type="button" class="mps-action" (click)="moveCurrentConversation(project.id)">
|
|
|
<i class="fa-solid fa-folder-open" aria-hidden="true"></i>
|
|
<i class="fa-solid fa-folder-open" aria-hidden="true"></i>
|
|
|
- <span>将当前对话移入此项目</span>
|
|
|
|
|
|
|
+ <span>移入此项目</span>
|
|
|
</button>
|
|
</button>
|
|
|
}
|
|
}
|
|
|
- <button type="button" class="m-project-new-chat" (click)="startConversation(project.id)">
|
|
|
|
|
|
|
+ <button type="button" class="mps-action is-primary" (click)="startConversation(project.id)">
|
|
|
<i class="fa-solid fa-plus" aria-hidden="true"></i>
|
|
<i class="fa-solid fa-plus" aria-hidden="true"></i>
|
|
|
- <span>在此项目中新建对话</span>
|
|
|
|
|
- <i class="fa-solid fa-arrow-up-right-from-square" aria-hidden="true"></i>
|
|
|
|
|
|
|
+ <span>新建对话</span>
|
|
|
</button>
|
|
</button>
|
|
|
- }
|
|
|
|
|
- @if (sessionLoadIssue() === 'partial' || sessionLoadIssue() === 'timeout' || sessionLoadIssue() === 'error') {
|
|
|
|
|
- <div class="m-project-load-note" role="status">
|
|
|
|
|
- <i class="fa-solid fa-circle-info" aria-hidden="true"></i>
|
|
|
|
|
- <span>{{ sessionLoadIssue() === 'partial' ? '部分数字生命的对话暂未加载。' : sessionLoadIssue() === 'timeout' ? '同步时间较长,列表可能还不完整。' : '对话同步暂时失败,当前列表可能不完整。' }}</span>
|
|
|
|
|
- <button type="button" class="m-project-retry" [disabled]="loadingSessions()" (click)="loadSessions()">重试</button>
|
|
|
|
|
- </div>
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
+ }
|
|
|
|
|
+ @if (sessionLoadIssue() === 'partial' || sessionLoadIssue() === 'timeout' || sessionLoadIssue() === 'error') {
|
|
|
|
|
+ <div class="mps-note" role="status">
|
|
|
|
|
+ <i class="fa-solid fa-circle-info" aria-hidden="true"></i>
|
|
|
|
|
+ <span>{{ sessionLoadIssue() === 'partial' ? '部分数字生命的对话暂未加载。' : sessionLoadIssue() === 'timeout' ? '同步时间较长,列表可能还不完整。' : '对话同步暂时失败,当前列表可能不完整。' }}</span>
|
|
|
|
|
+ <button type="button" class="mps-note-retry" [disabled]="loadingSessions()" (click)="loadSessions()">重试</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ }
|
|
|
|
|
+ <div class="mps-list">
|
|
|
@for (row of filteredSessions(); track row.session.id) {
|
|
@for (row of filteredSessions(); track row.session.id) {
|
|
|
- <button type="button" class="m-project-session" (click)="pickSession(row)">
|
|
|
|
|
|
|
+ <button type="button" class="mps-row mps-row-session" (click)="pickSession(row)">
|
|
|
<app-m-avatar [name]="row.agent?.name ?? '?'"></app-m-avatar>
|
|
<app-m-avatar [name]="row.agent?.name ?? '?'"></app-m-avatar>
|
|
|
- <span class="m-project-session-copy">
|
|
|
|
|
|
|
+ <span class="mps-row-copy">
|
|
|
<b>{{ row.session.title || '新对话' }}</b>
|
|
<b>{{ row.session.title || '新对话' }}</b>
|
|
|
<small>{{ row.agent?.name ?? '未知数字生命' }} · {{ row.session.lastPreview || '暂无消息' }}</small>
|
|
<small>{{ row.agent?.name ?? '未知数字生命' }} · {{ row.session.lastPreview || '暂无消息' }}</small>
|
|
|
</span>
|
|
</span>
|
|
|
- <span class="m-project-session-side">
|
|
|
|
|
|
|
+ <span class="mps-row-side">
|
|
|
<small>{{ relTime(row) }}</small>
|
|
<small>{{ relTime(row) }}</small>
|
|
|
- @if (row.unread > 0) { <span class="m-project-unread">{{ row.unread > 99 ? '99+' : row.unread }}</span> }
|
|
|
|
|
|
|
+ @if (row.unread > 0) { <span class="mps-unread">{{ row.unread > 99 ? '99+' : row.unread }}</span> }
|
|
|
</span>
|
|
</span>
|
|
|
</button>
|
|
</button>
|
|
|
} @empty {
|
|
} @empty {
|
|
|
- <div class="m-project-empty">
|
|
|
|
|
|
|
+ <div class="mps-empty">
|
|
|
@if (loadingSessions()) {
|
|
@if (loadingSessions()) {
|
|
|
<i class="fa-solid fa-spinner fa-spin" aria-hidden="true"></i>
|
|
<i class="fa-solid fa-spinner fa-spin" aria-hidden="true"></i>
|
|
|
- <b>正在查找项目对话</b>
|
|
|
|
|
|
|
+ <b>正在查找对话</b>
|
|
|
<span>同步完成后会显示所有数字生命的对话</span>
|
|
<span>同步完成后会显示所有数字生命的对话</span>
|
|
|
} @else if (sessionLoadIssue() === 'error') {
|
|
} @else if (sessionLoadIssue() === 'error') {
|
|
|
<i class="fa-solid fa-triangle-exclamation" aria-hidden="true"></i>
|
|
<i class="fa-solid fa-triangle-exclamation" aria-hidden="true"></i>
|
|
|
<b>对话暂时没能加载</b>
|
|
<b>对话暂时没能加载</b>
|
|
|
<span>网络恢复后可以重试;也可以先在此项目中新建对话</span>
|
|
<span>网络恢复后可以重试;也可以先在此项目中新建对话</span>
|
|
|
- <button type="button" class="m-project-retry" [disabled]="loadingSessions()" (click)="loadSessions()">重试加载</button>
|
|
|
|
|
|
|
+ <button type="button" class="mps-note-retry" [disabled]="loadingSessions()" (click)="loadSessions()">重试加载</button>
|
|
|
} @else if (sessionLoadIssue() === 'partial') {
|
|
} @else if (sessionLoadIssue() === 'partial') {
|
|
|
<i class="fa-solid fa-circle-info" aria-hidden="true"></i>
|
|
<i class="fa-solid fa-circle-info" aria-hidden="true"></i>
|
|
|
<b>还有一些对话暂未加载</b>
|
|
<b>还有一些对话暂未加载</b>
|
|
|
<span>当前项目可能仍有未显示的对话</span>
|
|
<span>当前项目可能仍有未显示的对话</span>
|
|
|
- <button type="button" class="m-project-retry" [disabled]="loadingSessions()" (click)="loadSessions()">重试加载</button>
|
|
|
|
|
|
|
+ <button type="button" class="mps-note-retry" [disabled]="loadingSessions()" (click)="loadSessions()">重试加载</button>
|
|
|
} @else if (sessionLoadIssue() === 'timeout') {
|
|
} @else if (sessionLoadIssue() === 'timeout') {
|
|
|
<i class="fa-solid fa-clock" aria-hidden="true"></i>
|
|
<i class="fa-solid fa-clock" aria-hidden="true"></i>
|
|
|
<b>同步时间较长</b>
|
|
<b>同步时间较长</b>
|
|
|
<span>可以重试;新建对话会直接归入此项目</span>
|
|
<span>可以重试;新建对话会直接归入此项目</span>
|
|
|
- <button type="button" class="m-project-retry" [disabled]="loadingSessions()" (click)="loadSessions()">重试加载</button>
|
|
|
|
|
|
|
+ <button type="button" class="mps-note-retry" [disabled]="loadingSessions()" (click)="loadSessions()">重试加载</button>
|
|
|
} @else {
|
|
} @else {
|
|
|
<i class="fa-regular fa-comments" aria-hidden="true"></i>
|
|
<i class="fa-regular fa-comments" aria-hidden="true"></i>
|
|
|
- <b>{{ query() ? '没有匹配的对话' : '这个项目还没有对话' }}</b>
|
|
|
|
|
- <span>{{ query() ? '换个标题或数字生命名称试试' : '在上方新建对话,新建后会自动归入此项目' }}</span>
|
|
|
|
|
|
|
+ <b>这个项目还没有对话</b>
|
|
|
|
|
+ <span>点上方「新建对话」,新建后会自动归入这里</span>
|
|
|
}
|
|
}
|
|
|
</div>
|
|
</div>
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- </div>
|
|
|
|
|
- <footer class="m-project-foot">
|
|
|
|
|
- @if (step() === 'projects') {
|
|
|
|
|
- <span>{{ realProjectCount() }} 个项目</span>
|
|
|
|
|
- } @else {
|
|
|
|
|
- <span>{{ selectedWorkspaceRows().length }} 条对话</span>
|
|
|
|
|
- }
|
|
|
|
|
- <button type="button" class="m-project-done" (click)="close()">完成</button>
|
|
|
|
|
- </footer>
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
+ }
|
|
|
</section>
|
|
</section>
|
|
|
</div>
|
|
</div>
|
|
|
}
|
|
}
|
|
@@ -203,98 +280,394 @@ const ORPHAN_PROJECT_ID = '__orphan__';
|
|
|
styles: [
|
|
styles: [
|
|
|
`
|
|
`
|
|
|
:host { display: block; }
|
|
:host { display: block; }
|
|
|
- .m-project-entry {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /* ---------- 入口胶囊行 ---------- */
|
|
|
|
|
+ .mps-bar {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
gap: var(--sp-2);
|
|
gap: var(--sp-2);
|
|
|
- margin: 0 var(--mob-gutter) var(--sp-2);
|
|
|
|
|
- min-width: 0;
|
|
|
|
|
|
|
+ padding: 0 var(--mob-gutter) var(--sp-2);
|
|
|
|
|
+ overflow-x: auto;
|
|
|
|
|
+ scrollbar-width: none;
|
|
|
}
|
|
}
|
|
|
- .m-project-context { flex: none; color: var(--muted); font-size: var(--fs-12); }
|
|
|
|
|
- .m-project-trigger {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- flex: 1;
|
|
|
|
|
|
|
+ .mps-bar::-webkit-scrollbar { display: none; }
|
|
|
|
|
+ .mps-pill {
|
|
|
|
|
+ display: inline-flex;
|
|
|
|
|
+ flex: none;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
- gap: var(--sp-2);
|
|
|
|
|
- min-width: 0;
|
|
|
|
|
- min-height: 44px;
|
|
|
|
|
|
|
+ gap: 6px;
|
|
|
|
|
+ max-width: 68vw;
|
|
|
|
|
+ min-height: 36px;
|
|
|
padding: 0 var(--sp-3);
|
|
padding: 0 var(--sp-3);
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
border: 1px solid var(--edge);
|
|
border: 1px solid var(--edge);
|
|
|
border-radius: var(--r-tag);
|
|
border-radius: var(--r-tag);
|
|
|
background: var(--surface);
|
|
background: var(--surface);
|
|
|
color: var(--ink-2);
|
|
color: var(--ink-2);
|
|
|
font: inherit;
|
|
font: inherit;
|
|
|
font-size: var(--fs-13);
|
|
font-size: var(--fs-13);
|
|
|
|
|
+ line-height: 1;
|
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
|
|
+ transition: background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
|
|
|
|
|
+ -webkit-tap-highlight-color: transparent;
|
|
|
}
|
|
}
|
|
|
- .m-project-trigger.is-set { border-color: color-mix(in srgb, var(--primary) 35%, var(--edge)); color: var(--primary); }
|
|
|
|
|
- .m-project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
|
|
|
- .m-project-switch { flex: none; color: var(--muted); font-size: var(--fs-11); }
|
|
|
|
|
- .m-project-chevron { color: var(--muted); font-size: var(--fs-10); }
|
|
|
|
|
- .m-project-root { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: flex-end; }
|
|
|
|
|
- .m-project-mask { position: absolute; inset: 0; border: 0; background: var(--overlay); }
|
|
|
|
|
- .m-project-sheet {
|
|
|
|
|
|
|
+ .mps-pill:active { background: var(--surface-active); }
|
|
|
|
|
+ .mps-pill:focus-visible { outline: 2px solid var(--primary-ring); outline-offset: 2px; }
|
|
|
|
|
+ .mps-pill.is-set {
|
|
|
|
|
+ border-color: transparent;
|
|
|
|
|
+ background: var(--primary-subtle);
|
|
|
|
|
+ color: var(--primary);
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-pill.is-set:active { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); }
|
|
|
|
|
+ .mps-pill.is-empty { border-style: dashed; color: var(--muted); }
|
|
|
|
|
+ .mps-pill-name {
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-pill-count {
|
|
|
|
|
+ flex: none;
|
|
|
|
|
+ min-width: 18px;
|
|
|
|
|
+ padding: 1px 6px;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+ border-radius: var(--r-tag);
|
|
|
|
|
+ background: color-mix(in srgb, var(--primary) 16%, transparent);
|
|
|
|
|
+ color: var(--primary);
|
|
|
|
|
+ font-size: var(--fs-10);
|
|
|
|
|
+ font-variant-numeric: tabular-nums;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-pill-chevron { flex: none; font-size: 9px; opacity: .7; }
|
|
|
|
|
+
|
|
|
|
|
+ /* ---------- 弹层外壳 ---------- */
|
|
|
|
|
+ .mps-root { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: flex-end; }
|
|
|
|
|
+ .mps-mask { position: absolute; inset: 0; border: 0; background: var(--overlay); }
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 高度随内容(2026-11-23 统一):项目少时卡片自然变矮、贴着输入区,
|
|
|
|
|
+ * 不再强行撑到 76dvh 留一大片空白;超出 max-height 才滚动,且只有列表滚。
|
|
|
|
|
+ *
|
|
|
|
|
+ * 高度用 min-height 保底,让「项目 → 对话」两级切换时卡片不会忽高忽低。
|
|
|
|
|
+ */
|
|
|
|
|
+ .mps-card {
|
|
|
position: relative;
|
|
position: relative;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
- height: min(calc(88dvh - var(--mob-safe-bottom)), 760px);
|
|
|
|
|
- max-height: 100%;
|
|
|
|
|
- min-height: 0;
|
|
|
|
|
- padding: var(--sp-2) 0 calc(var(--sp-2) + var(--mob-safe-bottom));
|
|
|
|
|
|
|
+ height: auto;
|
|
|
|
|
+ min-height: min(40dvh, 340px);
|
|
|
|
|
+ max-height: min(76dvh, 640px);
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ padding: var(--sp-2) 0 calc(var(--sp-3) + var(--mob-safe-bottom));
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
|
- border-radius: var(--r-lg) var(--r-lg) 0 0;
|
|
|
|
|
|
|
+ border-radius: var(--r-sheet) var(--r-sheet) 0 0;
|
|
|
background: var(--surface);
|
|
background: var(--surface);
|
|
|
box-shadow: var(--shadow-overlay);
|
|
box-shadow: var(--shadow-overlay);
|
|
|
- animation: project-sheet-in var(--motion-panel) var(--ease-standard);
|
|
|
|
|
|
|
+ animation: mps-card-in var(--motion-panel) var(--ease-standard);
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-grabber { flex: none; width: 36px; height: 4px; margin: 0 auto var(--sp-1); border-radius: var(--r-tag); background: var(--edge-strong); }
|
|
|
|
|
+ .mps-close {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: var(--sp-4);
|
|
|
|
|
+ right: var(--sp-3);
|
|
|
|
|
+ display: grid;
|
|
|
|
|
+ place-items: center;
|
|
|
|
|
+ width: 32px;
|
|
|
|
|
+ height: 32px;
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ border: 0;
|
|
|
|
|
+ border-radius: var(--r-tag);
|
|
|
|
|
+ background: var(--surface-2);
|
|
|
|
|
+ color: var(--muted);
|
|
|
|
|
+ font-size: var(--fs-13);
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-close:active { background: var(--surface-active); }
|
|
|
|
|
+
|
|
|
|
|
+ /* ---------- 标题 ---------- */
|
|
|
|
|
+ .mps-head {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex: none;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: var(--sp-2);
|
|
|
|
|
+ /* 右侧给关闭按钮留位;底部间距比顶部大,把标题和列表分开 */
|
|
|
|
|
+ padding: var(--sp-2) calc(var(--touch-min) + var(--sp-3)) var(--sp-4) var(--mob-gutter);
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-head-copy { flex: 1; min-width: 0; }
|
|
|
|
|
+ .mps-head h2 {
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ margin: 0;
|
|
|
|
|
+ color: var(--ink);
|
|
|
|
|
+ font-size: var(--fs-17);
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ letter-spacing: -0.01em;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-head p {
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ margin: var(--sp-1) 0 0;
|
|
|
|
|
+ color: var(--muted);
|
|
|
|
|
+ font-size: var(--fs-12);
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-back {
|
|
|
|
|
+ display: grid;
|
|
|
|
|
+ flex: none;
|
|
|
|
|
+ place-items: center;
|
|
|
|
|
+ width: 32px;
|
|
|
|
|
+ height: 32px;
|
|
|
|
|
+ margin-left: calc(-1 * var(--sp-2));
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ border: 0;
|
|
|
|
|
+ border-radius: var(--r-tag);
|
|
|
|
|
+ background: transparent;
|
|
|
|
|
+ color: var(--ink-2);
|
|
|
|
|
+ font-size: var(--fs-13);
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* ---------- 搜索 ---------- */
|
|
|
|
|
+ .mps-search {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex: none;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: var(--sp-2);
|
|
|
|
|
+ min-height: 40px;
|
|
|
|
|
+ margin: 0 var(--mob-gutter) var(--sp-2);
|
|
|
|
|
+ padding: 0 var(--sp-3);
|
|
|
|
|
+ border-radius: var(--r-md);
|
|
|
|
|
+ background: var(--canvas);
|
|
|
|
|
+ color: var(--faint);
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-search input {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ width: 0;
|
|
|
|
|
+ min-height: 40px;
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ border: 0;
|
|
|
|
|
+ outline: 0;
|
|
|
|
|
+ background: transparent;
|
|
|
|
|
+ color: var(--ink);
|
|
|
|
|
+ font: inherit;
|
|
|
|
|
+ font-size: var(--fs-14);
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-search input::placeholder { color: var(--faint); }
|
|
|
|
|
+ .mps-search button {
|
|
|
|
|
+ display: grid;
|
|
|
|
|
+ flex: none;
|
|
|
|
|
+ place-items: center;
|
|
|
|
|
+ width: 28px;
|
|
|
|
|
+ height: 28px;
|
|
|
|
|
+ border: 0;
|
|
|
|
|
+ border-radius: var(--r-tag);
|
|
|
|
|
+ background: transparent;
|
|
|
|
|
+ color: var(--muted);
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* ---------- 创建 ---------- */
|
|
|
|
|
+ .mps-form {
|
|
|
|
|
+ display: grid;
|
|
|
|
|
+ flex: none;
|
|
|
|
|
+ gap: var(--sp-2);
|
|
|
|
|
+ margin: 0 var(--mob-gutter) var(--sp-2);
|
|
|
|
|
+ padding: var(--sp-3);
|
|
|
|
|
+ border-radius: var(--r-md);
|
|
|
|
|
+ background: var(--canvas);
|
|
|
}
|
|
}
|
|
|
- .m-project-grabber { flex: none; width: 36px; height: 4px; margin: 0 auto var(--sp-2); border-radius: var(--r-tag); background: var(--edge-strong); }
|
|
|
|
|
- .m-project-head { display: flex; flex: none; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--mob-gutter) var(--sp-3); }
|
|
|
|
|
- .m-project-head-copy { flex: 1; min-width: 0; }
|
|
|
|
|
- .m-project-head h2 { overflow: hidden; margin: 0; color: var(--ink); font-size: var(--fs-17); text-overflow: ellipsis; white-space: nowrap; }
|
|
|
|
|
- .m-project-head p { overflow: hidden; margin: var(--sp-1) 0 0; color: var(--muted); font-size: var(--fs-12); text-overflow: ellipsis; white-space: nowrap; }
|
|
|
|
|
- .m-project-back, .m-project-close { display: grid; flex: none; place-items: center; width: var(--touch-min); height: var(--touch-min); padding: 0; border: 0; border-radius: var(--r-tag); background: transparent; color: var(--ink-2); font-size: var(--fs-16); cursor: pointer; }
|
|
|
|
|
- .m-project-close { color: var(--muted); }
|
|
|
|
|
- .m-project-search { display: flex; flex: none; align-items: center; gap: var(--sp-2); min-height: 44px; margin: 0 var(--mob-gutter) var(--sp-3); padding: 0 var(--sp-3); border: 1px solid var(--edge); border-radius: var(--r-md); background: var(--canvas); color: var(--muted); }
|
|
|
|
|
- .m-project-search input { flex: 1; width: 0; min-height: 44px; padding: var(--sp-2) 0; box-sizing: border-box; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: var(--fs-14); }
|
|
|
|
|
- .m-project-search input::placeholder { color: var(--muted); }
|
|
|
|
|
- .m-project-search button { display: grid; flex: none; place-items: center; width: var(--touch-min); height: var(--touch-min); border: 0; border-radius: var(--r-tag); background: transparent; color: var(--muted); }
|
|
|
|
|
- .m-project-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--mob-gutter); }
|
|
|
|
|
- .m-project-create, .m-project-row, .m-project-session, .m-project-new-chat { display: flex; align-items: center; width: 100%; box-sizing: border-box; text-align: left; font: inherit; cursor: pointer; }
|
|
|
|
|
- .m-project-create { gap: var(--sp-3); min-height: 68px; padding: var(--sp-2) var(--sp-3); border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--edge)); border-radius: var(--r-md); background: var(--primary-subtle); color: var(--ink); }
|
|
|
|
|
- .m-project-create-icon, .m-project-folder { display: grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--surface); color: var(--primary); font-size: var(--fs-16); }
|
|
|
|
|
- .m-project-form { display: grid; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--edge); border-radius: var(--r-md); background: var(--canvas); }
|
|
|
|
|
- .m-project-form label { color: var(--ink-2); font-size: var(--fs-13); font-weight: 600; }
|
|
|
|
|
- .m-project-form input { width: 100%; min-height: 44px; padding: 0 var(--sp-3); box-sizing: border-box; border: 1px solid var(--edge); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-14); }
|
|
|
|
|
- .m-project-form input:focus { border-color: var(--primary); outline: 2px solid color-mix(in srgb, var(--primary) 18%, transparent); }
|
|
|
|
|
- .m-project-form p { margin: 0; color: var(--danger); font-size: var(--fs-12); }
|
|
|
|
|
- .m-project-form-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }
|
|
|
|
|
- .m-project-cancel, .m-project-confirm { min-width: 76px; min-height: var(--touch-min); padding: 0 var(--sp-3); border: 0; border-radius: var(--r-sm); font: inherit; font-size: var(--fs-13); cursor: pointer; }
|
|
|
|
|
- .m-project-cancel { background: var(--surface); color: var(--ink-2); }
|
|
|
|
|
- .m-project-confirm { background: var(--primary); color: var(--primary-content); font-weight: 600; }
|
|
|
|
|
- .m-project-confirm:disabled { cursor: not-allowed; opacity: .5; }
|
|
|
|
|
- .m-project-create > span:nth-child(2), .m-project-row-copy { display: grid; flex: 1; min-width: 0; gap: 3px; }
|
|
|
|
|
- .m-project-create b, .m-project-row b, .m-project-session b { overflow: hidden; color: var(--ink); font-size: var(--fs-14); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
|
|
|
|
|
- .m-project-create small, .m-project-row small, .m-project-session small { overflow: hidden; color: var(--muted); font-size: var(--fs-12); text-overflow: ellipsis; white-space: nowrap; }
|
|
|
|
|
- .m-project-create > i, .m-project-row-chevron { flex: none; color: var(--muted); font-size: var(--fs-11); }
|
|
|
|
|
- .m-project-row { gap: var(--sp-3); min-height: 64px; padding: var(--sp-2) var(--sp-1); border: 0; border-bottom: 1px solid var(--edge); background: transparent; }
|
|
|
|
|
- .m-project-row.is-current { background: var(--primary-subtle); }
|
|
|
|
|
- .m-project-row.is-current .m-project-folder { background: var(--surface); }
|
|
|
|
|
- .m-project-current { flex: none; padding: 4px 8px; border-radius: var(--r-tag); background: var(--primary-subtle); color: var(--primary); font-size: var(--fs-11); }
|
|
|
|
|
- .m-project-new-chat { gap: var(--sp-3); min-height: 52px; margin: 0 0 var(--sp-2); padding: 0 var(--sp-3); border: 0; border-radius: var(--r-md); background: var(--primary); color: var(--primary-content); font-size: var(--fs-14); font-weight: 600; }
|
|
|
|
|
- .m-project-new-chat span { flex: 1; }
|
|
|
|
|
- .m-project-session { gap: var(--sp-3); min-height: 68px; padding: var(--sp-2) var(--sp-1); border: 0; border-bottom: 1px solid var(--edge); background: transparent; }
|
|
|
|
|
- .m-project-session-copy { display: grid; flex: 1; min-width: 0; gap: 4px; }
|
|
|
|
|
- .m-project-session-side { display: grid; flex: none; justify-items: end; gap: var(--sp-1); color: var(--muted); }
|
|
|
|
|
- .m-project-unread { min-width: 18px; padding: 2px 5px; border-radius: var(--r-tag); background: var(--danger); color: var(--on-danger); font-size: var(--fs-10); text-align: center; }
|
|
|
|
|
- .m-project-empty { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-8) var(--sp-3); color: var(--muted); text-align: center; }
|
|
|
|
|
- .m-project-empty > i { color: var(--primary); font-size: var(--fs-26); }
|
|
|
|
|
- .m-project-empty b { color: var(--ink-2); font-size: var(--fs-14); }
|
|
|
|
|
- .m-project-empty span { font-size: var(--fs-12); }
|
|
|
|
|
- .m-project-foot { display: flex; flex: none; align-items: center; justify-content: space-between; min-height: 48px; margin-top: var(--sp-2); padding: var(--sp-2) var(--mob-gutter) 0; border-top: 1px solid var(--edge); color: var(--muted); font-size: var(--fs-12); }
|
|
|
|
|
- .m-project-done { min-width: 72px; min-height: var(--touch-min); border: 0; border-radius: var(--r-sm); background: var(--primary-subtle); color: var(--primary); font: inherit; font-size: var(--fs-13); font-weight: 600; }
|
|
|
|
|
- @keyframes project-sheet-in { from { transform: translateY(24px); opacity: .8; } to { transform: translateY(0); opacity: 1; } }
|
|
|
|
|
- @media (prefers-reduced-motion: reduce) { .m-project-sheet { animation: none; } }
|
|
|
|
|
|
|
+ .mps-form-field {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: var(--sp-2);
|
|
|
|
|
+ min-height: 44px;
|
|
|
|
|
+ padding: 0 var(--sp-3);
|
|
|
|
|
+ border: 1px solid transparent;
|
|
|
|
|
+ border-radius: var(--r-md);
|
|
|
|
|
+ background: var(--surface);
|
|
|
|
|
+ color: var(--faint);
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-form-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
|
|
|
|
|
+ .mps-form-field input {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ width: 0;
|
|
|
|
|
+ min-height: 44px;
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ border: 0;
|
|
|
|
|
+ outline: 0;
|
|
|
|
|
+ background: transparent;
|
|
|
|
|
+ color: var(--ink);
|
|
|
|
|
+ font: inherit;
|
|
|
|
|
+ font-size: var(--fs-14);
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-form-field input::placeholder { color: var(--faint); }
|
|
|
|
|
+ .mps-form-error { margin: 0; color: var(--danger); font-size: var(--fs-12); }
|
|
|
|
|
+ .mps-form-actions { display: flex; gap: var(--sp-2); }
|
|
|
|
|
+ .mps-btn-ghost, .mps-btn-primary {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ min-height: var(--touch-min);
|
|
|
|
|
+ border: 0;
|
|
|
|
|
+ border-radius: var(--r-md);
|
|
|
|
|
+ font: inherit;
|
|
|
|
|
+ font-size: var(--fs-14);
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-btn-ghost { background: var(--surface); color: var(--ink-2); }
|
|
|
|
|
+ .mps-btn-primary { background: var(--primary); color: var(--primary-content); font-weight: 500; }
|
|
|
|
|
+ .mps-btn-primary:disabled { cursor: not-allowed; opacity: .45; }
|
|
|
|
|
+
|
|
|
|
|
+ /* ---------- 列表 ---------- */
|
|
|
|
|
+ .mps-list {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ min-height: 0;
|
|
|
|
|
+ overflow-y: auto;
|
|
|
|
|
+ overscroll-behavior: contain;
|
|
|
|
|
+ padding: 0 var(--mob-gutter);
|
|
|
|
|
+ }
|
|
|
|
|
+ /* 创建行独占一个不滚动的头部区块,下方列表才是滚动区 */
|
|
|
|
|
+ .mps-list-first { flex: none; overflow: visible; padding-bottom: var(--sp-1); }
|
|
|
|
|
+ /* 创建行:与项目行同尺寸,仅图标改成主色圆底加号,不再是一张灰底「卡中卡」 */
|
|
|
|
|
+ .mps-icon.is-create {
|
|
|
|
|
+ border-radius: var(--r-tag);
|
|
|
|
|
+ background: var(--primary-subtle);
|
|
|
|
|
+ color: var(--primary);
|
|
|
|
|
+ font-size: var(--fs-13);
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-create-row b { font-weight: 500; }
|
|
|
|
|
+ .mps-row {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: var(--sp-3);
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ min-height: 56px;
|
|
|
|
|
+ padding: var(--sp-2) var(--sp-2);
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+ border: 0;
|
|
|
|
|
+ border-radius: var(--r-md);
|
|
|
|
|
+ background: transparent;
|
|
|
|
|
+ color: var(--ink);
|
|
|
|
|
+ font: inherit;
|
|
|
|
|
+ text-align: left;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-row + .mps-row { margin-top: 1px; }
|
|
|
|
|
+ .mps-row:active { background: var(--surface-2); }
|
|
|
|
|
+ .mps-row.is-current { background: var(--primary-subtle); }
|
|
|
|
|
+ .mps-row.is-orphan .mps-icon { color: var(--muted); }
|
|
|
|
|
+ .mps-icon {
|
|
|
|
|
+ display: grid;
|
|
|
|
|
+ flex: none;
|
|
|
|
|
+ place-items: center;
|
|
|
|
|
+ width: 36px;
|
|
|
|
|
+ height: 36px;
|
|
|
|
|
+ border-radius: var(--r-sm);
|
|
|
|
|
+ background: var(--canvas);
|
|
|
|
|
+ color: var(--ink-2);
|
|
|
|
|
+ font-size: var(--fs-14);
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-row.is-current .mps-icon { background: var(--surface); }
|
|
|
|
|
+ .mps-row-copy { display: grid; flex: 1; min-width: 0; gap: 3px; }
|
|
|
|
|
+ .mps-row b {
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ color: var(--ink);
|
|
|
|
|
+ font-size: var(--fs-14);
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-row small {
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ color: var(--muted);
|
|
|
|
|
+ font-size: var(--fs-12);
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-current { flex: none; color: var(--primary); font-size: var(--fs-13); }
|
|
|
|
|
+ .mps-row-chevron { flex: none; color: var(--faint); font-size: var(--fs-10); }
|
|
|
|
|
+ /* 会话行与项目行同高,保证两级列表节奏一致 */
|
|
|
|
|
+ .mps-row-session { min-height: 56px; }
|
|
|
|
|
+ .mps-row-side { display: grid; flex: none; justify-items: end; gap: var(--sp-1); color: var(--muted); }
|
|
|
|
|
+ .mps-unread {
|
|
|
|
|
+ min-width: 18px;
|
|
|
|
|
+ padding: 1px 5px;
|
|
|
|
|
+ border-radius: var(--r-tag);
|
|
|
|
|
+ background: var(--danger);
|
|
|
|
|
+ color: var(--primary-content);
|
|
|
|
|
+ font-size: var(--fs-10);
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* ---------- 项目内操作与提示 ---------- */
|
|
|
|
|
+ .mps-actions { display: flex; flex: none; gap: var(--sp-2); padding: 0 var(--mob-gutter) var(--sp-2); }
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 操作按钮:**不换行**(2026-11-23 实机截图:
|
|
|
|
|
+ * 「将当前对话移入此项目」在 44% 宽度里被折成两行,视觉上像两个按钮)。
|
|
|
|
|
+ * 文案同时压缩到 6 字以内,配合 nowrap + 省略号兜底。
|
|
|
|
|
+ */
|
|
|
|
|
+ .mps-action {
|
|
|
|
|
+ display: inline-flex;
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ gap: 6px;
|
|
|
|
|
+ min-width: 0;
|
|
|
|
|
+ min-height: 40px;
|
|
|
|
|
+ padding: 0 var(--sp-3);
|
|
|
|
|
+ border: 1px solid var(--edge);
|
|
|
|
|
+ border-radius: var(--r-tag);
|
|
|
|
|
+ background: var(--surface);
|
|
|
|
|
+ color: var(--ink-2);
|
|
|
|
|
+ font: inherit;
|
|
|
|
|
+ font-size: var(--fs-13);
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-action > span { overflow: hidden; text-overflow: ellipsis; }
|
|
|
|
|
+ .mps-action.is-primary { border-color: transparent; background: var(--primary); color: var(--primary-content); font-weight: 500; }
|
|
|
|
|
+ .mps-note {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex: none;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: var(--sp-2);
|
|
|
|
|
+ margin: 0 var(--mob-gutter) var(--sp-2);
|
|
|
|
|
+ padding: var(--sp-2) var(--sp-3);
|
|
|
|
|
+ border-radius: var(--r-md);
|
|
|
|
|
+ background: var(--canvas);
|
|
|
|
|
+ color: var(--muted);
|
|
|
|
|
+ font-size: var(--fs-12);
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-note span { flex: 1; min-width: 0; }
|
|
|
|
|
+ .mps-note-retry {
|
|
|
|
|
+ flex: none;
|
|
|
|
|
+ min-height: 32px;
|
|
|
|
|
+ padding: 0 var(--sp-3);
|
|
|
|
|
+ border: 0;
|
|
|
|
|
+ border-radius: var(--r-tag);
|
|
|
|
|
+ background: var(--primary-subtle);
|
|
|
|
|
+ color: var(--primary);
|
|
|
|
|
+ font: inherit;
|
|
|
|
|
+ font-size: var(--fs-12);
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* ---------- 空态 ---------- */
|
|
|
|
|
+ .mps-empty {
|
|
|
|
|
+ display: grid;
|
|
|
|
|
+ justify-items: center;
|
|
|
|
|
+ gap: var(--sp-2);
|
|
|
|
|
+ padding: var(--sp-8) var(--sp-3);
|
|
|
|
|
+ color: var(--muted);
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ }
|
|
|
|
|
+ .mps-empty > i { color: var(--faint); font-size: var(--fs-26); }
|
|
|
|
|
+ .mps-empty b { color: var(--ink-2); font-size: var(--fs-14); font-weight: 500; }
|
|
|
|
|
+ .mps-empty span { font-size: var(--fs-12); }
|
|
|
|
|
+
|
|
|
|
|
+ @keyframes mps-card-in { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
|
|
|
|
|
+ @media (prefers-reduced-motion: reduce) { .mps-card { animation: none; } }
|
|
|
`,
|
|
`,
|
|
|
],
|
|
],
|
|
|
})
|
|
})
|
|
@@ -319,10 +692,17 @@ export class MProjectSwitcherComponent {
|
|
|
protected readonly loadingSessions = signal(false);
|
|
protected readonly loadingSessions = signal(false);
|
|
|
protected readonly sessionLoadIssue = signal<'none' | 'partial' | 'error' | 'timeout'>('none');
|
|
protected readonly sessionLoadIssue = signal<'none' | 'partial' | 'error' | 'timeout'>('none');
|
|
|
private sessionLoadGeneration = 0;
|
|
private sessionLoadGeneration = 0;
|
|
|
|
|
+
|
|
|
|
|
+ private readonly createInput = viewChild<ElementRef<HTMLInputElement>>('createInput');
|
|
|
|
|
+
|
|
|
protected readonly projectNameTaken = computed(() => {
|
|
protected readonly projectNameTaken = computed(() => {
|
|
|
const name = this.newProjectName().trim();
|
|
const name = this.newProjectName().trim();
|
|
|
return !!name && this.workspacesSvc.hasName(name);
|
|
return !!name && this.workspacesSvc.hasName(name);
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ /** 「未分类」虚拟分组的 id(承接所属项目已被删除的会话,不落库) */
|
|
|
|
|
+ private static readonly ORPHAN_PROJECT_ID = '__orphan__';
|
|
|
|
|
+
|
|
|
/** 项目清单;末尾追加「未分类」用于承接孤儿会话(所属项目已被删除)。 */
|
|
/** 项目清单;末尾追加「未分类」用于承接孤儿会话(所属项目已被删除)。 */
|
|
|
protected readonly projects = computed(() => {
|
|
protected readonly projects = computed(() => {
|
|
|
const currentId = this.currentWorkspaceId();
|
|
const currentId = this.currentWorkspaceId();
|
|
@@ -345,7 +725,7 @@ export class MProjectSwitcherComponent {
|
|
|
}));
|
|
}));
|
|
|
if (orphans.length > 0) {
|
|
if (orphans.length > 0) {
|
|
|
list.push({
|
|
list.push({
|
|
|
- id: ORPHAN_PROJECT_ID,
|
|
|
|
|
|
|
+ id: MProjectSwitcherComponent.ORPHAN_PROJECT_ID,
|
|
|
name: '未分类',
|
|
name: '未分类',
|
|
|
createdAt: 0,
|
|
createdAt: 0,
|
|
|
orphan: true,
|
|
orphan: true,
|
|
@@ -360,19 +740,34 @@ export class MProjectSwitcherComponent {
|
|
|
return (b.rows[0]?.session.updatedAt ?? b.createdAt) - (a.rows[0]?.session.updatedAt ?? a.createdAt);
|
|
return (b.rows[0]?.session.updatedAt ?? b.createdAt) - (a.rows[0]?.session.updatedAt ?? a.createdAt);
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
- /** 底部统计只数真实项目(未分类是虚拟分组,不计入) */
|
|
|
|
|
- protected readonly realProjectCount = computed(() => this.projects().filter((p) => !p.orphan).length);
|
|
|
|
|
- protected readonly currentWorkspace = computed(() => { const id = this.currentWorkspaceId();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ protected readonly currentWorkspace = computed(() => {
|
|
|
|
|
+ const id = this.currentWorkspaceId();
|
|
|
return id ? this.workspacesSvc.byId(id) : undefined;
|
|
return id ? this.workspacesSvc.byId(id) : undefined;
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ /** 胶囊上的对话数:当前项目下的会话条数(含未归档) */
|
|
|
|
|
+ protected readonly currentWorkspaceConversations = computed(() => {
|
|
|
|
|
+ const id = this.currentWorkspaceId();
|
|
|
|
|
+ return id ? this.view.active().filter((row) => row.session.workspaceId === id).length : 0;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ /** 底部/标题统计只数真实项目(「未分类」是虚拟分组,不计入) */
|
|
|
|
|
+ protected readonly realProjectCount = computed(() => this.projects().filter((p) => !p.orphan).length);
|
|
|
|
|
+
|
|
|
protected readonly selectedWorkspace = computed(
|
|
protected readonly selectedWorkspace = computed(
|
|
|
() => this.projects().find((project) => project.id === this.selectedWorkspaceId()),
|
|
() => this.projects().find((project) => project.id === this.selectedWorkspaceId()),
|
|
|
);
|
|
);
|
|
|
protected readonly selectedWorkspaceRows = computed(() => this.selectedWorkspace()?.rows ?? []);
|
|
protected readonly selectedWorkspaceRows = computed(() => this.selectedWorkspace()?.rows ?? []);
|
|
|
|
|
+
|
|
|
|
|
+ /** 项目 ≤5 个时不出搜索框:一屏放得下,搜索框只增加视觉噪音 */
|
|
|
|
|
+ protected readonly showSearch = computed(() => this.projects().length >= 6);
|
|
|
|
|
+
|
|
|
protected readonly filteredProjects = computed(() => {
|
|
protected readonly filteredProjects = computed(() => {
|
|
|
const q = this.query().trim().toLowerCase();
|
|
const q = this.query().trim().toLowerCase();
|
|
|
return this.projects().filter((project) => !q || project.name.toLowerCase().includes(q));
|
|
return this.projects().filter((project) => !q || project.name.toLowerCase().includes(q));
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
protected readonly filteredSessions = computed(() => {
|
|
protected readonly filteredSessions = computed(() => {
|
|
|
const q = this.query().trim().toLowerCase();
|
|
const q = this.query().trim().toLowerCase();
|
|
|
return this.selectedWorkspaceRows().filter((row) =>
|
|
return this.selectedWorkspaceRows().filter((row) =>
|
|
@@ -385,8 +780,10 @@ export class MProjectSwitcherComponent {
|
|
|
this.workspacesSvc.load();
|
|
this.workspacesSvc.load();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /** 打开选择器(入口只有一个,新建项目在卡片内的「创建新项目」里) */
|
|
|
protected openPicker(): void {
|
|
protected openPicker(): void {
|
|
|
this.query.set('');
|
|
this.query.set('');
|
|
|
|
|
+ this.creatingProject.set(false);
|
|
|
this.step.set('projects');
|
|
this.step.set('projects');
|
|
|
this.selectedWorkspaceId.set(null);
|
|
this.selectedWorkspaceId.set(null);
|
|
|
this.open.set(true);
|
|
this.open.set(true);
|
|
@@ -417,6 +814,7 @@ export class MProjectSwitcherComponent {
|
|
|
protected close(): void {
|
|
protected close(): void {
|
|
|
this.open.set(false);
|
|
this.open.set(false);
|
|
|
this.query.set('');
|
|
this.query.set('');
|
|
|
|
|
+ this.creatingProject.set(false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@HostListener('document:keydown.escape', ['$event'])
|
|
@HostListener('document:keydown.escape', ['$event'])
|
|
@@ -431,15 +829,25 @@ export class MProjectSwitcherComponent {
|
|
|
this.query.set('');
|
|
this.query.set('');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 选中项目 → **同一张卡内**滑到该项目的对话列表。
|
|
|
|
|
+ *
|
|
|
|
|
+ * 不做「点项目直接跳最近一条」:切换项目是带上下文的动作(这个项目里
|
|
|
|
|
+ * 可能有几条并行对话),替用户做选择会让他找不到想找的那条。
|
|
|
|
|
+ * 滑入列表是一次轻量过渡,左上「‹」一键退回,比两个独立弹层少一次遮挡。
|
|
|
|
|
+ */
|
|
|
protected selectProject(id: string): void {
|
|
protected selectProject(id: string): void {
|
|
|
this.selectedWorkspaceId.set(id);
|
|
this.selectedWorkspaceId.set(id);
|
|
|
this.query.set('');
|
|
this.query.set('');
|
|
|
this.step.set('sessions');
|
|
this.step.set('sessions');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- protected createProject(): void {
|
|
|
|
|
|
|
+ protected beginCreate(): void {
|
|
|
|
|
+ this.step.set('projects');
|
|
|
this.newProjectName.set('');
|
|
this.newProjectName.set('');
|
|
|
this.creatingProject.set(true);
|
|
this.creatingProject.set(true);
|
|
|
|
|
+ // 等表单渲染出来再聚焦,否则 viewChild 还是空的
|
|
|
|
|
+ setTimeout(() => this.createInput()?.nativeElement.focus(), 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected cancelProjectCreation(): void {
|
|
protected cancelProjectCreation(): void {
|
|
@@ -459,6 +867,15 @@ export class MProjectSwitcherComponent {
|
|
|
this.step.set('sessions');
|
|
this.step.set('sessions');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /** 项目行副标题:「3 条对话 · 10 分钟前」;空项目给引导文案 */
|
|
|
|
|
+ protected projectSubtitle(project: { rows: SessionRow[]; orphan: boolean }): string {
|
|
|
|
|
+ const count = project.rows.length;
|
|
|
|
|
+ if (count === 0) return '暂无对话';
|
|
|
|
|
+ const latest = project.rows.reduce((max, row) => Math.max(max, row.session.updatedAt ?? 0), 0);
|
|
|
|
|
+ const when = latest ? fmtRelTime(latest) : '';
|
|
|
|
|
+ return when ? `${count} 条对话 · ${when}` : `${count} 条对话`;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
protected relTime(row: SessionRow): string {
|
|
protected relTime(row: SessionRow): string {
|
|
|
return row.session.updatedAt ? fmtRelTime(row.session.updatedAt) : '新建';
|
|
return row.session.updatedAt ? fmtRelTime(row.session.updatedAt) : '新建';
|
|
|
}
|
|
}
|