Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions Flipcash/Core/Screens/Profile/ChatMuteRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,20 @@ import FlipcashUI
/// grew was the muted one.
struct ChatMuteRow: View {

/// How the trailing chevron draws. The two hosts style it differently and each is right on its
/// own screen, so the caller says which rather than one of them taking the other's look.
enum Chevron {
/// ``Row``'s own accessory chevron, matching the chat profile's other rows.
case standard
/// The smaller secondary chevron the user profile uses to match its profile card.
case secondary
}

let conversationID: ConversationID
let insets: EdgeInsets
var chevron: Chevron = .standard

@State private var isPickingDuration = false

var body: some View {
Row(insets: insets, accessory: chevron == .standard ? .chevron : nil) {
// No chevron: this row opens a sheet rather than pushing a screen. The spacer is the one
// the accessory would have brought, holding the label against the leading edge.
Row(insets: insets) {
Image(systemName: "bell.slash")
.frame(minWidth: 45)
Text("Mute Notifications")
.foregroundStyle(.textMain)

if chevron == .secondary {
// Nothing has claimed the slack, so the chevron needs the spacer the accessory
// would have brought.
Spacer()
Image(systemName: "chevron.right")
.font(.caption2)
.foregroundStyle(.textSecondary)
}
Spacer()
} action: {
isPickingDuration = true
}
Expand Down
9 changes: 7 additions & 2 deletions Flipcash/Core/Screens/Profile/ChatProfileScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ struct ChatProfileScreen: View {

VStack(spacing: 0) {
if isMember {
Row(insets: rowInsets, accessory: .chevron) {
Row(insets: rowInsets) {
Image(systemName: "person.badge.plus")
.frame(minWidth: 45)
Text("Invite People To Join")
.foregroundStyle(.textMain)
Spacer()
} action: {
isInviting = true
}
Expand All @@ -113,12 +114,16 @@ struct ChatProfileScreen: View {
Row(
insets: rowInsets,
disabled: isLeaving,
accessory: isLeaving ? .loader(.textMain) : .chevron
accessory: isLeaving ? .loader(.textMain) : nil
) {
Image(systemName: "rectangle.portrait.and.arrow.right")
.frame(minWidth: 45)
Text("Leave Group")
.foregroundStyle(.textMain)
// Only while idle: the loader accessory brings its own spacer.
if !isLeaving {
Spacer()
}
} action: {
dialogItem = leaveDialog()
}
Expand Down
14 changes: 3 additions & 11 deletions Flipcash/Core/Screens/Profile/ReportRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,17 @@ struct ReportRow: View {

let target: ReportTarget
let insets: EdgeInsets
var chevron: ChatMuteRow.Chevron = .standard

@State private var isReporting = false

var body: some View {
Row(insets: insets, accessory: chevron == .standard ? .chevron : nil) {
// No chevron: this row opens the reason flow as a cover rather than pushing a screen.
Row(insets: insets) {
Image(systemName: "flag")
.frame(minWidth: 45)
Text("Report")
.foregroundStyle(.textMain)

if chevron == .secondary {
// Nothing has claimed the slack, so the chevron needs the spacer the accessory
// would have brought.
Spacer()
Image(systemName: "chevron.right")
.font(.caption2)
.foregroundStyle(.textSecondary)
}
Spacer()
} action: {
isReporting = true
}
Expand Down
8 changes: 2 additions & 6 deletions Flipcash/Core/Screens/Profile/UserProfileScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,17 @@ private struct UserProfileContent: View {
// one that asks someone else to look, then the one that ends the relationship.
// Same shape as a group's profile, where leaving holds the last place.
if let conversationID {
ChatMuteRow(conversationID: conversationID, insets: rowInsets, chevron: .secondary)
ChatMuteRow(conversationID: conversationID, insets: rowInsets)
}

ReportRow(target: .user(model.userID), insets: rowInsets, chevron: .secondary)
ReportRow(target: .user(model.userID), insets: rowInsets)

Row(insets: rowInsets) {
Image(systemName: "nosign")
.frame(minWidth: 45)
Text("Block")
.foregroundStyle(.textMain)
Spacer()
// Secondary (alpha-white) chevron, matching the profile card.
Image(systemName: "chevron.right")
.font(.caption2)
.foregroundStyle(.textSecondary)
} action: {
dialogItem = blockDialog()
}
Expand Down
Loading