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