Memoji click opens the task manager directly
The intermediate menu (Дела, пипетка, переводчик, кофе) is gone: those live in Func and the header. The popover is the «Дела» panel itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -115,71 +115,23 @@ final class OpsClient: ObservableObject {
|
||||
var attentionCount: Int { agenda.overdue.count + agenda.today.count }
|
||||
}
|
||||
|
||||
// MARK: - Menu on the Memoji
|
||||
// MARK: - Menu on the Memoji: the task manager
|
||||
|
||||
struct BroMenu: View {
|
||||
@ObservedObject var state: AppState
|
||||
@ObservedObject private var ops = OpsClient.shared
|
||||
@ObservedObject private var coffee = Coffee.shared
|
||||
@State private var page = 0 // 0 = menu, 1 = «Дела»
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if page == 1 {
|
||||
OpsPanel(state: state, back: { withAnimation(.easeOut(duration: 0.15)) { page = 0 } })
|
||||
} else {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
FuncRow(symbol: "checklist", color: "#D97757", title: "Дела",
|
||||
subtitle: opsSubtitle, hint: ops.attentionCount > 0 ? "\(ops.attentionCount)" : nil) {
|
||||
withAnimation(.easeOut(duration: 0.15)) { page = 1 }
|
||||
}
|
||||
if let r = ops.agenda.running {
|
||||
FuncRow(symbol: "stop.circle", color: "#F4505E", title: "Стоп таймер",
|
||||
subtitle: "\(r.title) · \(r.minutes) мин", hint: nil) {
|
||||
Task { await ops.act(["op": "stop_timer"]) }
|
||||
}
|
||||
}
|
||||
Divider().padding(.vertical, 4)
|
||||
FuncRow(symbol: "eyedropper", color: "#F472B6", title: "Пипетка",
|
||||
subtitle: "цвет пикселя во всех форматах", hint: nil) {
|
||||
state.botMenuOpen = false
|
||||
ColorPicking.start(state: state)
|
||||
}
|
||||
FuncRow(symbol: "character.bubble", color: "#60A5FA", title: "Переводчик",
|
||||
subtitle: "выделенный текст RU ↔ EN", hint: "⌥`") {
|
||||
state.botMenuOpen = false
|
||||
TranslatorRun.start(state: state)
|
||||
}
|
||||
FuncRow(symbol: coffee.on ? "cup.and.saucer.fill" : "cup.and.saucer", color: "#D97757",
|
||||
title: coffee.on ? "Кофе: включён" : "Кофе-режим",
|
||||
subtitle: coffee.on ? "Мак не засыпает — нажми, чтобы выключить" : "не давать Маку засыпать",
|
||||
hint: nil) {
|
||||
coffee.toggle()
|
||||
}
|
||||
}
|
||||
.padding(8)
|
||||
.frame(width: 290)
|
||||
}
|
||||
}
|
||||
OpsPanel(state: state)
|
||||
.notchPopoverStyle()
|
||||
.task { await ops.refresh() }
|
||||
}
|
||||
|
||||
private var opsSubtitle: String {
|
||||
guard ops.configured else { return "подключи сервис в Настройках → Чат" }
|
||||
if ops.reachable == false { return "сервис не отвечает" }
|
||||
let a = ops.agenda
|
||||
if a.overdue.isEmpty && a.today.isEmpty { return a.soon.isEmpty ? "ничего не горит" : "на неделе: \(a.soon.count)" }
|
||||
return [a.overdue.isEmpty ? nil : "просрочено \(a.overdue.count)",
|
||||
a.today.isEmpty ? nil : "сегодня \(a.today.count)"].compactMap { $0 }.joined(separator: " · ")
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - «Дела» panel
|
||||
|
||||
struct OpsPanel: View {
|
||||
@ObservedObject var state: AppState
|
||||
let back: () -> Void
|
||||
@ObservedObject private var ops = OpsClient.shared
|
||||
@State private var text = ""
|
||||
@FocusState private var focused: Bool
|
||||
@@ -187,10 +139,8 @@ struct OpsPanel: View {
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
HStack(spacing: 6) {
|
||||
Button(action: back) {
|
||||
Image(systemName: "chevron.left").font(.system(size: 11, weight: .semibold))
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
Image(systemName: "checklist").font(.system(size: 12, weight: .semibold))
|
||||
.foregroundColor(Color(hex: "#D97757"))
|
||||
Text("Дела").font(.system(size: 14, weight: .semibold))
|
||||
Spacer()
|
||||
if ops.busy { ProgressView().controlSize(.mini) }
|
||||
|
||||
Reference in New Issue
Block a user