forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSuggestionPanelView.swift
More file actions
61 lines (53 loc) · 1.89 KB
/
Copy pathSuggestionPanelView.swift
File metadata and controls
61 lines (53 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import ComposableArchitecture
import Foundation
import SwiftUI
struct SuggestionPanelView: View {
let store: SuggestionPanel
struct OverallState: Equatable {
var isPanelDisplayed: Bool
var opacity: Double
var colorScheme: ColorScheme
var isPanelOutOfFrame: Bool
var alignTopToAnchor: Bool
}
var body: some View {
WithPerceptionTracking {
VStack(alignment: .leading, spacing: 0) {
if store.verticalAlignment == .bottom {
Spacer()
.frame(minHeight: 0, maxHeight: .infinity)
.allowsHitTesting(false)
}
Content(store: store)
.allowsHitTesting(
store.isPanelDisplayed && !store.isPanelOutOfFrame
)
.frame(maxWidth: .infinity)
if store.verticalAlignment == .top {
Spacer()
.frame(minHeight: 0, maxHeight: .infinity)
.allowsHitTesting(false)
}
}
.preferredColorScheme(store.colorScheme)
.opacity(store.opacity)
}
}
struct Content: View {
let store: SuggestionPanel
@AppStorage(\.suggestionPresentationMode) var suggestionPresentationMode
var body: some View {
WithPerceptionTracking {
if let suggestionManager = store.suggestionManager {
SuggestionPanelGroupView(
manager: suggestionManager,
alignment: .leading
)
.frame(width: Style.inlineSuggestionMinWidth)
.frame(maxHeight: Style.inlineSuggestionMaxHeight)
.fixedSize(horizontal: false, vertical: true)
}
}
}
}
}