forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSharedPanel.swift
More file actions
44 lines (37 loc) · 1.13 KB
/
Copy pathSharedPanel.swift
File metadata and controls
44 lines (37 loc) · 1.13 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
import ComposableArchitecture
import Preferences
import SwiftUI
@Reducer
public struct SharedPanel {
public struct Content {
public var promptToCodeGroup = PromptToCodeGroup.State()
public var promptToCode: PromptToCodePanel.State? { promptToCodeGroup.activePromptToCode }
}
@ObservableState
public struct State {
var content: Content = .init()
var colorScheme: ColorScheme = .light
var alignTopToAnchor = false
var isPanelDisplayed: Bool = false
var isEmpty: Bool { content.promptToCode != nil }
var opacity: Double {
guard isPanelDisplayed else { return 0 }
guard !isEmpty else { return 0 }
return 1
}
}
public enum Action {
case promptToCodeGroup(PromptToCodeGroup.Action)
}
public var body: some ReducerOf<Self> {
Scope(state: \.content.promptToCodeGroup, action: \.promptToCodeGroup) {
PromptToCodeGroup()
}
Reduce { state, action in
switch action {
case .promptToCodeGroup:
return .none
}
}
}
}