mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-16 04:20:30 +00:00
QOL Changes
This commit is contained in:
parent
65908c69e5
commit
0baf631c7a
9 changed files with 119 additions and 316 deletions
|
|
@ -42,29 +42,24 @@ struct ScriptEditorView: View {
|
|||
.font(.system(.footnote, design: .monospaced))
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.environment(\.codeEditorTheme, editorTheme)
|
||||
|
||||
Divider()
|
||||
|
||||
HStack(spacing: 12) {
|
||||
WideGlassyButton(title: "Cancel", systemImage: "xmark") {
|
||||
dismiss()
|
||||
}
|
||||
WideGlassyButton(title: "Save", systemImage: "checkmark") {
|
||||
saveScript()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
.padding(.vertical, 12)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(bottomBarBackground)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.ignoresSafeArea(edges: .bottom)
|
||||
}
|
||||
.navigationTitle(scriptURL.lastPathComponent)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.onAppear(perform: loadScript)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button("Save") {
|
||||
saveScript()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
.preferredColorScheme(preferredScheme)
|
||||
.tint(Color.white)
|
||||
.toolbar(.hidden, for: .tabBar)
|
||||
}
|
||||
|
||||
private func loadScript() {
|
||||
|
|
@ -74,51 +69,4 @@ struct ScriptEditorView: View {
|
|||
private func saveScript() {
|
||||
try? scriptContent.write(to: scriptURL, atomically: true, encoding: .utf8)
|
||||
}
|
||||
|
||||
private var bottomBarBackground: some View {
|
||||
Rectangle()
|
||||
.fill(Color.black.opacity(colorScheme == .dark ? 0.35 : 0.08))
|
||||
.overlay(
|
||||
Rectangle()
|
||||
.fill(Color.white.opacity(0.08))
|
||||
.frame(height: 1),
|
||||
alignment: .top
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Equal-width rounded-rectangle button (centered content)
|
||||
private struct WideGlassyButton: View {
|
||||
let title: String
|
||||
let systemImage: String
|
||||
let action: () -> Void
|
||||
|
||||
var body: some View {
|
||||
Button(action: action) {
|
||||
HStack(spacing: 8) {
|
||||
Image(systemName: systemImage)
|
||||
.imageScale(.medium)
|
||||
.font(.body.weight(.semibold))
|
||||
Text(title)
|
||||
.font(.body.weight(.semibold))
|
||||
.lineLimit(1)
|
||||
.minimumScaleFactor(0.85)
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 14)
|
||||
}
|
||||
.frame(height: 44)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 12, style: .continuous)
|
||||
.fill(.ultraThinMaterial)
|
||||
)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 12, style: .continuous)
|
||||
.strokeBorder(Color.white.opacity(0.12), lineWidth: 1)
|
||||
)
|
||||
.contentShape(RoundedRectangle(cornerRadius: 12, style: .continuous))
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue