|
|
@ -18,30 +18,32 @@ enum PipelineState {
|
|
|
|
case failed(Error)
|
|
|
|
case failed(Error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//struct LabelToggleDisclosureGroupStyle: DisclosureGroupStyle {
|
|
|
|
/// Mimics the native appearance, but labels are clickable.
|
|
|
|
// func makeBody(configuration: Configuration) -> some View {
|
|
|
|
/// To be removed (adding gestures to all labels) if we observe any UI shenanigans.
|
|
|
|
// VStack {
|
|
|
|
struct LabelToggleDisclosureGroupStyle: DisclosureGroupStyle {
|
|
|
|
// HStack {
|
|
|
|
func makeBody(configuration: Configuration) -> some View {
|
|
|
|
// Button {
|
|
|
|
VStack {
|
|
|
|
// withAnimation {
|
|
|
|
HStack {
|
|
|
|
// configuration.isExpanded.toggle()
|
|
|
|
Button {
|
|
|
|
// }
|
|
|
|
withAnimation {
|
|
|
|
// } label: {
|
|
|
|
configuration.isExpanded.toggle()
|
|
|
|
// Image(systemName: configuration.isExpanded ? "chevron.down.circle.fill" : "chevron.right.circle.fill")
|
|
|
|
}
|
|
|
|
// }.buttonStyle(.plain).foregroundColor(.primary).colorInvert()
|
|
|
|
} label: {
|
|
|
|
// configuration.label.onTapGesture {
|
|
|
|
Image(systemName: configuration.isExpanded ? "chevron.down" : "chevron.right").frame(width:8, height: 8)
|
|
|
|
// withAnimation {
|
|
|
|
}.buttonStyle(.plain).font(.footnote).fontWeight(.semibold).foregroundColor(.gray)
|
|
|
|
// configuration.isExpanded.toggle()
|
|
|
|
configuration.label.onTapGesture {
|
|
|
|
// }
|
|
|
|
withAnimation {
|
|
|
|
// }
|
|
|
|
configuration.isExpanded.toggle()
|
|
|
|
// Spacer()
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// if configuration.isExpanded {
|
|
|
|
Spacer()
|
|
|
|
// configuration.content
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
if configuration.isExpanded {
|
|
|
|
// }
|
|
|
|
configuration.content
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ControlsView: View {
|
|
|
|
struct ControlsView: View {
|
|
|
|
@EnvironmentObject var generation: GenerationContext
|
|
|
|
@EnvironmentObject var generation: GenerationContext
|
|
|
@ -111,11 +113,7 @@ struct ControlsView: View {
|
|
|
|
modelDidChange(model: model)
|
|
|
|
modelDidChange(model: model)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} label: {
|
|
|
|
} label: {
|
|
|
|
Label("Model from Hub", systemImage: "cpu").foregroundColor(.secondary).onTapGesture {
|
|
|
|
Label("Model from Hub", systemImage: "cpu").foregroundColor(.secondary)
|
|
|
|
withAnimation {
|
|
|
|
|
|
|
|
disclosedModel.toggle()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Divider()
|
|
|
|
Divider()
|
|
|
@ -131,11 +129,7 @@ struct ControlsView: View {
|
|
|
|
.textFieldStyle(.squareBorder)
|
|
|
|
.textFieldStyle(.squareBorder)
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
} label: {
|
|
|
|
} label: {
|
|
|
|
Label("Prompts", systemImage: "text.quote").foregroundColor(.secondary).onTapGesture {
|
|
|
|
Label("Prompts", systemImage: "text.quote").foregroundColor(.secondary)
|
|
|
|
withAnimation {
|
|
|
|
|
|
|
|
disclosedPrompt.toggle()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Divider()
|
|
|
|
Divider()
|
|
|
@ -147,11 +141,7 @@ struct ControlsView: View {
|
|
|
|
Text("\(Int(generation.steps))")
|
|
|
|
Text("\(Int(generation.steps))")
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
} label: {
|
|
|
|
} label: {
|
|
|
|
Label("Step count", systemImage: "square.3.layers.3d.down.left").foregroundColor(.secondary).onTapGesture {
|
|
|
|
Label("Step count", systemImage: "square.3.layers.3d.down.left").foregroundColor(.secondary)
|
|
|
|
withAnimation {
|
|
|
|
|
|
|
|
disclosedSteps.toggle()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Divider()
|
|
|
|
Divider()
|
|
|
|
|
|
|
|
|
|
|
@ -174,14 +164,11 @@ struct ControlsView: View {
|
|
|
|
Text("\(Int(generation.seed))")
|
|
|
|
Text("\(Int(generation.seed))")
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
} label: {
|
|
|
|
} label: {
|
|
|
|
Label("Seed", systemImage: "leaf").foregroundColor(.secondary).onTapGesture {
|
|
|
|
Label("Seed", systemImage: "leaf").foregroundColor(.secondary)
|
|
|
|
withAnimation {
|
|
|
|
|
|
|
|
disclosedSeed.toggle()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.disclosureGroupStyle(LabelToggleDisclosureGroupStyle())
|
|
|
|
|
|
|
|
|
|
|
|
StatusView(pipelineState: $pipelineState)
|
|
|
|
StatusView(pipelineState: $pipelineState)
|
|
|
|
}
|
|
|
|
}
|
|
|
|