diff --git a/yobble/Views/Tab/Settings/SettingsView.swift b/yobble/Views/Tab/Settings/SettingsView.swift index 6987a92..cf402f0 100644 --- a/yobble/Views/Tab/Settings/SettingsView.swift +++ b/yobble/Views/Tab/Settings/SettingsView.swift @@ -27,6 +27,7 @@ struct SettingsView: View { if isMessengerModeEnabled { messengerProfileHeaderSection + aboutSection } // MARK: - Профиль @@ -360,6 +361,88 @@ struct SettingsView: View { formatter.timeStyle = .none return formatter }() + + private var aboutSection: some View { + if messengerProfile != nil || isMessengerProfileLoading || messengerProfileError != nil { + Section { + card { + VStack(spacing: 0) { + + if let login = loginDisplay { + infoRow( + title: NSLocalizedString("Юзернейм", comment: ""), + value: login + ) + }else{ + infoRow( + title: NSLocalizedString("Юзернейм", comment: ""), + value: "Неизвестный пользователь" + ) + } + + if let membership = membershipDescription { + rowDivider + infoRow( + title: NSLocalizedString("Дата регистрации в Yobble", comment: ""), + value: membership + ) + } + + if loginDisplay != nil || membershipDescription != nil { + rowDivider + } + + infoRow( + title: NSLocalizedString("Ваш рейтинг", comment: "Message profile rating title"), + value: ratingDisplayValue + ) + } + } + } + } + } + + private func infoRow(icon: String? = nil, title: String, value: String) -> some View { + HStack(alignment: .top, spacing: 12) { + if let icon { + iconBackground(color: .accentColor.opacity(0.18)) { + Image(systemName: icon) + .font(.system(size: 17, weight: .semibold)) + .foregroundColor(.accentColor) + } + } + + VStack(alignment: .leading, spacing: 4) { + Text(title) + .font(.caption) + .foregroundColor(.secondary) + Text(value) + .font(.body) + } + + Spacer() + } + .padding(.vertical, 4) + } + + private func iconBackground(color: Color, @ViewBuilder content: () -> Content) -> some View { + RoundedRectangle(cornerRadius: 14, style: .continuous) + .fill(color) + .frame(width: 44, height: 44) + .overlay(content()) + } + + private func card(@ViewBuilder content: () -> Content) -> some View { + VStack(alignment: .leading, spacing: 16) { + content() + } + .padding(20) + .frame(maxWidth: .infinity, alignment: .leading) + .background( + RoundedRectangle(cornerRadius: 28, style: .continuous) + .fill(Color(UIColor.secondarySystemGroupedBackground)) + ) + } } private struct LegacySupportBanner: View {