From c5e11fb94b365bb91eb038fc7d3d97f4f9b5e7c2 Mon Sep 17 00:00:00 2001 From: opficdev Date: Sun, 29 Nov 2026 21:32:58 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20HomeFeature=EC=97=90=20=EC=B5=9C?= =?UTF-8?q?=EA=B7=BC=20=EA=B8=B0=EB=A1=9D=20=EC=88=9C=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC=ED=95=9C=20=EC=A7=84=ED=96=89=20=EC=A4=91?= =?UTF-8?q?=EC=9D=B8=20=EA=B0=9C=EB=B0=9C=20=EB=AA=A9=EB=A1=9D=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeTab/Sources/Home/HomeFeature.swift | 10 ++++++++++ .../HomeTab/Tests/Home/HomeFeatureTests.swift | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift b/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift index 0127aa41..a5675b1c 100644 --- a/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift +++ b/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift @@ -59,6 +59,16 @@ struct HomeFeature { loading.visibleTargets.contains(LoadingTarget.developmentGoals.target) } + // 넓은 창 홈의 진행 중인 개발 순서 + // 최근 기록 순이고 기록이 없는 목표는 불러온 순서대로 뒤에 표시 + var developmentGoalItemsByRecentRecord: [DevelopmentGoalItem] { + developmentGoalItems.sorted { lhs, rhs in + guard let lhs = lhs.recentRecord?.confirmedAt else { return false } + guard let rhs = rhs.recentRecord?.confirmedAt else { return true } + return rhs < lhs + } + } + // 사이드바에서 고른 채로 표시할 위치 var sideBarLocation: SideBarLocation { if let goalDetail { diff --git a/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift b/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift index ab9e3ff9..0a47e587 100644 --- a/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift +++ b/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift @@ -52,6 +52,25 @@ struct HomeFeatureTests { #expect(adapter.developmentGoalItems.first?.recentRecord == version) } + @Test("HomeFeature 넓은 창 목표 순서는 최근 기록 순이고 기록이 없는 목표는 뒤에 둔다") + func HomeFeature_넓은_창_목표_순서는_최근_기록_순이고_기록이_없는_목표는_뒤에_둔다() throws { + var state = HomeFeature.State() + state.developmentGoalItems = [ + DevelopmentGoalItem(goal: try makeDevelopmentGoal(id: "empty-first", createdAt: 1), recentRecord: nil), + DevelopmentGoalItem( + goal: try makeDevelopmentGoal(id: "old", createdAt: 2), + recentRecord: try makeDevelopmentRecordVersion(id: "old", recordID: "old", title: "old", confirmedAt: 10) + ), + DevelopmentGoalItem(goal: try makeDevelopmentGoal(id: "empty-second", createdAt: 3), recentRecord: nil), + DevelopmentGoalItem( + goal: try makeDevelopmentGoal(id: "recent", createdAt: 4), + recentRecord: try makeDevelopmentRecordVersion(id: "recent", recordID: "recent", title: "recent", confirmedAt: 20) + ) + ] + + #expect(state.developmentGoalItemsByRecentRecord.map(\.id) == ["recent", "old", "empty-first", "empty-second"]) + } + @Test("HomeFeature fetchData는 연결 Todo 완료 수로 목표 진행률을 계산한다") func HomeFeature_fetchData는_연결_Todo_완료_수로_목표_진행률을_계산한다() async throws { let goal = try makeDevelopmentGoal(id: "goal", createdAt: 1) From a78a7d419c4c193e28a9c38ed4933de8a67053b5 Mon Sep 17 00:00:00 2001 From: opficdev Date: Sun, 29 Nov 2026 21:32:58 +0900 Subject: [PATCH 2/5] =?UTF-8?q?ui:=20=EB=84=93=EC=9D=80=20=EC=B0=BD?= =?UTF-8?q?=EC=9D=98=20=EC=A7=84=ED=96=89=20=EC=A4=91=EC=9D=B8=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C=EC=9D=84=20=EC=A0=9C=EB=AA=A9=EA=B3=BC=20=EC=A7=84?= =?UTF-8?q?=ED=96=89=EB=A5=A0=EB=A7=8C=20=EB=8B=B4=EC=9D=80=20=ED=95=9C=20?= =?UTF-8?q?=EC=A4=84=20=ED=96=89=EC=9C=BC=EB=A1=9C=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Home/DevelopmentGoalSection.swift | 67 ++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/Application/Presentation/HomeTab/Sources/Home/DevelopmentGoalSection.swift b/Application/Presentation/HomeTab/Sources/Home/DevelopmentGoalSection.swift index 4f3c099f..f34fd262 100644 --- a/Application/Presentation/HomeTab/Sources/Home/DevelopmentGoalSection.swift +++ b/Application/Presentation/HomeTab/Sources/Home/DevelopmentGoalSection.swift @@ -10,6 +10,7 @@ import PresentationShared struct DevelopmentGoalSection: View { @Environment(\.isiOSAppOnMac) private var isiOSAppOnMac + @Environment(\.usesDesktopLayout) private var usesDesktopLayout let items: [DevelopmentGoalItem] let isLoading: Bool let hasLoaded: Bool @@ -67,7 +68,12 @@ struct DevelopmentGoalSection: View { Button { onSelect(item) } label: { - DevelopmentGoalRow(item: item) + // 사이드바가 있는 창은 제목과 진행률만 담은 한 줄 행 + if usesDesktopLayout { + DevelopmentGoalCompactRow(item: item) + } else { + DevelopmentGoalRow(item: item) + } } .buttonStyle(.plain) } @@ -140,6 +146,65 @@ private struct DevelopmentGoalRow: View { } } +// 한 줄에 제목과 진행률, 그 아래 얇은 진행 막대를 둔 목표 행 +private struct DevelopmentGoalCompactRow: View { + @Environment(\.isiOSAppOnMac) private var isiOSAppOnMac + let item: DevelopmentGoalItem + + var body: some View { + VStack(alignment: .leading, spacing: 7) { + HStack(alignment: .firstTextBaseline, spacing: 8) { + Text(item.goal.title) + .font(.adaptive(isiOSAppOnMac ? .body : .callout).weight(.semibold)) + .foregroundStyle(Color.label) + .lineLimit(1) + .frame(maxWidth: .infinity, alignment: .leading) + // 연결된 Todo가 없으면 0% 대신 연결 없음 문구로 아직 완료하지 않은 목표와 구분 + Group { + if item.todoProgress.isEmpty { + Text("home_development_goal_todo_empty", bundle: PresentationResources.bundle) + } else { + Text( + String.localizedStringWithFormat( + String( + localized: "home_development_goal_todo_progress_percent_format", + bundle: PresentationResources.bundle + ), + item.todoProgress.percentage + ) + ) + } + } + .font(.adaptive(isiOSAppOnMac ? .subheadline : .footnote)) + .foregroundStyle(Color.secondaryLabel) + .lineLimit(1) + .fixedSize() + } + + // 연결된 Todo가 없으면 막대를 그리지 않고 자리만 남겨 다른 행과 높이를 맞춤 + GeometryReader { proxy in + Capsule() + .fill(Color.separator) + .overlay(alignment: .leading) { + Capsule() + .fill(Color.accent) + .frame(width: proxy.size.width * item.todoProgress.fraction) + } + } + .frame(height: 4) + .opacity(item.todoProgress.isEmpty ? 0 : 1) + } + .padding(.vertical, isiOSAppOnMac ? 10 * AdaptiveSize.boardScale : 14) + .padding(.trailing, isiOSAppOnMac ? 14 * AdaptiveSize.boardScale : 16) + .overlay(alignment: .bottom) { + Rectangle() + .fill(Color.secondarySeparator) + .frame(height: 1) + } + .contentShape(.rect) + } +} + struct DevelopmentTodoProgressView: View { let progress: DevelopmentGoalTodoProgress From 2ea6d5b041593b29bf5946df02f5531ee8c2e698 Mon Sep 17 00:00:00 2001 From: opficdev Date: Sun, 29 Nov 2026 21:32:58 +0900 Subject: [PATCH 3/5] =?UTF-8?q?ui:=20=EB=84=93=EC=9D=80=20=EC=B0=BD?= =?UTF-8?q?=EC=9D=98=20=ED=99=88=EC=9D=84=20=EC=9A=94=EC=95=BD=20=EC=B9=B4?= =?UTF-8?q?=EB=93=9C=20=EC=97=86=EC=9D=B4=20=EC=B9=B8=20=EA=B0=80=EC=9A=B4?= =?UTF-8?q?=EB=8D=B0=20320=20=ED=8F=AD=20=ED=95=9C=20=EC=B9=B8=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeTab/Sources/Home/HomeView.swift | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Application/Presentation/HomeTab/Sources/Home/HomeView.swift b/Application/Presentation/HomeTab/Sources/Home/HomeView.swift index f2875f73..4ee61c9c 100644 --- a/Application/Presentation/HomeTab/Sources/Home/HomeView.swift +++ b/Application/Presentation/HomeTab/Sources/Home/HomeView.swift @@ -258,27 +258,22 @@ private struct HomeTopBarIconButtonStyle: ButtonStyle { } } -// 넓은 화면은 두 열, 좁은 화면과 오른쪽 칸이 열려 좁아진 왼쪽 칸은 한 열 +// 사이드바가 있는 창은 요약 없이 칸 가운데 좁은 한 칸, 좁은 화면은 요약을 포함한 한 열 private struct HomeColumns: View { @Environment(\.usesDesktopLayout) private var usesDesktopLayout - @Environment(\.paneWidth) private var paneWidth @Environment(\.readableContentWidth) private var readableContentWidth let store: StoreOf var body: some View { - if usesDesktopLayout && paneWidth == nil { - // 왼쪽 요약·카테고리, 오른쪽 진행 중인 개발의 두 열 - HStack(spacing: 0) { - ScrollView { - VStack(alignment: .leading, spacing: 0) { - HomeDevelopmentSummary(store: store) - HomeTodoSection(store: store) - } - } - Divider().overlay(Color.secondarySeparator) - ScrollView { + if usesDesktopLayout { + // 버튼 위주 화면이라 목록 폭보다 좁은 320 폭 + ScrollView { + LazyVStack(alignment: .leading, spacing: 0) { + HomeTodoSection(store: store) HomeDevelopmentGoals(store: store) } + .frame(maxWidth: 320 * AdaptiveSize.boardScale) + .frame(maxWidth: .infinity) } } else { ScrollView { @@ -312,11 +307,12 @@ private struct HomeDevelopmentSummary: View { } private struct HomeDevelopmentGoals: View { + @Environment(\.usesDesktopLayout) private var usesDesktopLayout let store: StoreOf var body: some View { DevelopmentGoalSection( - items: store.developmentGoalItems, + items: usesDesktopLayout ? store.developmentGoalItemsByRecentRecord : store.developmentGoalItems, isLoading: store.isDevelopmentGoalsLoading, hasLoaded: store.hasDevelopmentGoalsLoaded, hasLoadFailure: store.hasDevelopmentGoalsLoadFailure, From 2b98297101be2d3e147060d90f1d8817301af3d1 Mon Sep 17 00:00:00 2001 From: opficdev Date: Sun, 29 Nov 2026 21:49:06 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=EA=B8=B0=EB=A1=9D=20=EC=8B=9C?= =?UTF-8?q?=EA=B0=81=EC=9D=B4=20=EA=B0=99=EA=B1=B0=EB=82=98=20=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=EC=9D=B4=20=EC=97=86=EB=8A=94=20=EB=AA=A9=ED=91=9C?= =?UTF-8?q?=EB=A5=BC=20=EC=83=9D=EC=84=B1=20=EC=88=9C=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=AA=85=EC=8B=9C=ED=95=B4=20=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeTab/Sources/Home/HomeFeature.swift | 19 +++++++++++++---- .../HomeTab/Tests/Home/HomeFeatureTests.swift | 21 ++++++++++++------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift b/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift index a5675b1c..0f4c7c2f 100644 --- a/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift +++ b/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift @@ -60,12 +60,23 @@ struct HomeFeature { } // 넓은 창 홈의 진행 중인 개발 순서 - // 최근 기록 순이고 기록이 없는 목표는 불러온 순서대로 뒤에 표시 + // 최근 기록 순이고 기록이 없는 목표는 뒤에 표시 var developmentGoalItemsByRecentRecord: [DevelopmentGoalItem] { developmentGoalItems.sorted { lhs, rhs in - guard let lhs = lhs.recentRecord?.confirmedAt else { return false } - guard let rhs = rhs.recentRecord?.confirmedAt else { return true } - return rhs < lhs + switch (lhs.recentRecord?.confirmedAt, rhs.recentRecord?.confirmedAt) { + case let (left?, right?) where left != right: + return right < left + case (.some, .none): + return true + case (.none, .some): + return false + default: + // 기록 시각이 같거나 둘 다 기록이 없으면 불러온 목록과 같은 생성 순, 같은 시각이면 id 순 + if lhs.goal.createdAt == rhs.goal.createdAt { + return lhs.id < rhs.id + } + return lhs.goal.createdAt < rhs.goal.createdAt + } } } diff --git a/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift b/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift index 0a47e587..4ee3cac6 100644 --- a/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift +++ b/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift @@ -52,23 +52,30 @@ struct HomeFeatureTests { #expect(adapter.developmentGoalItems.first?.recentRecord == version) } - @Test("HomeFeature 넓은 창 목표 순서는 최근 기록 순이고 기록이 없는 목표는 뒤에 둔다") - func HomeFeature_넓은_창_목표_순서는_최근_기록_순이고_기록이_없는_목표는_뒤에_둔다() throws { + @Test("HomeFeature 넓은 창 목표 순서는 최근 기록 순이고 기록 시각이 같거나 없는 목표는 생성 순으로 둔다") + func HomeFeature_넓은_창_목표_순서는_최근_기록_순이고_기록_시각이_같거나_없는_목표는_생성_순으로_둔다() throws { var state = HomeFeature.State() state.developmentGoalItems = [ - DevelopmentGoalItem(goal: try makeDevelopmentGoal(id: "empty-first", createdAt: 1), recentRecord: nil), + DevelopmentGoalItem(goal: try makeDevelopmentGoal(id: "empty-second", createdAt: 6), recentRecord: nil), DevelopmentGoalItem( goal: try makeDevelopmentGoal(id: "old", createdAt: 2), recentRecord: try makeDevelopmentRecordVersion(id: "old", recordID: "old", title: "old", confirmedAt: 10) ), - DevelopmentGoalItem(goal: try makeDevelopmentGoal(id: "empty-second", createdAt: 3), recentRecord: nil), + DevelopmentGoalItem(goal: try makeDevelopmentGoal(id: "empty-first", createdAt: 1), recentRecord: nil), DevelopmentGoalItem( - goal: try makeDevelopmentGoal(id: "recent", createdAt: 4), - recentRecord: try makeDevelopmentRecordVersion(id: "recent", recordID: "recent", title: "recent", confirmedAt: 20) + goal: try makeDevelopmentGoal(id: "recent-second", createdAt: 5), + recentRecord: try makeDevelopmentRecordVersion(id: "b", recordID: "b", title: "b", confirmedAt: 20) + ), + DevelopmentGoalItem( + goal: try makeDevelopmentGoal(id: "recent-first", createdAt: 3), + recentRecord: try makeDevelopmentRecordVersion(id: "a", recordID: "a", title: "a", confirmedAt: 20) ) ] - #expect(state.developmentGoalItemsByRecentRecord.map(\.id) == ["recent", "old", "empty-first", "empty-second"]) + #expect( + state.developmentGoalItemsByRecentRecord.map(\.id) + == ["recent-first", "recent-second", "old", "empty-first", "empty-second"] + ) } @Test("HomeFeature fetchData는 연결 Todo 완료 수로 목표 진행률을 계산한다") From a40d4ca5ca308d67ba62218528f717e18f2e1576 Mon Sep 17 00:00:00 2001 From: opficdev Date: Sun, 29 Nov 2026 21:49:06 +0900 Subject: [PATCH 5/5] =?UTF-8?q?ui:=20=EC=82=AC=EC=9D=B4=EB=93=9C=EB=B0=94?= =?UTF-8?q?=20=EA=B0=9C=EB=B0=9C=20=EB=AA=A9=ED=91=9C=EB=A5=BC=20=EB=84=93?= =?UTF-8?q?=EC=9D=80=20=EC=B0=BD=20=ED=99=88=EA=B3=BC=20=EA=B0=99=EC=9D=80?= =?UTF-8?q?=20=EC=B5=9C=EA=B7=BC=20=EA=B8=B0=EB=A1=9D=20=EC=88=9C=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/HomeTab/Sources/Home/HomeFeature.swift | 5 +++-- .../Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift b/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift index 0f4c7c2f..96a5ad61 100644 --- a/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift +++ b/Application/Presentation/HomeTab/Sources/Home/HomeFeature.swift @@ -59,7 +59,7 @@ struct HomeFeature { loading.visibleTargets.contains(LoadingTarget.developmentGoals.target) } - // 넓은 창 홈의 진행 중인 개발 순서 + // 넓은 창 홈과 사이드바의 진행 중인 개발 순서 // 최근 기록 순이고 기록이 없는 목표는 뒤에 표시 var developmentGoalItemsByRecentRecord: [DevelopmentGoalItem] { developmentGoalItems.sorted { lhs, rhs in @@ -98,10 +98,11 @@ struct HomeFeature { } // 사이드바 Todo, 개발 목표 묶음의 하위 항목 + // 개발 목표는 같은 창의 홈과 같은 최근 기록 순 var sideBarContent: SideBarContent { SideBarContent( todoCategories: preferences.filter(\.isVisible), - developmentGoals: developmentGoalItems.map { SideBarGoal(id: $0.id, title: $0.goal.title) } + developmentGoals: developmentGoalItemsByRecentRecord.map { SideBarGoal(id: $0.id, title: $0.goal.title) } ) } diff --git a/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift b/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift index 4ee3cac6..e19a0b76 100644 --- a/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift +++ b/Application/Presentation/HomeTab/Tests/Home/HomeFeatureTests.swift @@ -76,6 +76,10 @@ struct HomeFeatureTests { state.developmentGoalItemsByRecentRecord.map(\.id) == ["recent-first", "recent-second", "old", "empty-first", "empty-second"] ) + #expect( + state.sideBarContent.developmentGoals.map(\.id) + == state.developmentGoalItemsByRecentRecord.map(\.id) + ) } @Test("HomeFeature fetchData는 연결 Todo 완료 수로 목표 진행률을 계산한다")