Przeglądaj źródła

refactor: move Project name editing into the main view instead of the sidebar, since that was kind dumb

Sam Jaffe 2 tygodni temu
rodzic
commit
85365edc78

+ 1 - 1
Todos/View/ContentView.swift

@@ -22,7 +22,7 @@ struct ContentView: View {
       List(selection: $selection) {
         ForEach(items, id: \.self) { item in
           NavigationLink(value: item) {
-            ProjectSidebarView(name: Bindable(item).name)
+            Text(item.name)
           } .contextMenu {
             Button(action: { deleteItem(item: item) }) {
               Label("Delete", systemImage: "trash")

+ 1 - 1
Todos/View/ProjectPanelView.swift

@@ -20,7 +20,7 @@ struct ProjectPanelView: View {
   var body: some View {
     let style = Date.FormatStyle(date: .numeric, time: .standard)
     HStack {
-      Text(item.name)
+      TextField("", text: $item.name)
           .font(.title)
           .padding(.leading, 10)
       Spacer()

+ 0 - 22
Todos/View/ProjectSidebarView.swift

@@ -1,22 +0,0 @@
-//
-//  ProjectSidebarView.swift
-//  Todos
-//
-//  Created by Sam Jaffe on 2/28/26.
-//
-
-import SwiftUI
-import SwiftData
-
-struct ProjectSidebarView: View {
-  @Binding var name: String
-
-  var body: some View {
-    TextField("Project", text: $name)
-  }
-}
-
-#Preview {
-  @Previewable @State var name = "New Project"
-  ProjectSidebarView(name: $name)
-}