对齐有线传图页 Android UI,并改用相对路径持久化本地照片。
还原顶栏、浮动卡片、时间侧栏与底部交互;照片路径改为 CameraDownloads 相对路径并兼容旧数据;格式 Chip 固定 JPG 且不可点击。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -0,0 +1,96 @@
|
||||
//
|
||||
// WiredTransferTimeSidebar.swift
|
||||
// suixinkan
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// 有线传图时间侧栏。
|
||||
struct WiredTransferTimeSidebar: View {
|
||||
let groups: [WiredTransferDateGroup]
|
||||
let selectedSlotID: String?
|
||||
let onToggleSidebar: () -> Void
|
||||
let onTimeSlotSelected: (String) -> Void
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
Button(action: onToggleSidebar) {
|
||||
HStack(spacing: 2) {
|
||||
Image(systemName: "chevron.left")
|
||||
.font(.system(size: 12))
|
||||
Text("收起")
|
||||
.font(.system(size: 11))
|
||||
}
|
||||
.foregroundStyle(WiredTransferDesign.text666)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 10)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
ForEach(groups, id: \.dateLabel) { group in
|
||||
Text(group.dateLabel)
|
||||
.font(.system(size: 12))
|
||||
.foregroundStyle(WiredTransferDesign.text999)
|
||||
.padding(.leading, 10)
|
||||
.padding(.top, 8)
|
||||
.padding(.bottom, 4)
|
||||
ForEach(group.slots) { slot in
|
||||
timeSlotButton(slot)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 12)
|
||||
}
|
||||
}
|
||||
.frame(width: WiredTransferDesign.sidebarWidth)
|
||||
.background(WiredTransferDesign.sidebarBackground)
|
||||
}
|
||||
|
||||
private func timeSlotButton(_ slot: WiredTransferTimeSlot) -> some View {
|
||||
let selected = slot.id == selectedSlotID
|
||||
return Button {
|
||||
onTimeSlotSelected(slot.id)
|
||||
} label: {
|
||||
VStack(spacing: 2) {
|
||||
HStack(spacing: 2) {
|
||||
Image(systemName: "play.fill")
|
||||
.font(.system(size: 8))
|
||||
.foregroundStyle(selected ? AppDesign.primary : WiredTransferDesign.text333)
|
||||
Text(slot.slotStartLabel)
|
||||
.font(.system(size: 13, weight: selected ? .semibold : .regular))
|
||||
.foregroundStyle(selected ? AppDesign.primary : WiredTransferDesign.text333)
|
||||
}
|
||||
Text("\(slot.photoCount)张")
|
||||
.font(.system(size: 10))
|
||||
.foregroundStyle(WiredTransferDesign.text999)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 8)
|
||||
.background(selected ? Color.white : Color.clear)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
||||
/// 侧栏收起后的展开按钮。
|
||||
struct WiredTransferSidebarExpandTab: View {
|
||||
let onExpand: () -> Void
|
||||
|
||||
var body: some View {
|
||||
Button(action: onExpand) {
|
||||
Image(systemName: "chevron.right")
|
||||
.font(.system(size: 14))
|
||||
.foregroundStyle(WiredTransferDesign.text666)
|
||||
.padding(.horizontal, 4)
|
||||
.padding(.vertical, 16)
|
||||
.background(WiredTransferDesign.sidebarBackground)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.padding(.leading, 4)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user