Added a basic package detail window that shows up before installation

This commit is contained in:
David Bureš 2022-07-23 10:44:31 +02:00 committed by David Bureš
parent 924fd0671e
commit d6e2548d89
4 changed files with 82 additions and 0 deletions

View File

@ -32,6 +32,8 @@
63958D00287735F800E0B807 /* About View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63958CFF287735F800E0B807 /* About View.swift */; };
639A7D832871D08200B50280 /* Add Formula.swift in Sources */ = {isa = PBXBuildFile; fileRef = 639A7D822871D08200B50280 /* Add Formula.swift */; };
639A7D862871D78C00B50280 /* Package Details.swift in Sources */ = {isa = PBXBuildFile; fileRef = 639A7D852871D78C00B50280 /* Package Details.swift */; };
63CD0276288B22D9004AE2EC /* View - New Windows.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CD0275288B22D9004AE2EC /* View - New Windows.swift */; };
63CD0279288B2316004AE2EC /* Package Detail Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CD0278288B2316004AE2EC /* Package Detail Window.swift */; };
63D8C955287A15C300483A52 /* Load up Installed Packages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D8C954287A15C300483A52 /* Load up Installed Packages.swift */; };
63D8C957287A1D0800483A52 /* Loading View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D8C956287A1D0800483A52 /* Loading View.swift */; };
/* End PBXBuildFile section */
@ -63,6 +65,8 @@
63958CFF287735F800E0B807 /* About View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "About View.swift"; sourceTree = "<group>"; };
639A7D822871D08200B50280 /* Add Formula.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Add Formula.swift"; sourceTree = "<group>"; };
639A7D852871D78C00B50280 /* Package Details.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Package Details.swift"; sourceTree = "<group>"; };
63CD0275288B22D9004AE2EC /* View - New Windows.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View - New Windows.swift"; sourceTree = "<group>"; };
63CD0278288B2316004AE2EC /* Package Detail Window.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Package Detail Window.swift"; sourceTree = "<group>"; };
63D8C954287A15C300483A52 /* Load up Installed Packages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Load up Installed Packages.swift"; sourceTree = "<group>"; };
63D8C956287A1D0800483A52 /* Loading View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Loading View.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -98,6 +102,7 @@
634065632871AA42001A2178 /* Cork */ = {
isa = PBXGroup;
children = (
63CD0274288B22C8004AE2EC /* Extensions */,
639A7D812871D07800B50280 /* Views */,
6340657B2871AC4F001A2178 /* Models */,
634065762871AB2A001A2178 /* Logic */,
@ -209,6 +214,7 @@
639A7D812871D07800B50280 /* Views */ = {
isa = PBXGroup;
children = (
63CD0277288B2307004AE2EC /* Package Details */,
63958CFE287735ED00E0B807 /* About */,
637E006C28734189005C9890 /* Installation */,
6371EA1C2871D96800300E1B /* Packages */,
@ -217,6 +223,22 @@
path = Views;
sourceTree = "<group>";
};
63CD0274288B22C8004AE2EC /* Extensions */ = {
isa = PBXGroup;
children = (
63CD0275288B22D9004AE2EC /* View - New Windows.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
63CD0277288B2307004AE2EC /* Package Details */ = {
isa = PBXGroup;
children = (
63CD0278288B2316004AE2EC /* Package Detail Window.swift */,
);
path = "Package Details";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -299,6 +321,7 @@
637E00622872F1AF005C9890 /* Search Result.swift in Sources */,
637E006828733C1C005C9890 /* Search for Package by ID.swift in Sources */,
6340657A2871AC27001A2178 /* Brew Data Storage.swift in Sources */,
63CD0276288B22D9004AE2EC /* View - New Windows.swift in Sources */,
63D8C957287A1D0800483A52 /* Loading View.swift in Sources */,
6340657F2871AF68001A2178 /* App Constants.swift in Sources */,
634065672871AA42001A2178 /* ContentView.swift in Sources */,
@ -312,6 +335,7 @@
63D8C955287A15C300483A52 /* Load up Installed Packages.swift in Sources */,
6371EA232871EE5A00300E1B /* Brew Interface.swift in Sources */,
637E00662872F629005C9890 /* Update Progress Tracker.swift in Sources */,
63CD0279288B2316004AE2EC /* Package Detail Window.swift in Sources */,
637E006E2873419B005C9890 /* Install Progress Tracker.swift in Sources */,
63958CFD2877341F00E0B807 /* AppDelegate.swift in Sources */,
63958D00287735F800E0B807 /* About View.swift in Sources */,

View File

@ -0,0 +1,27 @@
//
// View - New Windows.swift
// Cork
//
// Created by David Bureš on 22.07.2022.
//
import SwiftUI
extension View {
private func newWindowInternal(with title: String) -> NSWindow {
let window = NSWindow(
contentRect: NSRect(x: 20, y: 20, width: 680, height: 600),
styleMask: [.titled, .closable, .resizable, .fullSizeContentView],
backing: .buffered,
defer: false)
window.center()
window.isReleasedWhenClosed = false
window.title = title
window.makeKeyAndOrderFront(nil)
return window
}
func openNewWindow(with title: String = "new Window") {
self.newWindowInternal(with: title).contentView = NSHostingView(rootView: self)
}
}

View File

@ -152,6 +152,13 @@ struct AddFormulaView: View {
HStack {
Button {
// TODO: Add logic that will show the user more information about the selected package
let selectedPackages: [String] = getPackageNamesFromUUID(selectionBinding: foundPackageSelection, tracker: searchResultTracker)
for selectedPackage in selectedPackages {
PackageDetailWindow(package: selectedPackage).openNewWindow()
}
} label: {
Text("More info")
}

View File

@ -0,0 +1,24 @@
//
// Package Detail View.swift
// Cork
//
// Created by David Bureš on 22.07.2022.
//
import SwiftUI
struct PackageDetailWindow: View {
@State var package: String
var body: some View {
VStack {
Text(package)
}
.frame(width: 200, height: 100, alignment: .topLeading)
.onAppear {
Task {
}
}
}
}