feat(ui): T7B multi-project four-layer visual hierarchy and T8 storage management UI
This commit is contained in:
parent
f7ad5d1efc
commit
9fadfaf6f1
@ -491,3 +491,24 @@ Agent 导入的完全透明页面背景以原生“无填充”表达,保留
|
||||
**接入情况。** 已在本批接入生产代码的:语义色与阶梯 Token(库内全部字面量已替换)、`focus_ring`、`task_status_row`、`tool_group_head`、`paint_status_badge`、用户气泡(减少动态已一路透传)、输入浮层的光涌档位、输入框的光球档位与柔光、排版缓存、错误提示的类别驱动(`operation_error.rs`)。
|
||||
|
||||
**仍未接入。** 时间流 11 块外壳、目标驾驶舱、等待卡、提示条、停止钮、自适应网格、列表行、独立状态徽标、叠图说明都还没有生产调用方,第 2 批接入;`Hover Highlight`、`Blob Warp` 维持原状。
|
||||
|
||||
## 多项目并发四层视觉层级(T7B · 2026-12-02)
|
||||
|
||||
为消除多项目并发制作时的「不知道后台有几个项目在跑」「不知道当前视图归属哪款商品」「把当前查看成品误当成正在制作成品」三类核心迷失,客户端新增纯 ViewModel 驱动的四层视觉层级模块 `jiansun/multi_project_ui.rs`:
|
||||
|
||||
1. **第一层|全局后台任务条(Global Task Strip)**:仅在存在活跃/排队/暂停任务时占位,无后台任务为零高度。左侧固定展示并发容量计数(如「进行中 2/2 · 排队 1」);右侧为各项目运行胶囊(24pt 高、`radius::CHIP`),运行态使用冷月青微呼吸点与轻描边,排队态使用空心稳态圆点,暂停/部分交付使用告警色,当前项目标「当前」而不重复放停止钮,非当前运行项目支持快捷暂停。可用宽度低于 `540pt` 时自动收敛为单颗汇总触发器 + `stitch_ui::select_popup` 弹出列表,禁止挤压换行或横向截断。
|
||||
2. **第二层|常驻项目身份胶囊(Persistent Project Identity)**:常驻展示当前项目名称与所处环节(「我的项目」「产品资料」「模板画布」),消除顶栏无项目名及资料/画布段切换带来的迷失感;当其他项目正在后台制作而当前项目空闲时,给出温和提示与一键切换入口。
|
||||
3. **第三层|「正在查看」与「正在制作」强区分横条(Viewing vs Producing Divergence Strip)**:当 `viewing_differs_from_producing == true` 时显示低噪验证色调信息条(「当前查看:主图 · 后台正制作:详情页」),右侧提供 `Quiet` 一键返回按钮「回到正在制作的详情页」;窄栏(`< 390pt`)自动折行不裁切。
|
||||
4. **第四层|右侧驾驶舱与「我的项目」实时态一致性**:右侧停靠栏顶部对接三层上下文头(保持产品资料页协作者钩子不受干扰);`project_browser.rs` 在项目卡片封面左上角区分磁盘静态态与实时运行态(「后台制作中」「排队等待中」「已部分交付·缺项待补」「已暂停」),并在元信息第二行呈现实时产出进度,同时在「我的项目」标题行右侧提供全局设置图标入口直达同一「小壹设置」弹层。
|
||||
|
||||
## 本机存储设置、两阶段迁移与空间清理(T8 · 2026-12-02)
|
||||
|
||||
新增本机全局存储管理模块 `jiansun/storage_settings_ui.rs`,状态存于机器级全局作用域(切换账号不重置),严格使用 `Tokens::agent()`、`AGENT_SEMANTIC` 与 `agent_scale`:
|
||||
|
||||
1. **「小壹设置」新增「数据存储」卡片**:挂载于 `settings_popup` 中 `client_version_settings` 之后,使用 `stitch_ui::surface_card`;展示当前目录模式(默认目录 / 自定义目录 / 环境变量指定 / 便携模式 / 目录不可用)、自动换行的完整目录路径、异步占用与项目数(未返回前显示「统计中…」绝不伪造 0 GB)、只读锁定说明与操作引导,以及 `Quiet` 按钮「更改目录…」「清理空间」「打开目录」。
|
||||
2. **两阶段存储迁移弹窗**:沿用 `client_update_ui.rs` 骨架(`stitch_ui::modal`,宽 `(屏宽 - 64).clamp(340, 520)`,底栏固定 34pt 主/次按钮):
|
||||
- 选目录与硬校验:展示目标盘剩余空间、禁止符号链接/目录联接/网盘同步目录等硬拦截原因、长路径软警告与迁移须知;
|
||||
- 阶段 1(在线预拷贝):使用确定性 `stitch_ui::progress_bar_tinted` 展示已拷贝字节 / 总字节与速度,允许点击「后台继续」不阻塞主界面操作;
|
||||
- 阶段 2(切换与重启):禁止假百分比,使用四步步骤清单(停写冻结核对 → 路径改写与校验 → 原子落指针 → 重启应用),切换期间弹窗不可关闭(无关闭按钮、拦截 Escape);
|
||||
- 失败/回滚态展示清晰错误与原目录未损说明并提供「重试迁移」;重启后自检通过态展示新目录确认并提供二次确认保护的 `QuietDanger`「释放旧目录」或「稍后保留 7 天兜底」。
|
||||
3. **「清理空间」弹窗**:先进入只读扫描态(不修改任何作品),扫描完成后清晰分区展示「无损直接回收(默认勾选,硬链接去重/孤儿回收/残留清理)」与「历史归档清理(默认不勾选,保留策略与风险说明清晰可见)」,底部实时汇总预计释放空间与「开始清理」。
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
//! Native collaboration dock. Model execution and credential storage remain outside the UI.
|
||||
#[path = "multi_project_ui.rs"]
|
||||
pub(super) mod multi_project_ui;
|
||||
#[path = "storage_settings_ui.rs"]
|
||||
pub(super) mod storage_settings_ui;
|
||||
|
||||
use super::stitch_timeline as timeline;
|
||||
use super::stitch_state::{NoticeKind, RunState, ToolStatus, WorkerStage};
|
||||
use timeline::GoalProgressPanel;
|
||||
@ -1186,6 +1191,7 @@ impl Workspace {
|
||||
ui.set_opacity(ui.opacity()*(1.0-0.18*pulse));
|
||||
self.agent_body_inner(app,ui);
|
||||
});
|
||||
self.storage_modals_ui(ui.ctx());
|
||||
});
|
||||
}
|
||||
|
||||
@ -1339,6 +1345,10 @@ impl Workspace {
|
||||
Frame::NONE.inner_margin(egui::Margin::symmetric(16, 8))
|
||||
.show(ui, |ui| self.library_notice(ui));
|
||||
}
|
||||
let multi_vm = self.multi_project_view_model(app, ui.ctx());
|
||||
if let Some(action) = multi_project_ui::dock_context_header(ui, &multi_vm, self.reduce_motion) {
|
||||
self.handle_multi_project_action(app, ui.ctx(), action);
|
||||
}
|
||||
if production || self.product_production.as_ref().is_some_and(|run| run.clock_paused()) {
|
||||
let head_start = crate::gpu_canvas::now_ms();
|
||||
self.production_head_ui(app, ui);
|
||||
@ -3879,7 +3889,7 @@ impl Workspace {
|
||||
});
|
||||
}
|
||||
|
||||
fn settings_popup(&mut self, ui: &mut Ui, anchor: &Response) {
|
||||
pub(super) fn settings_popup(&mut self, ui: &mut Ui, anchor: &Response) {
|
||||
let open = self.model_settings || self.key_settings;
|
||||
let t = Tokens::get(ui.ctx()).agent();
|
||||
let (visual, transform) = super::stitch_ui::floating_panel_motion(ui.ctx(), anchor.id.with("popup"), anchor, open, self.reduce_motion);
|
||||
@ -3993,6 +4003,8 @@ impl Workspace {
|
||||
// 有"通知与警告"时补一条分隔线;没有时上面已经是分隔线。
|
||||
let after_notifications = notification_id(&self.origin, &self.account, &self.project_context, self.owner_doc).is_some();
|
||||
self.client_version_settings(ui, after_notifications);
|
||||
let after_version = after_notifications || self.client_update.version["version"].is_string();
|
||||
self.storage_settings_section(ui, after_version);
|
||||
});
|
||||
// egui reports the pre-auto-shrink inner rect. Match the
|
||||
// actual vertical viewport used by ScrollArea::end, rather
|
||||
@ -4019,6 +4031,151 @@ impl Workspace {
|
||||
ui.ctx().request_repaint();
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn multi_project_view_model(
|
||||
&self,
|
||||
app: &PhotocraftApp,
|
||||
ctx: &egui::Context,
|
||||
) -> multi_project_ui::MultiProjectViewModel {
|
||||
if let Some(injected) = multi_project_ui::snapshot(ctx) {
|
||||
return injected;
|
||||
}
|
||||
let section = match self.agent_page(app) {
|
||||
"brief" => multi_project_ui::WorkspaceSection::Brief,
|
||||
"canvas" | "professional" => multi_project_ui::WorkspaceSection::Canvas,
|
||||
_ => multi_project_ui::WorkspaceSection::Projects,
|
||||
};
|
||||
let project_id = self.project_context["localId"]
|
||||
.as_str()
|
||||
.or_else(|| self.project_context["id"].as_str())
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(str::to_owned);
|
||||
let project_title = self.project_context["name"]
|
||||
.as_str()
|
||||
.or_else(|| self.creation_brief["name"].as_str())
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(str::to_owned);
|
||||
let viewing_output_id = self.template_workflow["activeOutputId"]
|
||||
.as_str()
|
||||
.or_else(|| self.template_workflow["outputId"].as_str())
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(str::to_owned);
|
||||
let viewing_output_label = viewing_output_id
|
||||
.as_deref()
|
||||
.map(|id| multi_project_ui::output_display_label(id).to_owned());
|
||||
let producing_output_id = self
|
||||
.product_production
|
||||
.as_ref()
|
||||
.and_then(|run| run.working_output())
|
||||
.and_then(|row| row["outputId"].as_str().map(str::to_owned));
|
||||
let producing_output_label = producing_output_id
|
||||
.as_deref()
|
||||
.map(|id| multi_project_ui::output_display_label(id).to_owned());
|
||||
let viewing_differs_from_producing = matches!(
|
||||
(&viewing_output_id, &producing_output_id),
|
||||
(Some(v), Some(p)) if v != p
|
||||
);
|
||||
let mut global_runs = Vec::new();
|
||||
if let Some(run) = self.product_production.as_ref()
|
||||
&& let Some(pid) = project_id.clone()
|
||||
{
|
||||
let status = if run.clock_paused() {
|
||||
multi_project_ui::MultiRunStatus::Paused
|
||||
} else {
|
||||
multi_project_ui::MultiRunStatus::Running
|
||||
};
|
||||
global_runs.push(multi_project_ui::GlobalRunEntry {
|
||||
project_id: pid,
|
||||
project_title: project_title.clone().unwrap_or_else(|| "当前项目".into()),
|
||||
status,
|
||||
producing_output_id: producing_output_id.clone().unwrap_or_default(),
|
||||
producing_output_label: producing_output_label.clone().unwrap_or_default(),
|
||||
progress_label: run.progress_label().unwrap_or_default(),
|
||||
elapsed_secs: run.elapsed().as_secs(),
|
||||
active_slots: self.production_workers().iter().filter(|w| w.active).count(),
|
||||
has_attention: self.pi_ui_waiting(),
|
||||
});
|
||||
}
|
||||
multi_project_ui::MultiProjectViewModel {
|
||||
global_runs,
|
||||
max_concurrent: 2,
|
||||
active_project_id: project_id,
|
||||
active_project_title: project_title,
|
||||
active_section: section,
|
||||
viewing_output_id,
|
||||
viewing_output_label,
|
||||
producing_output_id,
|
||||
producing_output_label,
|
||||
viewing_differs_from_producing,
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn handle_multi_project_action(
|
||||
&mut self,
|
||||
app: &mut PhotocraftApp,
|
||||
ctx: &egui::Context,
|
||||
action: multi_project_ui::MultiProjectAction,
|
||||
) {
|
||||
match &action {
|
||||
multi_project_ui::MultiProjectAction::SwitchToProject(project_id) => {
|
||||
if let Some(item) = self
|
||||
.projects
|
||||
.iter()
|
||||
.find(|p| p["id"].as_str() == Some(project_id.as_str()))
|
||||
.cloned()
|
||||
{
|
||||
self.handover();
|
||||
if let Err(error) = self.request_project_open(app, item) {
|
||||
self.error = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
multi_project_ui::MultiProjectAction::PauseProject(_) => {
|
||||
super::production_controls::queue_action(
|
||||
ctx,
|
||||
"production-stop",
|
||||
super::production_controls::stop_input(timeline::StopMode::Pause),
|
||||
);
|
||||
}
|
||||
multi_project_ui::MultiProjectAction::ResumeProject(_) => {
|
||||
self.resume_product_production(app);
|
||||
}
|
||||
multi_project_ui::MultiProjectAction::JumpToProducingOutput { .. } => {}
|
||||
}
|
||||
multi_project_ui::push_action(ctx, action);
|
||||
}
|
||||
|
||||
fn storage_settings_section(&mut self, ui: &mut Ui, show_divider: bool) {
|
||||
let reduced = self.reduce_motion;
|
||||
let ctx = ui.ctx().clone();
|
||||
let (action, modal_opened) = storage_settings_ui::with_machine_state(&ctx, |state| {
|
||||
let was_open = state.migrate_modal_open || state.cleanup_modal_open;
|
||||
let action = storage_settings_ui::storage_settings_card(ui, state, reduced, show_divider);
|
||||
let now_open = state.migrate_modal_open || state.cleanup_modal_open;
|
||||
(action, !was_open && now_open)
|
||||
});
|
||||
if modal_opened {
|
||||
self.model_settings = false;
|
||||
self.key_settings = false;
|
||||
self.api_key.clear();
|
||||
ui.ctx().request_repaint();
|
||||
}
|
||||
if let Some(action) = action {
|
||||
let (method, payload) = action.to_request();
|
||||
let _ = self.tx.send(Request::Action(method.into(), payload));
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn storage_modals_ui(&mut self, ctx: &egui::Context) {
|
||||
let reduced = self.reduce_motion;
|
||||
let action = storage_settings_ui::with_machine_state(ctx, |state| {
|
||||
storage_settings_ui::show_storage_modals(ctx, state, reduced)
|
||||
});
|
||||
if let Some(action) = action {
|
||||
let (method, payload) = action.to_request();
|
||||
let _ = self.tx.send(Request::Action(method.into(), payload));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Experimental, local-acceptance-only opt-in. Until device-loss, resource
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -278,12 +278,30 @@ impl Workspace {
|
||||
ui.label(RichText::new("我的项目").size(20.0).strong().color(t.text));
|
||||
ui.label(RichText::new(self.projects.len().to_string()).size(12.0).color(t.text_dim));
|
||||
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
|
||||
let settings_btn = stitch_ui::icon_button(ui, "settings", 30.0, self.model_settings, "小壹设置与数据存储");
|
||||
if settings_btn.clicked() {
|
||||
self.model_settings = !self.model_settings;
|
||||
if self.model_settings {
|
||||
self.prompt_library.close();
|
||||
} else {
|
||||
self.api_key.clear();
|
||||
self.key_settings = false;
|
||||
}
|
||||
}
|
||||
self.settings_popup(ui, &settings_btn);
|
||||
if stitch_ui::icon_button(ui, "rotate-cw", 30.0, false, "刷新项目").clicked() {
|
||||
self.cover_errors.clear();
|
||||
self.send("projects", json!({}));
|
||||
}
|
||||
});
|
||||
});
|
||||
let multi_vm = self.multi_project_view_model(app, ui.ctx());
|
||||
if !multi_vm.global_runs.is_empty() {
|
||||
ui.add_space(12.0);
|
||||
if let Some(action) = agent_panel::multi_project_ui::global_task_strip(ui, &multi_vm, self.reduce_motion) {
|
||||
self.handle_multi_project_action(app, ui.ctx(), action);
|
||||
}
|
||||
}
|
||||
ui.add_space(18.0);
|
||||
// The selection belongs to this account and origin, and is only
|
||||
// a view filter: no project status or sync record is modified.
|
||||
@ -428,6 +446,7 @@ impl Workspace {
|
||||
});
|
||||
});
|
||||
self.delete_dialog(app, ui);
|
||||
self.storage_modals_ui(ui.ctx());
|
||||
});
|
||||
if !self.cover_loading.is_empty() {
|
||||
ui.ctx().request_repaint_after(Duration::from_millis(100));
|
||||
@ -468,10 +487,22 @@ impl Workspace {
|
||||
}
|
||||
}
|
||||
ui.painter().rect_stroke(shell,16.0,Stroke::new(stroke_width,t.card_border.lerp_to_gamma(t.text_dim,hover*0.65)),egui::StrokeKind::Inside);
|
||||
let (state, _, _) = badge(item, &t);
|
||||
let badge_width = if state == "状态未知" { 84.0 } else if state == "进行中" { 54.0 } else { 42.0 };
|
||||
let badge_rect = egui::Rect::from_min_size(rect.min+vec2(10.0,10.0),vec2(badge_width,24.0));
|
||||
stitch_ui::paint_status_chip(ui, &t, badge_rect, state, if state=="完结" {stitch_ui::StatusChipStyle::Contrast} else {stitch_ui::StatusChipStyle::Muted});
|
||||
let live_run = item["id"]
|
||||
.as_str()
|
||||
.and_then(|id| {
|
||||
agent_panel::multi_project_ui::snapshot(ui.ctx())
|
||||
.and_then(|vm| vm.run_for_project(id).cloned())
|
||||
});
|
||||
let (state, badge_rect) = if let Some(run) = &live_run {
|
||||
let rect = agent_panel::multi_project_ui::paint_project_live_badge(ui, rect, run, self.reduce_motion);
|
||||
(run.status.label(), rect)
|
||||
} else {
|
||||
let (state, _, _) = badge(item, &t);
|
||||
let badge_width = if state == "状态未知" { 84.0 } else if state == "进行中" { 54.0 } else { 42.0 };
|
||||
let badge_rect = egui::Rect::from_min_size(rect.min+vec2(10.0,10.0),vec2(badge_width,24.0));
|
||||
stitch_ui::paint_status_chip(ui, &t, badge_rect, state, if state=="完结" {stitch_ui::StatusChipStyle::Contrast} else {stitch_ui::StatusChipStyle::Muted});
|
||||
(state, badge_rect)
|
||||
};
|
||||
if response.has_focus() {ui.painter().rect_stroke(rect.expand(2.0),18.0,Stroke::new(1.2,t.text),egui::StrokeKind::Outside);}
|
||||
let update = if item["cloudUpdateAvailable"] == true || item["cloudUpdateBlocked"].is_string() {
|
||||
let open = self.open_project_index(app, item["id"].as_str().unwrap_or("")).is_some();
|
||||
@ -519,11 +550,21 @@ impl Workspace {
|
||||
else if native { "本机" } else { "云端" };
|
||||
let updated = item["updatedLabel"].as_str().or_else(|| item["updatedAt"].as_str()?.get(..10))
|
||||
.unwrap_or("更新时间未知");
|
||||
for (offset, text) in [(36.0, format!("{brand} · {model}")), (56.0, format!("{updated} · {status}"))] {
|
||||
let second_meta = if let Some(run) = &live_run {
|
||||
agent_panel::multi_project_ui::project_card_live_subtitle(run)
|
||||
} else {
|
||||
format!("{updated} · {status}")
|
||||
};
|
||||
let second_color = if let Some(run) = &live_run {
|
||||
run.status.tone().color(&t)
|
||||
} else {
|
||||
t.text_dim
|
||||
};
|
||||
for (offset, text, color) in [(36.0, format!("{brand} · {model}"), t.text_dim), (56.0, second_meta, second_color)] {
|
||||
let line = egui::Rect::from_min_size(pos2(rect.left() + 12.0, rect.bottom() + offset), vec2(width - 24.0, 18.0));
|
||||
let mut row = ui.new_child(egui::UiBuilder::new().id_salt(("project-meta", offset as u32))
|
||||
.max_rect(line).layout(Layout::left_to_right(Align::Center)));
|
||||
row.add(egui::Label::new(RichText::new(&text).size(Type::Meta.size()).color(t.text_dim)).truncate()).on_hover_text(text);
|
||||
row.add(egui::Label::new(RichText::new(&text).size(Type::Meta.size()).color(color)).truncate()).on_hover_text(text);
|
||||
}
|
||||
let on_menu = ui.input(|i|i.pointer.interact_pos().is_some_and(|p|menu_rect.contains(p)));
|
||||
let opening = menu_open || (response.clicked() && !on_menu && !egui::Popup::is_any_open(ui.ctx()));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user