Render interactive architecture diagrams natively in the transcript
This commit is contained in:
@@ -606,16 +606,25 @@ struct DiagramView: View {
|
||||
FlowchartCanvas(layout: layoutFlowchart(chart))
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
case .failure(let error):
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(verbatim: source)
|
||||
.textSelection(.enabled)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 6)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(Palette.surface, in: RoundedRectangle(cornerRadius: 6))
|
||||
Text(verbatim: "diagram not rendered: \(error.reason)")
|
||||
.foregroundStyle(Palette.muted)
|
||||
}
|
||||
DiagramFailure(source: source, reason: error.reason)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct DiagramFailure: View {
|
||||
let source: String
|
||||
let reason: String
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(verbatim: source)
|
||||
.textSelection(.enabled)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 6)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(Palette.surface, in: RoundedRectangle(cornerRadius: 6))
|
||||
Text(verbatim: "diagram not rendered: \(reason)")
|
||||
.foregroundStyle(Palette.muted)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user