diff --git a/TypeaheadAI.xcodeproj/project.pbxproj b/TypeaheadAI.xcodeproj/project.pbxproj index 6c33b8e..e7318db 100644 --- a/TypeaheadAI.xcodeproj/project.pbxproj +++ b/TypeaheadAI.xcodeproj/project.pbxproj @@ -11,6 +11,8 @@ 2B0B300A2ACD6E6B00338B76 /* UserIntentsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B30092ACD6E6B00338B76 /* UserIntentsView.swift */; }; 2B0B300E2ACEB0E000338B76 /* GenericTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B300D2ACEB0E000338B76 /* GenericTableView.swift */; }; 2B0B30102ACF8C8000338B76 /* SpecialOpenActor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B300F2ACF8C8000338B76 /* SpecialOpenActor.swift */; }; + 2B0B30152ADC978300338B76 /* QuickActionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B30142ADC978300338B76 /* QuickActionsView.swift */; }; + 2B0B30172ADCA09F00338B76 /* CustomWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B30162ADCA09F00338B76 /* CustomWindowController.swift */; }; 2B27450A2AB01CF400F37D3E /* SpecialSaveActor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B2745092AB01CF400F37D3E /* SpecialSaveActor.swift */; }; 2B27450E2AB0380C00F37D3E /* AppContextManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B27450D2AB0380C00F37D3E /* AppContextManager.swift */; }; 2B2745102AB03A3D00F37D3E /* CanSimulateCopy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B27450F2AB03A3D00F37D3E /* CanSimulateCopy.swift */; }; @@ -89,6 +91,8 @@ 2B0B30092ACD6E6B00338B76 /* UserIntentsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserIntentsView.swift; sourceTree = ""; }; 2B0B300D2ACEB0E000338B76 /* GenericTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenericTableView.swift; sourceTree = ""; }; 2B0B300F2ACF8C8000338B76 /* SpecialOpenActor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpecialOpenActor.swift; sourceTree = ""; }; + 2B0B30142ADC978300338B76 /* QuickActionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickActionsView.swift; sourceTree = ""; }; + 2B0B30162ADCA09F00338B76 /* CustomWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomWindowController.swift; sourceTree = ""; }; 2B2745092AB01CF400F37D3E /* SpecialSaveActor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpecialSaveActor.swift; sourceTree = ""; }; 2B27450D2AB0380C00F37D3E /* AppContextManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppContextManager.swift; sourceTree = ""; }; 2B27450F2AB03A3D00F37D3E /* CanSimulateCopy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CanSimulateCopy.swift; sourceTree = ""; }; @@ -302,6 +306,7 @@ 2BA7F0B02A9ABCA5003D38BA /* MenuPromptView.swift */, 2BA7F0B22A9ABCBF003D38BA /* MenuView.swift */, 2B0B30072ACCDA1100338B76 /* VisualEffect.swift */, + 2B0B30162ADCA09F00338B76 /* CustomWindowController.swift */, ); path = Views; sourceTree = ""; @@ -315,6 +320,7 @@ 2B33D87C2AAC3330001193A2 /* ProfileView.swift */, 2BC5271B2ABD9C8200173E12 /* HistoryListView.swift */, 2B520D842AC82EA100310426 /* AccountView.swift */, + 2B0B30142ADC978300338B76 /* QuickActionsView.swift */, ); path = Settings; sourceTree = ""; @@ -506,6 +512,7 @@ 2B0B30102ACF8C8000338B76 /* SpecialOpenActor.swift in Sources */, 2BA7F0822A9ABBA8003D38BA /* Persistence.swift in Sources */, 2B473E892AA85BDD0042913D /* LlamaModelManager.swift in Sources */, + 2B0B30152ADC978300338B76 /* QuickActionsView.swift in Sources */, 2BA7F0B32A9ABCBF003D38BA /* MenuView.swift in Sources */, 2B92BDBB2AA3D10800E65CFA /* ModalManager.swift in Sources */, 2BCF843A2A9DE6DA00359841 /* GeneralSettingsView.swift in Sources */, @@ -515,6 +522,7 @@ 2B4BDB8B2ACC281E00E55D78 /* IntentManager.swift in Sources */, 2BF929872AB16C4C00FC105B /* ResponseParsingTask.swift in Sources */, 2B2EF1502AC40C8F00EF2BD4 /* ChatBubble.swift in Sources */, + 2B0B30172ADCA09F00338B76 /* CustomWindowController.swift in Sources */, 2BC5271C2ABD9C8200173E12 /* HistoryListView.swift in Sources */, 2B37922F2AB8371A008D812F /* SpecialPasteActor.swift in Sources */, 2B0B300A2ACD6E6B00338B76 /* UserIntentsView.swift in Sources */, diff --git a/TypeaheadAI/Views/CustomWindowController.swift b/TypeaheadAI/Views/CustomWindowController.swift new file mode 100644 index 0000000..de75a57 --- /dev/null +++ b/TypeaheadAI/Views/CustomWindowController.swift @@ -0,0 +1,30 @@ +// +// CustomWindowController.swift +// TypeaheadAI +// +// Created by Jeff Hara on 10/15/23. +// + +import AppKit +import Foundation +import Cocoa +import SwiftUI + +class CustomViewController: NSViewController { + + override func viewDidLoad() { + super.viewDidLoad() + } +} + +struct CustomViewControllerRepresentable: NSViewControllerRepresentable { + typealias NSViewControllerType = CustomViewController + + func makeNSViewController(context: Context) -> CustomViewController { + return CustomViewController() + } + + func updateNSViewController(_ nsViewController: CustomViewController, context: Context) { + // Update any properties or configurations of the NSViewController here if needed + } +} diff --git a/TypeaheadAI/Views/Settings/QuickActionsView.swift b/TypeaheadAI/Views/Settings/QuickActionsView.swift new file mode 100644 index 0000000..9079fad --- /dev/null +++ b/TypeaheadAI/Views/Settings/QuickActionsView.swift @@ -0,0 +1,45 @@ +// +// QuickActionsView.swift +// TypeaheadAI +// +// Created by Jeff Hara on 10/15/23. +// + +import SwiftUI + +struct QuickActionsView: View { + @ObservedObject var promptManager: PromptManager + @Environment(\.managedObjectContext) private var viewContext + + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +#Preview { + // Create an in-memory Core Data store + let container = NSPersistentContainer(name: "TypeaheadAI") + container.persistentStoreDescriptions.first?.url = URL(fileURLWithPath: "/dev/null") + container.loadPersistentStores { _, error in + if let error = error as NSError? { + fatalError("Unresolved error \(error), \(error.userInfo)") + } + } + + let context = container.viewContext + let promptManager = PromptManager(context: context) + + // Create some sample prompts + let samplePrompts = ["this is a sample prompt", "this is an active prompt"] + for prompt in samplePrompts { + let newPrompt = PromptEntry(context: context) + newPrompt.prompt = prompt + promptManager.addPrompt(prompt) + } + + return QuickActionsView( + promptManager: promptManager + ) + .environment(\.managedObjectContext, context) + .frame(width: 600, height: 400) +} diff --git a/TypeaheadAI/Views/Settings/SettingsView.swift b/TypeaheadAI/Views/Settings/SettingsView.swift index 56814b2..47fc3d4 100644 --- a/TypeaheadAI/Views/Settings/SettingsView.swift +++ b/TypeaheadAI/Views/Settings/SettingsView.swift @@ -10,6 +10,7 @@ import SwiftUI enum Tab: String, CaseIterable, Identifiable { case general = "General" case profile = "Profile" + case quickActions = "Quick Actions" case history = "History" case incognito = "Incognito Mode" case account = "Account Settings" @@ -30,9 +31,11 @@ struct SettingsView: View { } .listStyle(SidebarListStyle()) .frame(minWidth: 200) + .background(VisualEffect().ignoresSafeArea()) viewForTab(settingsTab) } + .background(VisualEffect().ignoresSafeArea()) } private func viewForTab(_ tab: String) -> some View { @@ -45,6 +48,8 @@ struct SettingsView: View { return AnyView(ProfileView()) case .general: return AnyView(GeneralSettingsView(promptManager: promptManager)) + case .quickActions: + return AnyView(QuickActionsView(promptManager: promptManager)) case .history: return AnyView(HistoryListView()) case .incognito: diff --git a/TypeaheadAI/Views/VisualEffect.swift b/TypeaheadAI/Views/VisualEffect.swift index 0aa5481..588ce88 100644 --- a/TypeaheadAI/Views/VisualEffect.swift +++ b/TypeaheadAI/Views/VisualEffect.swift @@ -9,6 +9,13 @@ import Foundation import SwiftUI struct VisualEffect: NSViewRepresentable { - func makeNSView(context: Self.Context) -> NSView { return NSVisualEffectView() } + func makeNSView(context: Self.Context) -> NSView { + let view = NSVisualEffectView() + view.blendingMode = .behindWindow + view.state = .active + view.material = .hudWindow + return view + } + func updateNSView(_ nsView: NSView, context: Context) { } }