Add LoggedInView with tabs
This commit is contained in:
@@ -16,8 +16,11 @@
|
|||||||
"Done" : {
|
"Done" : {
|
||||||
"comment" : "Button to go to the next view that adds the user’s entered private key."
|
"comment" : "Button to go to the next view that adds the user’s entered private key."
|
||||||
},
|
},
|
||||||
|
"History" : {
|
||||||
|
"comment" : "Title for History tab"
|
||||||
|
},
|
||||||
"Home" : {
|
"Home" : {
|
||||||
"comment" : "Navigation title of home view."
|
"comment" : "Navigation title of home view.\nTitle for Home tab"
|
||||||
},
|
},
|
||||||
"Hooo-raaaayyy!" : {
|
"Hooo-raaaayyy!" : {
|
||||||
"comment" : "Title of view that confirms the user’s selection of the signing policy."
|
"comment" : "Title of view that confirms the user’s selection of the signing policy."
|
||||||
@@ -31,6 +34,9 @@
|
|||||||
"nsec / private key" : {
|
"nsec / private key" : {
|
||||||
"comment" : "Prompt asking user to enter in a Nostr 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." : {
|
"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."
|
"comment" : "Description of event signing policy that approves basic actions."
|
||||||
},
|
},
|
||||||
@@ -40,8 +46,11 @@
|
|||||||
"Select a signing policy" : {
|
"Select a signing policy" : {
|
||||||
"comment" : "Title of view to 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?" : {
|
"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" : {
|
"Yeti: Nostr Helper" : {
|
||||||
"comment" : "Application title."
|
"comment" : "Application title."
|
||||||
|
|||||||
@@ -12,33 +12,8 @@ struct ContentView: View {
|
|||||||
@Environment(\.modelContext) private var modelContext
|
@Environment(\.modelContext) private var modelContext
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
// OnboardingView()
|
||||||
Text("Yeti: Nostr Helper", comment: "Application title.")
|
LoggedInView()
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
18
Yeti/Views/HistoryView.swift
Normal file
18
Yeti/Views/HistoryView.swift
Normal 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
18
Yeti/Views/HomeView.swift
Normal 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()
|
||||||
|
}
|
||||||
68
Yeti/Views/LoggedInView.swift
Normal file
68
Yeti/Views/LoggedInView.swift
Normal 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()
|
||||||
|
}
|
||||||
44
Yeti/Views/OnboardingView.swift
Normal file
44
Yeti/Views/OnboardingView.swift
Normal 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()
|
||||||
|
}
|
||||||
18
Yeti/Views/PermissionsView.swift
Normal file
18
Yeti/Views/PermissionsView.swift
Normal 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()
|
||||||
|
}
|
||||||
18
Yeti/Views/SettingsView.swift
Normal file
18
Yeti/Views/SettingsView.swift
Normal 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()
|
||||||
|
}
|
||||||
@@ -24,7 +24,10 @@ struct SigningPolicySelectionView: View {
|
|||||||
.listRowInsets(EdgeInsets())
|
.listRowInsets(EdgeInsets())
|
||||||
.background(Color(UIColor.systemGroupedBackground))
|
.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)
|
.font(.caption)
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
|
||||||
.listRowInsets(EdgeInsets())
|
.listRowInsets(EdgeInsets())
|
||||||
|
|||||||
Reference in New Issue
Block a user