change button in profile

This commit is contained in:
cheykrym 2025-12-11 02:03:36 +03:00
parent 55839ffd5d
commit 66bd6a99d4
2 changed files with 40 additions and 33 deletions

View File

@ -1943,9 +1943,6 @@
"Перейдите в раздел \"Настройки > Сменить пароль\" и следуйте инструкциям." : { "Перейдите в раздел \"Настройки > Сменить пароль\" и следуйте инструкциям." : {
"comment" : "FAQ answer: reset password" "comment" : "FAQ answer: reset password"
}, },
"Перестанет появляться в чате и не сможет писать." : {
"comment" : "Message profile block subtitle"
},
"Плитки как в Telegram — скоро здесь появятся вложения из чата." : { "Плитки как в Telegram — скоро здесь появятся вложения из чата." : {
"comment" : "Message profile media description" "comment" : "Message profile media description"
}, },
@ -2119,9 +2116,6 @@
} }
} }
}, },
"Пользователь снова сможет писать вам." : {
"comment" : "Message profile unblock subtitle"
},
"Пользователь удалён" : { "Пользователь удалён" : {
"comment" : "Message profile deleted user status" "comment" : "Message profile deleted user status"
}, },
@ -2165,9 +2159,6 @@
"Появится мутация на 1 час, 1 день или навсегда." : { "Появится мутация на 1 час, 1 день или навсегда." : {
"comment" : "Message profile mute action description" "comment" : "Message profile mute action description"
}, },
"Появится отдельная запись в адресной книге Yobble." : {
"comment" : "Message profile add to contacts subtitle"
},
"Правила сервиса" : { "Правила сервиса" : {
}, },

View File

@ -258,31 +258,23 @@ struct MessageProfileView: View {
if shouldShowRelationshipQuickActions { if shouldShowRelationshipQuickActions {
rowDivider rowDivider
VStack(spacing: 8) { filledActionButton(
buttonRow(
icon: "person.badge.plus",
title: NSLocalizedString("Добавить в контакты", comment: "Message profile add to contacts title"), title: NSLocalizedString("Добавить в контакты", comment: "Message profile add to contacts title"),
subtitle: NSLocalizedString("Появится отдельная запись в адресной книге Yobble.", comment: "Message profile add to contacts subtitle"), tint: Color.accentColor
iconTint: .accentColor
) { ) {
handleAddContactTap() handleAddContactTap()
} }
buttonRow( rowDivider
icon: "hand.raised.slash.fill", filledActionButton(
title: isBlockedByCurrentUser title: isBlockedByCurrentUser
? NSLocalizedString("Разблокировать", comment: "Message profile unblock title") ? NSLocalizedString("Разблокировать", comment: "Message profile unblock title")
: NSLocalizedString("Заблокировать", comment: "Message profile block title"), : NSLocalizedString("Заблокировать", comment: "Message profile block title"),
subtitle: isBlockedByCurrentUser tint: isBlockedByCurrentUser ? Color.green : Color.red
? NSLocalizedString("Пользователь снова сможет писать вам.", comment: "Message profile unblock subtitle")
: NSLocalizedString("Перестанет появляться в чате и не сможет писать.", comment: "Message profile block subtitle"),
iconTint: .red,
destructive: true
) { ) {
handleBlockToggleTap() handleBlockToggleTap()
} }
}
.padding(.top, 4)
} }
} }
@ -483,6 +475,30 @@ struct MessageProfileView: View {
.buttonStyle(.plain) .buttonStyle(.plain)
} }
private func filledActionButton(
title: String,
subtitle: String? = nil,
tint: Color,
action: @escaping () -> Void
) -> some View {
Button(action: action) {
VStack(alignment: .leading, spacing: 4) {
Text(title)
.font(.body)
.fontWeight(.semibold)
if let subtitle {
Text(subtitle)
.font(.caption)
.foregroundColor(tint.opacity(0.7))
}
}
.foregroundColor(tint)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.vertical, 10)
}
.buttonStyle(.plain)
}
private func iconBackground<Content: View>(color: Color, @ViewBuilder content: () -> Content) -> some View { private func iconBackground<Content: View>(color: Color, @ViewBuilder content: () -> Content) -> some View {
RoundedRectangle(cornerRadius: 14, style: .continuous) RoundedRectangle(cornerRadius: 14, style: .continuous)
.fill(color) .fill(color)