adds nice git interface
This commit is contained in:
@@ -7,6 +7,8 @@ struct SearchOverlay: View {
|
||||
@State private var model: SearchModel
|
||||
/// Paths with a git change get a dot in the files column.
|
||||
var changedPaths: Set<String>
|
||||
/// Full screen hides the traffic lights, so the query bar reclaims their inset.
|
||||
var isFullScreen: Bool
|
||||
var onOpen: (SearchModel.Target) -> Void
|
||||
var onClose: () -> Void
|
||||
|
||||
@@ -14,15 +16,17 @@ struct SearchOverlay: View {
|
||||
@State private var parkedPointer: CGPoint?
|
||||
@State private var hoveredGroup: String?
|
||||
|
||||
init(model: SearchModel, changedPaths: Set<String>, onOpen: @escaping (SearchModel.Target) -> Void, onClose: @escaping () -> Void) {
|
||||
init(model: SearchModel, changedPaths: Set<String>, isFullScreen: Bool,
|
||||
onOpen: @escaping (SearchModel.Target) -> Void, onClose: @escaping () -> Void) {
|
||||
_model = State(initialValue: model)
|
||||
self.changedPaths = changedPaths
|
||||
self.isFullScreen = isFullScreen
|
||||
self.onOpen = onOpen
|
||||
self.onClose = onClose
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
OverlayShell(.inset, onDismiss: onClose) {
|
||||
OverlayShell(.fullScreen, onDismiss: onClose) {
|
||||
VStack(spacing: 0) {
|
||||
queryBar.zIndex(1)
|
||||
columns
|
||||
@@ -54,7 +58,8 @@ struct SearchOverlay: View {
|
||||
.padding(.leading, 12)
|
||||
.hairline(.leading)
|
||||
}
|
||||
.padding(.horizontal, 18)
|
||||
.padding(.leading, isFullScreen ? 18 : Metrics.trafficLightInset)
|
||||
.padding(.trailing, 18)
|
||||
.frame(height: Metrics.searchQueryBar)
|
||||
.hairline(.bottom)
|
||||
}
|
||||
@@ -85,7 +90,7 @@ struct SearchOverlay: View {
|
||||
|
||||
private var columns: some View {
|
||||
GeometryReader { proxy in
|
||||
let widths = SearchModel.widths(total: proxy.size.width, columns: model.columns, focused: model.column)
|
||||
let widths = SearchModel.widths(total: proxy.size.width, columns: model.columns)
|
||||
HStack(spacing: 0) {
|
||||
if model.columns.contains(.thisFile) {
|
||||
thisFileColumn.frame(width: widths[.thisFile])
|
||||
@@ -95,7 +100,6 @@ struct SearchOverlay: View {
|
||||
divider
|
||||
filesColumn.frame(width: widths[.files])
|
||||
}
|
||||
.animation(Metrics.colorTransition, value: model.column)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +267,7 @@ struct SearchOverlay: View {
|
||||
TypeBadge(path: match.path)
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
Text(SearchHighlight.name(PathUtils.basename(match.path), indices: match.nameIndices, selected: selected))
|
||||
.typeRole(selected ? Typography.rowSelected : Typography.sourceControlRow)
|
||||
.typeRole(selected ? Typography.rowSelected : Typography.rowSmall)
|
||||
.lineLimit(1)
|
||||
if !directory.isEmpty {
|
||||
Text(directory + "/").typeRole(Typography.meta).foregroundStyle(Palette.text4).lineLimit(1).truncationMode(.head)
|
||||
|
||||
Reference in New Issue
Block a user