Files

67 lines
1.8 KiB
Swift
Raw Permalink Normal View History

import MooToolNativeCore
import SwiftUI
struct ModuleDetailView: View {
let module: MooToolModule?
var body: some View {
VStack(alignment: .leading, spacing: 18) {
if let module {
Label(module.title, systemImage: module.symbolName)
.font(.title2)
.symbolRenderingMode(.hierarchical)
Text(statusText(for: module.status))
.foregroundStyle(.secondary)
Divider()
2026-06-30 09:41:26 +08:00
detailContent(for: module)
} else {
Text("请选择模块")
.foregroundStyle(.secondary)
}
}
.padding(28)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
}
private func statusText(for status: MooToolModuleStatus) -> String {
switch status {
case .planned:
"计划中"
case .preview:
"预览"
}
}
2026-06-30 09:41:26 +08:00
@ViewBuilder
private func detailContent(for module: MooToolModule) -> some View {
switch module.id {
case "quick-note":
QuickNoteView()
2026-06-30 09:41:26 +08:00
case "json":
JSONFormatterView()
case "time":
TimeConverterView()
case "encoding":
EncodingConverterView()
case "qr-code":
QRCodeGeneratorView()
case "http":
HTTPClientView()
case "host":
HostEditorView()
2026-06-30 09:41:26 +08:00
case "regex":
RegexTesterView()
case "text-diff":
TextDiffView()
2026-06-30 09:41:26 +08:00
default:
Text("原生版预览骨架")
.font(.headline)
Text("该模块将在骨架通过后分阶段迁移。")
.foregroundStyle(.secondary)
}
}
}