Skip to content

Commit e27c7ae

Browse files
authored
Merge pull request #125 from DeveloperAcademy-POSTECH/fix/#123
[#123] URL ๊ด€๋ จ ๋ฒ„๊ทธ, Tag ์ƒ์„ฑ์‹œ ์—”ํ„ฐ๋กœ ์ถ”๊ฐ€ ๋“ฑ fix ์ž‘์—…
2 parents 7d70b63 + 5d5a3bd commit e27c7ae

File tree

6 files changed

+42
-74
lines changed

6 files changed

+42
-74
lines changed

โ€ŽLabDuck/View/EditSheetView.swiftโ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct EditSheetView: View {
4444
relatedNodes = findNodes(node)
4545
tempNodeTitle = self.node.unwrappedTitle
4646
tempNodeNote = self.node.unwrappedNote
47-
tempNodeURL = self.tempNodeURL
47+
tempNodeURL = self.node.unwrappedURL
4848
}
4949

5050
colorSelectionView
@@ -167,9 +167,9 @@ struct EditSheetView: View {
167167
Section(header: sectionHeader("URL")) {
168168
styledTextEditor(
169169
text: $tempNodeURL,
170-
lineLimit: 2,
170+
lineLimit: 4,
171171
fontSize: 13,
172-
height: 40
172+
height: 80
173173
)
174174
.onAppear {
175175
tempNodeURL = node.unwrappedURL

โ€ŽLabDuck/View/MainView.swiftโ€Ž

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,6 @@ struct MainView: View {
134134

135135
// MARK: - Toolbar
136136
.toolbar {
137-
ToolbarItem(placement: .navigation) {
138-
Button(action: {},
139-
label: {
140-
Image(systemName: "chevron.backward")
141-
})
142-
}
143-
144137
ToolbarItem(placement: .principal) {
145138
Picker("View", selection: $viewType) {
146139
ForEach(KPBoard.BoardViewType.allCases, id: \.self) { view in

โ€ŽLabDuck/View/NodeView.swiftโ€Ž

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ struct NodeView: View {
3535
@Binding var clickingOutput: Bool
3636
@Environment(\.searchText) private var searchText
3737

38-
@State private var selectedAction = "normal"
3938
@State private var initialWidth: CGFloat = 0
40-
@State private var resizeOffset: CGPoint = .zero
4139
@State private var isNodeHovered: Bool = false
4240

4341
@State private var showAlert = false
@@ -50,7 +48,7 @@ struct NodeView: View {
5048
InputPointsView()
5149
ZStack() {
5250
VStack(spacing: 0) {
53-
VStack(alignment: .center, spacing: 10) {
51+
VStack(alignment: .leading, spacing: 10) {
5452
ZStack{
5553
if isEditing {
5654
HStack{
@@ -119,7 +117,6 @@ struct NodeView: View {
119117
//ํƒœ๊ทธ ํŒ์—…์ฐฝ
120118
if isEditingForTag {
121119
TagPopupView(isEditingForTag: $isEditingForTag, node: node)
122-
.transition(.scale)
123120
.zIndex(1)
124121
}
125122

@@ -159,6 +156,8 @@ struct NodeView: View {
159156
.shadow(color: .black.opacity(0.1), radius: 5, x: 0, y: 4)
160157
OutputPointsView()
161158
}
159+
.animation(.easeInOut, value: isEditing)
160+
.animation(.easeInOut, value: isEditingForTag)
162161
.onChange(of: isEditing) { oldValue, newValue in
163162
if oldValue && !newValue {
164163
var newNode = node

โ€ŽLabDuck/View/TableView.swiftโ€Ž

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,28 @@ struct TableView: View {
4646
.width(77)
4747

4848
TableColumn("Title", value: \.unwrappedTitle) { node in
49-
if let _ = node.title {
50-
styledText(node.unwrappedTitle, node: node)
51-
} else {
52-
styledText(node.unwrappedTitle, node: node)
53-
.foregroundColor(.secondary)
49+
HStack {
50+
if let _ = node.title {
51+
styledText(node.unwrappedTitle, node: node)
52+
} else {
53+
styledText(node.unwrappedTitle, node: node)
54+
.foregroundColor(.secondary)
55+
}
56+
57+
Spacer()
58+
59+
Button {
60+
if editingNodeID == node.id {
61+
isSheet.toggle()
62+
} else {
63+
editingNodeID = node.id
64+
isSheet = true
65+
}
66+
} label: {
67+
Label("Open", systemImage: "rectangle.trailinghalf.inset.filled")
68+
}
69+
.buttonStyle(.bordered)
70+
5471
}
5572
}.width(min: 100)
5673

โ€ŽLabDuck/View/TagPopupView.swiftโ€Ž

Lines changed: 10 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ struct TagPopupView: View {
1414
var node: KPNode
1515
@State private var hoveredForClosingTagView: Bool = false
1616
@State private var textForTags: String = ""
17-
@State private var previewTag: KPTag?
1817

1918
@State private var hovered: Bool = false
2019

@@ -51,7 +50,8 @@ struct TagPopupView: View {
5150
.padding(.horizontal)
5251
}
5352
TextField("", text: $textForTags, onCommit: {
54-
addPreviewTag()
53+
createTag(name: textForTags)
54+
textForTags = ""
5555
})
5656
.padding(.horizontal)
5757
.foregroundColor(.black)
@@ -65,41 +65,6 @@ struct TagPopupView: View {
6565

6666

6767
VStack(alignment: .leading){
68-
if previewTag != nil {
69-
HStack(spacing: 20){
70-
71-
72-
//ํƒœ๊ทธ ์ƒ์„ฑ ๋ฒ„ํŠผ
73-
Button {
74-
createTag()
75-
} label: {
76-
Text("์ƒ์„ฑ").foregroundColor(.black)
77-
}.buttonStyle(BorderlessButtonStyle())
78-
.padding(.leading, 10)
79-
.padding(.top,10)
80-
.padding(.bottom,10)
81-
82-
83-
84-
//ํƒœ๊ทธ ํ”„๋ฆฌ๋ทฐ
85-
86-
Text("#\(textForTags)")
87-
.padding(8)
88-
.background(previewTag!.colorTheme.backgroundColor)
89-
.cornerRadius(6)
90-
.foregroundColor(.white)
91-
.padding(.top,10)
92-
.padding(.bottom,10)
93-
94-
95-
Spacer()
96-
97-
}.background(Color(hex: 0xF0F0F0))
98-
.frame(width: 234, height: 40)
99-
.cornerRadius(6)
100-
.padding(10)
101-
}
102-
10368
if !node.tags.isEmpty {
10469
Text("์„ ํƒ๋œ ํƒœ๊ทธ")
10570
.foregroundColor(.gray)
@@ -179,25 +144,17 @@ struct TagPopupView: View {
179144
.shadow(radius: 10)
180145
}
181146

182-
private func addPreviewTag() {
183-
guard !textForTags.isEmpty else { return }
184-
if !document.board.allTags.contains(where: { $0.name == textForTags }) {
185-
let newTagForPreview = KPTag(id: UUID(), name: textForTags, colorTheme: KPTagColor.random())
186-
previewTag = newTagForPreview
147+
private func createTag(name: String) {
148+
if document.board.getTag(name) == nil {
149+
document.createTag(name, undoManager: undoManager)
187150
}
188-
}
189-
190-
private func createTag() {
191-
guard let previewTag = previewTag else { return }
192151

193-
document.createTag(textForTags, color: previewTag.colorTheme, undoManager: undoManager)
194152
var tags = document.board.getTags(node.id).map { $0.id }
195-
guard let createdTag = document.board.getTag(textForTags)?.id else { return }
196-
tags.append(createdTag)
197-
198-
document.updateNode(node.id, tags: tags, undoManager: undoManager)
199-
self.previewTag = nil
200-
self.textForTags = ""
153+
guard let createdTag = document.board.getTag(name)?.id else { return }
154+
if !tags.contains(where: { $0 == createdTag }) {
155+
tags.append(createdTag)
156+
document.updateNode(node.id, tags: tags, undoManager: undoManager)
157+
}
201158
}
202159
}
203160

โ€ŽLabDuck/View/TextView.swiftโ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ struct TextView: View {
3232
newText.text = tempText
3333
document.updateText(newText, undoManager: undoManager, animation: nil)
3434
})
35-
.border(Color.blue.opacity(0.6))
36-
.frame(width: 200, height: 50)
35+
.font(.title)
36+
.border(Color.blue.opacity(0.6))
37+
.frame(width: 200, height: 50)
3738

3839
Button(action: {
3940
document.deleteText(self.text.id, undoManager: undoManager)
@@ -49,6 +50,7 @@ struct TextView: View {
4950
.onTapGesture(count: 1) {
5051
self.isEditing = true
5152
}
53+
.font(.title)
5254
}
5355
}
5456
.onAppear {

0 commit comments

Comments
ย (0)