Add LoggedInView with tabs

This commit is contained in:
2025-01-20 21:34:14 -05:00
parent 999a964f7a
commit 9fec884e19
9 changed files with 205 additions and 34 deletions

View File

@@ -16,8 +16,11 @@
"Done" : {
"comment" : "Button to go to the next view that adds the users entered private key."
},
"History" : {
"comment" : "Title for History tab"
},
"Home" : {
"comment" : "Navigation title of home view."
"comment" : "Navigation title of home view.\nTitle for Home tab"
},
"Hooo-raaaayyy!" : {
"comment" : "Title of view that confirms the users selection of the signing policy."
@@ -31,6 +34,9 @@
"nsec / private key" : {
"comment" : "Prompt asking user to enter in a Nostr private key."
},
"Permissions" : {
"comment" : "Title for Permissions tab"
},
"Recommended for most people. This policy will minimize the number of interruptions during your app usage." : {
"comment" : "Description of event signing policy that approves basic actions."
},
@@ -40,8 +46,11 @@
"Select a signing policy" : {
"comment" : "Title of view to select a signing policy."
},
"Settings" : {
"comment" : "Title for Settings tab"
},
"Should I approve Nostr events automatically or would you like to review them for each app?" : {
"comment" : "Prompt asking user which signing policy to use."
},
"Yeti: Nostr Helper" : {
"comment" : "Application title."

View File

@@ -12,33 +12,8 @@ struct ContentView: View {
@Environment(\.modelContext) private var modelContext
var body: some View {
NavigationStack {
Text("Yeti: Nostr Helper", comment: "Application title.")
HStack {
NavigationLink(
destination: {
AddKeyView()
},
label: {
Text("Add a key", comment: "Button to add a key.")
}
)
.buttonStyle(.bordered)
NavigationLink(
destination: {
AddKeyView()
},
label: {
Text("Create a key", comment: "Button to create a key.")
}
)
.buttonStyle(.borderedProminent)
}
}
.navigationTitle(String(localized: "Home", comment: "Navigation title of home view."))
.toolbar(removing: .title)
// OnboardingView()
LoggedInView()
}
}

View File

@@ -0,0 +1,18 @@
//
// HistoryView.swift
// Yeti
//
// Created by Terry Yiu on 1/20/25.
//
import SwiftUI
struct HistoryView: View {
var body: some View {
EmptyView()
}
}
#Preview {
HistoryView()
}

18
Yeti/Views/HomeView.swift Normal file
View File

@@ -0,0 +1,18 @@
//
// HomeView.swift
// Yeti
//
// Created by Terry Yiu on 1/20/25.
//
import SwiftUI
struct HomeView: View {
var body: some View {
EmptyView()
}
}
#Preview {
HomeView()
}

View File

@@ -0,0 +1,68 @@
//
// LoggedInView.swift
// Yeti
//
// Created by Terry Yiu on 1/20/25.
//
import SwiftUI
struct LoggedInView: View {
@State var selectedTab: YetiTab = .home
var body: some View {
TabView(selection: $selectedTab) {
ForEach(YetiTab.allCases, id: \.self) { yetiTab in
Tab(yetiTab.description, systemImage: yetiTab.systemImage, value: yetiTab) {
switch yetiTab {
case .home:
HomeView()
case .permissions:
PermissionsView()
case .history:
HistoryView()
case .settings:
SettingsView()
}
}
}
}
}
}
enum YetiTab: CustomStringConvertible, CaseIterable {
case home
case permissions
case history
case settings
var description: String {
switch self {
case .home:
String(localized: "Home", comment: "Title for Home tab")
case .permissions:
String(localized: "Permissions", comment: "Title for Permissions tab")
case .history:
String(localized: "History", comment: "Title for History tab")
case .settings:
String(localized: "Settings", comment: "Title for Settings tab")
}
}
var systemImage: String {
switch self {
case .home:
"house"
case .permissions:
"shield.lefthalf.filled.badge.checkmark"
case .history:
"clock"
case .settings:
"gear"
}
}
}
#Preview {
LoggedInView()
}

View File

@@ -0,0 +1,44 @@
//
// OnboardingView.swift
// Yeti
//
// Created by Terry Yiu on 1/20/25.
//
import SwiftUI
struct OnboardingView: View {
var body: some View {
NavigationStack {
Text("Yeti: Nostr Helper", comment: "Application title.")
HStack {
NavigationLink(
destination: {
AddKeyView()
},
label: {
Text("Add a key", comment: "Button to add a key.")
}
)
.buttonStyle(.bordered)
NavigationLink(
destination: {
AddKeyView()
},
label: {
Text("Create a key", comment: "Button to create a key.")
}
)
.buttonStyle(.borderedProminent)
}
}
.navigationTitle(String(localized: "Home", comment: "Navigation title of home view."))
.toolbar(removing: .title)
}
}
#Preview {
OnboardingView()
}

View File

@@ -0,0 +1,18 @@
//
// PermissionsView.swift
// Yeti
//
// Created by Terry Yiu on 1/20/25.
//
import SwiftUI
struct PermissionsView: View {
var body: some View {
EmptyView()
}
}
#Preview {
PermissionsView()
}

View File

@@ -0,0 +1,18 @@
//
// SettingsView.swift
// Yeti
//
// Created by Terry Yiu on 1/20/25.
//
import SwiftUI
struct SettingsView: View {
var body: some View {
EmptyView()
}
}
#Preview {
SettingsView()
}

View File

@@ -24,7 +24,10 @@ struct SigningPolicySelectionView: View {
.listRowInsets(EdgeInsets())
.background(Color(UIColor.systemGroupedBackground))
Text("Should I approve Nostr events automatically or would you like to review them for each app?")
Text(
"Should I approve Nostr events automatically or would you like to review them for each app?",
comment: "Prompt asking user which signing policy to use."
)
.font(.caption)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
.listRowInsets(EdgeInsets())