Skip to content

Commit

Permalink
Add Account Settings NavigationLink from Tab Bar Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf committed Jan 21, 2024
1 parent 32ae025 commit 1b6b79f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
17 changes: 17 additions & 0 deletions Mlem/Views/Tabs/Settings/Components/Settings Item.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,23 @@ struct SettingsButtonStyle: ButtonStyle {
}
}

struct FooterLinkView: View {
let title: String
let destination: AppRoute

var body: some View {
NavigationLink(destination) {
HStack(spacing: 3) {
Text(title)
Image(systemName: Icons.forward)
.fontWeight(.semibold)
.imageScale(.small)
}
.font(.footnote)
}
}
}

struct CheckboxToggleStyle: ToggleStyle {
func makeBody(configuration: Configuration) -> some View {
HStack {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct TabBarSettingsView: View {

// TODO: options like this will need to be updated to only show when there is an active account
// present once guest mode is fully implemented
Section("Profile Icon Appearance") {
Section {
HStack {
ForEach(ProfileTabLabel.allCases, id: \.self) { item in
VStack(spacing: 10) {
Expand Down Expand Up @@ -74,6 +74,15 @@ struct TabBarSettingsView: View {
isTicked: profileTabLabel == .anonymous ? .constant(false) : $showUserAvatar
)
.disabled(profileTabLabel == .anonymous)
} header: {
Text("Profile Icon Appearance")
} footer: {
if profileTabLabel == .nickname {
VStack(alignment: .leading, spacing: 3) {
Text("You can change your account's local nickname in Account Settings.")
FooterLinkView(title: "Account Settings", destination: .settings(.accountLocal))
}
}
}
}
.fancyTabScrollCompatible()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,7 @@ struct GeneralSettingsView: View {

// TODO: 0.17 deprecation remove this check
if (siteInformation.version ?? .zero) >= .init("0.18.0") {

NavigationLink(.settings(.accountGeneral)) {
HStack(spacing: 3) {
Text("Account Settings")
Image(systemName: "chevron.right")
.fontWeight(.semibold)
.imageScale(.small)
}
.font(.footnote)
}

FooterLinkView(title: "Account Settings", destination: .settings(.accountGeneral))
}
}
}
Expand Down

0 comments on commit 1b6b79f

Please sign in to comment.