import HelderCore import SwiftUI /// `[ schema ]`, the connection and the dump's meta, then the command path, Run and Close. struct SchemaTopBar: View { let model: WorkspaceModel let store: SchemaStore var body: some View { HStack(spacing: 14) { Text("[ schema ]").typeRole(Typography.gitLabel).foregroundStyle(Palette.textMuted).fixedSize() if let schema = store.model { HStack(spacing: 6) { GitIconView(icon: .database, size: 13) Text(schema.connectionLabel).typeRole(Typography.branch).lineLimit(1) } .foregroundStyle(Palette.amber) .fixedSize() } Text(store.metaLabel) .typeRole(Typography.path) .foregroundStyle(Palette.textMuted) .lineLimit(1) .truncationMode(.tail) Spacer(minLength: 0) if store.hasCommand { CommandPathButton { model.perform(.openSchemaCommandFile) } } SchemaPrimaryButton(label: store.runLabel, icon: .terminal, height: SchemaViewMetrics.topButton, role: Typography.commitButton, padding: 12) { model.perform(.runSchemaDump) } .disabledLook(!store.hasCommand) GitBarButton(icon: .minimize, label: "Close", trailing: "⌘D") { model.perform(.closeSchemaView) } } .padding(.horizontal, 14) .frame(height: SchemaViewMetrics.topBar) .background(Palette.panel) .hairline(.bottom) } } /// `app/Console/Commands/HelderSchemaCommand.php` as a mono text button. private struct CommandPathButton: View { let action: () -> Void @State private var isHovered = false var body: some View { Button(action: action) { Text(SchemaPaths.commandFile) .typeRole(Typography.path) .foregroundStyle(isHovered ? Palette.text1 : Palette.textMuted) .lineLimit(1) .padding(.vertical, 4) .contentShape(Rectangle()) } .buttonStyle(.plain) .fixedSize() .pointerHand() .tracksHover($isHovered) .tip("Open the command in the editor", edge: .trailing) } }