Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard shortcut to switch sidebar navigator tabs #1382

Merged
merged 24 commits into from
Sep 20, 2023
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f2d2e29
Fixed close tab and close window shortcut
FastestMolasses Jul 17, 2023
210884b
Replace .hidden modifier with .opacity modifier
FastestMolasses Jul 17, 2023
518c4ab
Fixed tab switching shortcuts not working
FastestMolasses Jul 17, 2023
3e07428
Undo changes
FastestMolasses Jul 17, 2023
3ac4741
Fixed the close button not being able to be pressed
FastestMolasses Jul 17, 2023
3cb05fb
Merge branch 'main'
FastestMolasses Jul 23, 2023
989ecb2
Update keyboard shortcuts to switch between sidebar navigator items
FastestMolasses Jul 24, 2023
85e31a7
Remove old shortcut
FastestMolasses Jul 24, 2023
395e922
Remove old code
FastestMolasses Jul 24, 2023
3a042b8
Small refactor
FastestMolasses Jul 24, 2023
d9f514e
New drag gestures, refactors
FastestMolasses Aug 27, 2023
2e7379e
Merge remote-tracking branch 'origin' into switch-tabs
FastestMolasses Aug 27, 2023
b2f5634
Cleanup and added comments
FastestMolasses Aug 27, 2023
e728a7b
Merge main
FastestMolasses Aug 27, 2023
ecb34c6
Removed file
FastestMolasses Aug 30, 2023
02703c0
Fixed variable bindings
FastestMolasses Aug 30, 2023
e13e2d0
Added ObservedObject to NavigatorSidebarViewModel
FastestMolasses Aug 30, 2023
89395a9
Limit index shortcuts to 9
FastestMolasses Aug 30, 2023
72a7184
Refactors
FastestMolasses Sep 8, 2023
2612387
Refactored swapping code
FastestMolasses Sep 11, 2023
b250c2f
Merge branch 'main' into switch-tabs
FastestMolasses Sep 13, 2023
5ddc478
Fixed variable that wasnt renamed
FastestMolasses Sep 13, 2023
8a7815b
Lint fixes
FastestMolasses Sep 15, 2023
40f6356
Remove comment
FastestMolasses Sep 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions CodeEdit/Components/ListTable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//
FastestMolasses marked this conversation as resolved.
Show resolved Hide resolved
// ListTable.swift
// CodeEdit
//
// Created by Abe Malla on 8/26/23.
//

import SwiftUI

struct Item: Identifiable {
let id = UUID()
var name: String
}

struct ContentView: View {
@State private var items = [Item]()
@State private var showingModal = false
@State private var selection: Item.ID?

var body: some View {
VStack {
Table(items, selection: $selection) {
TableColumn("Items", value: \.name)
}
}
.paneToolbar {
HStack(spacing: 2) {
Button {
showingModal = true
} label: {
Image(systemName: "plus")
}

Divider()
.frame(minHeight: 15)

Button {
removeItem()
} label: {
Image(systemName: "minus")
}
.disabled(selection == nil)
.opacity(selection == nil ? 0.5 : 1)
}
Spacer()
}
.sheet(isPresented: $showingModal) {
NewItemView { text in
items.append(Item(name: text))
showingModal = false
}
}
.cornerRadius(6)
}

private func removeItem() {
if let selectedId = selection {
items.removeAll(where: { $0.id == selectedId })
selection = nil
}
}
}

struct NewItemView: View {
@State private var text = ""
var completion: (String) -> Void

var body: some View {
VStack {
Text("Enter new item name")
TextField("Name", text: $text)
.textFieldStyle(.roundedBorder)
Button("Add") {
if !text.isEmpty {
completion(text)
}
}
}
.padding()
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.environmentObject(DebugAreaTabViewModel())
}
}
You are viewing a condensed version of this merge commit. You can view the full changes here.