diff --git a/apps/ios/ItemAtlas.xcodeproj/project.pbxproj b/apps/ios/ItemAtlas.xcodeproj/project.pbxproj index 91f050c..b57c92d 100644 --- a/apps/ios/ItemAtlas.xcodeproj/project.pbxproj +++ b/apps/ios/ItemAtlas.xcodeproj/project.pbxproj @@ -117,7 +117,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; GENERATE_INFOPLIST_FILE = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ATLAS_API_BASE_URL = "https://api-atlas.tutudog.com"; @@ -138,7 +138,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; GENERATE_INFOPLIST_FILE = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ATLAS_API_BASE_URL = "https://api-atlas.tutudog.com"; diff --git a/apps/ios/ItemAtlas/InventoryAppearance.swift b/apps/ios/ItemAtlas/InventoryAppearance.swift index 36c0028..127b538 100644 --- a/apps/ios/ItemAtlas/InventoryAppearance.swift +++ b/apps/ios/ItemAtlas/InventoryAppearance.swift @@ -105,32 +105,80 @@ enum LocationLevel { } } - var title: String { + var badge: String { switch self { - case .room: "一级 · 房间和区域" - case .furniture: "二级 · 家具和收纳区" - case .container: "三级 · 抽屉和容器" - case .nested: "内层容器" + case .room: "一级" + case .furniture: "二级" + case .container: "三级" + case .nested: "内层" } } - var tint: Color { + var group: String { switch self { - case .room: .indigo - case .furniture: .blue - case .container: .orange - case .nested: .secondary + case .room: "房间和区域" + case .furniture: "家具和收纳区" + case .container: "抽屉和容器" + case .nested: "容器" } } + + func tint(for scheme: ColorScheme) -> Color { + let dark = scheme == .dark + switch self { + case .room: + return dark ? Color(red: 0.96, green: 0.79, blue: 0.41) : Color(red: 0.51, green: 0.36, blue: 0.08) + case .furniture: + return dark ? Color(red: 0.80, green: 0.85, blue: 0.91) : Color(red: 0.33, green: 0.38, blue: 0.44) + case .container: + return dark ? Color(red: 0.97, green: 0.66, blue: 0.51) : Color(red: 0.56, green: 0.30, blue: 0.19) + case .nested: + return .secondary + } + } +} + +struct LocationLevelBadge: View { + let level: LocationLevel + @Environment(\.colorScheme) private var colorScheme + + var body: some View { + let tint = level.tint(for: colorScheme) + Text(level.badge) + .font(.caption2.weight(.semibold)) + .foregroundStyle(tint) + .fixedSize() + .padding(.horizontal, 7) + .padding(.vertical, 3) + .background(tint.opacity(0.13), in: .rect(cornerRadius: 5)) + .overlay { + RoundedRectangle(cornerRadius: 5).strokeBorder(tint.opacity(0.25), lineWidth: 1) + } + } +} + +struct LocationLevelHeading: View { + let level: LocationLevel + + var body: some View { + HStack(spacing: 8) { + LocationLevelBadge(level: level) + Text(level.group).font(.subheadline.weight(.semibold)).foregroundStyle(.primary) + } + .textCase(nil) + .accessibilityElement(children: .combine) + .accessibilityAddTraits(.isHeader) + } } struct LocationMark: View { let store: InventoryStore let place: Place var size: CGFloat = 31 + @Environment(\.colorScheme) private var colorScheme var body: some View { - let tint = LocationLevel(depth: place.levelDepth).tint + let tint = LocationLevel(depth: place.levelDepth).tint(for: colorScheme) let symbol = InventorySymbol.location(place.displayIcon ?? place.icon).image Group { if let photo = place.iconPhotoId { diff --git a/apps/ios/ItemAtlas/ItemAtlasApp.swift b/apps/ios/ItemAtlas/ItemAtlasApp.swift index 3c93f9d..e52d3cc 100644 --- a/apps/ios/ItemAtlas/ItemAtlasApp.swift +++ b/apps/ios/ItemAtlas/ItemAtlasApp.swift @@ -247,7 +247,8 @@ private struct SpaceTabs: View { } private var navigationBar: some View { - HStack(spacing: 0) { + let lift: CGFloat = store.canWrite ? 7 : 0 + return HStack(spacing: 0) { tabButton(.inventory) tabButton(.locations) if store.canWrite { @@ -257,8 +258,10 @@ private struct SpaceTabs: View { .foregroundStyle(.white) .frame(width: 60, height: 60) .background(Color.atlasBlue, in: Circle()) + .shadow(color: Color.atlasBlue.opacity(0.23), radius: 4, y: 2) } .buttonStyle(.plain) + .padding(.bottom, lift) .accessibilityLabel("录入物品") .accessibilityIdentifier("intake.add") .frame(maxWidth: .infinity) @@ -268,10 +271,18 @@ private struct SpaceTabs: View { } .frame(maxWidth: 600) .padding(.horizontal, 10) - .padding(.vertical, 6) + .padding(.top, store.canWrite ? 0 : 6) + .padding(.bottom, 5) .frame(maxWidth: .infinity) - .background(.regularMaterial) - .overlay(alignment: .top) { Divider() } + .background { + VStack(spacing: 0) { + Color.clear.frame(height: lift) + Rectangle() + .fill(.regularMaterial) + .ignoresSafeArea(.container, edges: .bottom) + .overlay(alignment: .top) { Divider() } + } + } } private func tabButton(_ destination: Page) -> some View { @@ -282,7 +293,7 @@ private struct SpaceTabs: View { .accessibilityHidden(true) Text(destination.title).font(.caption2.weight(page == destination ? .semibold : .medium)) } - .foregroundStyle(page == destination ? Color.atlasBlue : Color.secondary) + .foregroundStyle(page == destination ? Color.atlasBlue : Color.primary.opacity(0.80)) .frame(maxWidth: .infinity, minHeight: 48) .contentShape(Rectangle()) } diff --git a/apps/ios/ItemAtlas/LocationPicker.swift b/apps/ios/ItemAtlas/LocationPicker.swift index 729c1e0..bca711d 100644 --- a/apps/ios/ItemAtlas/LocationPicker.swift +++ b/apps/ios/ItemAtlas/LocationPicker.swift @@ -119,8 +119,10 @@ struct LocationSelection: View { ContentUnavailableView("还没有位置", systemImage: "folder", description: Text("请先在「位置」里新建一个存放位置。")) } else if query.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { - Section(LocationLevel.room.title) { + Section { children(tree.children(of: nil), tree: tree) + } header: { + LocationLevelHeading(level: .room) } } else { let matches = tree.matching(query) @@ -147,8 +149,10 @@ struct LocationSelection: View { } .buttonStyle(.plain) } - Section(LocationLevel(depth: parent.levelDepth + 1).title) { + Section { children(tree.children(of: parent.id), tree: tree) + } header: { + LocationLevelHeading(level: LocationLevel(depth: parent.levelDepth + 1)) } } .navigationTitle(parent.name) @@ -180,7 +184,10 @@ struct LocationSelection: View { LocationMark(store: store, place: place) VStack(alignment: .leading, spacing: 4) { Text(title).foregroundStyle(.primary) - if let detail { Text(detail).font(.footnote).foregroundStyle(.secondary) } + if let detail { + Text(detail).font(.footnote).foregroundStyle(.secondary) + LocationLevelBadge(level: LocationLevel(depth: place.levelDepth)) + } } Spacer(minLength: 0) if checked { diff --git a/apps/ios/ItemAtlas/LocationView.swift b/apps/ios/ItemAtlas/LocationView.swift index fb7dca4..d9b8f63 100644 --- a/apps/ios/ItemAtlas/LocationView.swift +++ b/apps/ios/ItemAtlas/LocationView.swift @@ -58,8 +58,7 @@ private struct LocationContents: View { LocationMark(store: store, place: location, size: 38) VStack(alignment: .leading, spacing: 4) { Text(location.path).font(.subheadline) - Text(LocationLevel(depth: location.levelDepth).title) - .font(.caption).foregroundStyle(.secondary) + LocationLevelBadge(level: LocationLevel(depth: location.levelDepth)) } } Button { editingAppearance = true } label: { @@ -98,7 +97,7 @@ private struct LocationContents: View { if !store.locationsReady && error == nil { ProgressView("正在加载位置") } - Section(LocationLevel(depth: (location?.levelDepth ?? 0) + 1).title) { + Section { ForEach(store.locations.filter { $0.parentId == location?.id }) { child in NavigationLink { LocationContents(store: store, initialLocation: child, onIntake: onIntake) } label: { HStack(spacing: 11) { @@ -112,6 +111,8 @@ private struct LocationContents: View { Label(location == nil ? "新建房间或区域" : "新建子位置", systemImage: "plus") } } + } header: { + LocationLevelHeading(level: LocationLevel(depth: (location?.levelDepth ?? 0) + 1)) } if let location { ItemsSection(store: store, results: items, location: location.id) @@ -181,6 +182,7 @@ struct PlaceEditor: View { let personal: Bool let saved: (UUID) -> Void @Environment(\.dismiss) private var dismiss + @Environment(\.colorScheme) private var colorScheme @FocusState private var focused: Bool @State private var name: String @State private var icon: String @@ -218,9 +220,9 @@ struct PlaceEditor: View { if !personal { TextField("名称", text: $name).focused($focused) } - Section(level.title) { + Section { SymbolPicker(symbols: InventorySymbol.palette(level: level, including: icon), - color: level.tint, selection: Binding( + color: level.tint(for: colorScheme), selection: Binding( get: { iconPhoto == nil && !defaultDisplay ? icon : "" }, set: { icon = $0; iconPhoto = nil; defaultDisplay = false } )) @@ -230,6 +232,8 @@ struct PlaceEditor: View { defaultDisplay = true } } + } header: { + LocationLevelHeading(level: level) } if personal, let existing, !photos.isEmpty { Section { @@ -241,12 +245,12 @@ struct PlaceEditor: View { defaultDisplay = false } label: { PhotoImage(store: store, target: .location(existing.id), photo: photo.id, - thumbnail: true, placeholderTint: level.tint) + thumbnail: true, placeholderTint: level.tint(for: colorScheme)) .frame(width: 44, height: 44) .clipShape(.rect(cornerRadius: 7)) .overlay { RoundedRectangle(cornerRadius: 7) - .strokeBorder(iconPhoto == photo.id ? level.tint : .clear, lineWidth: 2) + .strokeBorder(iconPhoto == photo.id ? level.tint(for: colorScheme) : .clear, lineWidth: 2) } } .buttonStyle(.plain) diff --git a/docs/product/ios-experience.md b/docs/product/ios-experience.md index 2dda494..c9230a1 100644 --- a/docs/product/ios-experience.md +++ b/docs/product/ios-experience.md @@ -6,7 +6,7 @@ ## 录入 -底栏是「找物」「位置」「社区」「我的」。中间的蓝色加号打开「录入物品」,关闭后回到刚才的页面。「找物」空页里的「添加物品」进入同一页。房间和子位置的「在这里录入」会带上当前位置。 +底栏是「找物」「位置」「社区」「我的」。中间的蓝色加号略高于栏面,点开进入「录入物品」,关闭后回到刚才的页面。「找物」空页里的「添加物品」进入同一页。房间和子位置的「在这里录入」会带上当前位置。 「智能录入」支持说话或输入文字。录音方式可选点按开始、再点结束,或者按住说、松手结束。看到录音状态再说,每次最多 25 秒,停顿前后的文字会留在同一段。 @@ -26,7 +26,7 @@ ## 位置图标和物品信息 -空间下面第一级是房间和区域,用靛蓝色的房间图标。再往里是蓝色的家具和收纳区、橙色的抽屉和容器。第四级起统一显示为内层容器。列表有层级文字,设备字号较大时,图标选择器会减少每行的个数。 +空间内用小徽标标明层级。房间和区域用金色「一级」,家具和收纳区用银色「二级」,抽屉和容器用铜色「三级」。第四级起统一用灰色「内层」。位置列表、详情、图标编辑和位置选择使用同一套级别标记。设备字号较大时,图标选择器会减少每行的个数。 打开任一级位置,点「图标与缩略图」可选择自己的图标。有详情照片时,也可以挑其中一张当作列表小图。右上角「编辑」可以改名称和空间默认图标。团队成员可各自选择显示样式。 diff --git a/docs/ui/ios-welcome.md b/docs/ui/ios-welcome.md index 89b69d1..7051eed 100644 --- a/docs/ui/ios-welcome.md +++ b/docs/ui/ios-welcome.md @@ -12,7 +12,7 @@ | 登录 | 系统返回按钮、小品牌行、大标题和两个带明确标签的原生输入框。密码默认隐藏,可切换显示。 | | 找物与收藏 | 搜索框贴近标题,缩略图左对齐,物品名和完整位置路径置于同一行组。保留可见的空结果和清除搜索动作。 | | 详情 | 标题、照片、完整位置路径依次展示。移位和编辑靠近位置,按角色展示可用动作。 | -| 位置和录入 | 位置按房间、柜子、收纳盒逐层打开。录入先输入再核对草稿,保留原话、重试和手工录入。 | +| 位置和录入 | 位置按房间、柜子、收纳盒逐层打开,一级、二级和三级用金、银、铜色的文字徽标。录入先输入再核对草稿,保留原话、重试和手工录入。 | 方向稿用于说明主要页面结构。首页现行布局见下文。