swipe to delete address

This commit is contained in:
Daniel Arantes Loverde
2026-02-12 18:39:02 -03:00
parent c7740174d1
commit 4a40936293
4 changed files with 348 additions and 128 deletions

View File

@@ -40,15 +40,12 @@ struct StoreDetailView: View {
AppColors.backgroundLight.ignoresSafeArea()
ScrollView(showsIndicators: false) {
LazyVStack(spacing: 0) {
LazyVStack(spacing: 0, pinnedViews: [.sectionHeaders]) {
topSection
categoryTabs(proxy: proxy, safeTop: safeTop, isSticky: false)
sectionedProducts
.padding(.horizontal, 16)
.padding(.top, 12)
.padding(.bottom, 120)
}
}
.ignoresSafeArea(edges: .top)
@@ -58,27 +55,10 @@ struct StoreDetailView: View {
.overlay(alignment: .top) {
if isCategoryTabsPinned(safeTop: safeTop) {
categoryTabs(proxy: proxy, safeTop: safeTop, isSticky: true)
.transition(.opacity)
.zIndex(20)
.transition(.opacity)
.zIndex(20)
}
}
.overlay(alignment: .topTrailing) {
VStack(alignment: .trailing, spacing: 2) {
Text("safe \(debugNumber(safeTop))")
Text("offset \(debugNumber(scrollOffsetY))")
Text("th \(debugNumber(categoryTabsPinThreshold(safeTop: safeTop)))")
Text("pin \(isCategoryTabsPinned(safeTop: safeTop) ? 1 : 0)")
Text("inset \(debugNumber(categoryTabsPinnedInset(safeTop: safeTop)))")
}
.font(.system(size: 11, weight: .semibold, design: .monospaced))
.foregroundStyle(.white)
.padding(8)
.background(Color.black.opacity(0.7))
.clipShape(RoundedRectangle(cornerRadius: 10, style: .continuous))
.padding(.top, safeTop + 6)
.padding(.trailing, 8)
.allowsHitTesting(false)
}
}
}
.navigationBarBackButtonHidden(true)
@@ -163,7 +143,7 @@ struct StoreDetailView: View {
.frame(width: storeLogoSize, height: storeLogoSize)
.overlay(
Circle()
.stroke(Color.white, lineWidth: 5)
.stroke(Color.white, lineWidth: 0.1)
)
AsyncStoreImage(imageURL: resolvedURL(storeLogoURL))
@@ -231,31 +211,39 @@ struct StoreDetailView: View {
.font(AppTypography.body)
.foregroundStyle(AppColors.textMuted)
.padding(.top, 16)
.padding(.horizontal, 16)
.padding(.bottom, 120)
} else {
VStack(alignment: .leading, spacing: 26) {
ForEach(categories, id: \.id) { category in
VStack(alignment: .leading, spacing: 12) {
Text(category.name)
.font(AppTypography.heading2)
.foregroundStyle(AppColors.textPrimary)
.id(sectionAnchorId(for: category.id))
.background(
GeometryReader { geometry in
Color.clear.preference(
key: CategoryHeaderOffsetPreferenceKey.self,
value: [category.id: geometry.frame(in: .global).minY]
)
}
)
VStack(spacing: 12) {
ForEach(category.products) { product in
productCard(product)
}
ForEach(categories, id: \.id) { category in
Section {
VStack(spacing: 12) {
ForEach(category.products) { product in
productCard(product)
}
}
.padding(.horizontal, 16)
.padding(.bottom, 8)
} header: {
Text(category.name)
.font(AppTypography.heading2)
.foregroundStyle(AppColors.textPrimary)
.id(sectionAnchorId(for: category.id))
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 16)
.padding(.top, 8)
.padding(.bottom, 8)
.background(AppColors.backgroundLight)
.background(
GeometryReader { geometry in
Color.clear.preference(
key: CategoryHeaderOffsetPreferenceKey.self,
value: [category.id: geometry.frame(in: .global).minY]
)
}
)
}
}
Color.clear.frame(height: 120)
}
}
@@ -304,19 +292,6 @@ struct StoreDetailView: View {
max(8, safeTop - 44)
}
private func debugNumber(_ value: CGFloat) -> String {
if value.isFinite == false {
return "inf"
}
if value > CGFloat(Int.max) {
return "max+"
}
if value < CGFloat(Int.min) {
return "min-"
}
return String(Int(value.rounded()))
}
private func productCard(_ product: StoreCatalogProduct) -> some View {
HStack(spacing: 12) {
VStack(alignment: .leading, spacing: 8) {