-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature] 정산 내역 날짜 범위 선택 추가 및 차트 탭 인터랙션 개선 #67
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7fc4dd0
bugfix. 이미지 asset 수정
Peter1119 5bf96dc
feat: EmptyCaseView 생성
Peter1119 55e960f
style: 디자인 버그 수정
Peter1119 eda6c5d
feat: 정산 내역 날짜 범위 선택 기능 구현
Peter1119 599c853
refactor: MainCoordinator 불필요한 주석 제거
Peter1119 21a7f8c
refactor: 드래그 선택 제거 및 단일 선택 할 수 있도록 수정
Peter1119 194482e
Merge branch 'main' into feature/travel_code_share
Peter1119 436a126
style: emptycaseview 글자 색상 변경
Peter1119 fead532
refactor: 날짜 범위 선택 가능하도록 수정 및 chart 단일 선택으로 수정
Peter1119 59b8d96
feat: 초대 코드 및 복사 로직 분리 및 비용 리스트에서 초대 코드 노출 기능 구현
Peter1119 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file removed
BIN
-16.9 KB
...s/Images/EmptyTravelList.imageset/ChatGPT Image 2025년 12월 12일 오후 02_55_30 1.png
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
DesignSystem/Resources/Assets.xcassets/Images/EmptyTravelList.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+16.9 KB
...System/Resources/Assets.xcassets/Images/EmptyTravelList.imageset/travelList.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
DesignSystem/Resources/Assets.xcassets/Images/copy.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "lucide_files.png", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "filename" : "lucide_files@2x.png", | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "filename" : "lucide_files@3x.png", | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
Binary file added
BIN
+896 Bytes
DesignSystem/Resources/Assets.xcassets/Images/copy.imageset/lucide_files.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.59 KB
DesignSystem/Resources/Assets.xcassets/Images/copy.imageset/lucide_files@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.25 KB
DesignSystem/Resources/Assets.xcassets/Images/copy.imageset/lucide_files@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
DesignSystem/Resources/Assets.xcassets/Images/upload.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "lucide_upload.png", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "filename" : "lucide_upload@2x.png", | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "filename" : "lucide_upload@3x.png", | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
Binary file added
BIN
+826 Bytes
DesignSystem/Resources/Assets.xcassets/Images/upload.imageset/lucide_upload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.44 KB
DesignSystem/Resources/Assets.xcassets/Images/upload.imageset/lucide_upload@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.08 KB
DesignSystem/Resources/Assets.xcassets/Images/upload.imageset/lucide_upload@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // | ||
| // InviteCodeHelper.swift | ||
| // DesignSystem | ||
| // | ||
| // Created by Claude on 12/17/24. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| /// 여행 초대 코드 복사 및 공유 기능을 제공하는 헬퍼 | ||
| @MainActor | ||
| public enum InviteCodeHelper { | ||
|
|
||
| /// 초대 코드를 클립보드에 복사 | ||
| /// - Parameter code: 복사할 초대 코드 | ||
| public static func copyToClipboard(_ code: String) { | ||
| UIPasteboard.general.string = code | ||
| ToastManager.shared.showSuccess("클립보드에 복사되었습니다.") | ||
| } | ||
|
|
||
| /// 딥링크를 시스템 공유 시트를 통해 공유 | ||
| /// - Parameter deepLink: 공유할 딥링크 URL | ||
| public static func shareDeepLink(_ deepLink: URL) { | ||
| let activityViewController = UIActivityViewController( | ||
| activityItems: [deepLink], | ||
| applicationActivities: nil | ||
| ) | ||
|
|
||
| if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, | ||
| let window = windowScene.windows.first { | ||
| window.rootViewController?.present(activityViewController, animated: true) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // | ||
| // EmptyCaseView.swift | ||
| // DesignSystem | ||
| // | ||
| // Created by 홍석현 on 12/16/25. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| public struct EmptyCaseView: View { | ||
| private let image: ImageAsset | ||
| private let message: String | ||
|
|
||
| public init(image: ImageAsset, message: String) { | ||
| self.image = image | ||
| self.message = message | ||
| } | ||
|
|
||
| public var body: some View { | ||
| VStack(spacing: 16) { | ||
| Image(asset: image) | ||
| .resizable() | ||
| .frame(width: 167, height: 167) | ||
| Text(message) | ||
| .font(.app(.title3, weight: .medium)) | ||
| .foregroundStyle(Color.black) | ||
| } | ||
| .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| } | ||
| } | ||
|
|
||
| #Preview { | ||
| EmptyCaseView(image: .expenseEmpty, message: "아직 지출이 없어요") | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
215 changes: 215 additions & 0 deletions
215
Features/ExpenseList/Sources/Components/DateRangePicker.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,215 @@ | ||
| // | ||
| // DateRangePicker.swift | ||
| // ExpenseListFeature | ||
| // | ||
| // Created by Claude on 12/16/24. | ||
| // | ||
|
|
||
| import SwiftUI | ||
| import UIKit | ||
|
|
||
| // MARK: - DateRangePicker (SwiftUI Wrapper) | ||
|
|
||
| struct DateRangePicker: View { | ||
| let startDate: Date | ||
| let endDate: Date | ||
| @Binding var selectedRange: ClosedRange<Date>? | ||
| @Environment(\.dismiss) private var dismiss | ||
|
|
||
| var body: some View { | ||
| NavigationView { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Peter1119 여기에서 NavigationView 를 쓰는 이유는 무엇인가요 ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. navigation title 때문이었습니다 ~! |
||
| CalendarView( | ||
| startDate: startDate, | ||
| endDate: endDate, | ||
| selectedRange: $selectedRange | ||
| ) | ||
| .navigationTitle("기간 선택") | ||
| .navigationBarTitleDisplayMode(.inline) | ||
| .toolbar { | ||
| ToolbarItem(placement: .cancellationAction) { | ||
| Button("닫기") { | ||
| dismiss() | ||
| } | ||
| } | ||
| } | ||
| } | ||
| .presentationDetents([.medium, .large]) | ||
| .presentationDragIndicator(.visible) | ||
| } | ||
| } | ||
|
|
||
| // MARK: - CalendarView (UIViewRepresentable) | ||
|
|
||
| struct CalendarView: UIViewRepresentable { | ||
| let startDate: Date | ||
| let endDate: Date | ||
| @Binding var selectedRange: ClosedRange<Date>? | ||
|
|
||
| func makeCoordinator() -> Coordinator { | ||
| Coordinator(selectedRange: $selectedRange) | ||
| } | ||
|
|
||
| func makeUIView(context: Context) -> UICalendarView { | ||
| let calendarView = UICalendarView() | ||
| calendarView.calendar = Calendar.current | ||
| calendarView.locale = Locale.current | ||
| calendarView.fontDesign = .rounded | ||
|
|
||
| // 날짜 범위 제한 | ||
| let dateInterval = DateInterval(start: startDate, end: endDate) | ||
| calendarView.availableDateRange = dateInterval | ||
|
|
||
| // MultiDate selection 설정 | ||
| let selection = UICalendarSelectionMultiDate(delegate: context.coordinator) | ||
| calendarView.selectionBehavior = selection | ||
| context.coordinator.selection = selection | ||
|
|
||
| // 초기 선택 설정 | ||
| if let range = selectedRange { | ||
| context.coordinator.loadInitialRange(range) | ||
| } | ||
|
|
||
| return calendarView | ||
| } | ||
|
|
||
| func updateUIView(_ uiView: UICalendarView, context: Context) { | ||
| // selectedRange가 외부에서 변경되면 업데이트 | ||
| context.coordinator.externalRangeUpdate(selectedRange) | ||
| } | ||
|
|
||
| // MARK: - Coordinator | ||
|
|
||
| class Coordinator: NSObject, UICalendarSelectionMultiDateDelegate { | ||
| @Binding var selectedRange: ClosedRange<Date>? | ||
| var selection: UICalendarSelectionMultiDate? | ||
|
|
||
| private var rangeStart: Date? | ||
| private var rangeEnd: Date? | ||
| private let calendar = Calendar.current | ||
|
|
||
| init(selectedRange: Binding<ClosedRange<Date>?>) { | ||
| self._selectedRange = selectedRange | ||
| } | ||
|
|
||
| // 초기 범위 로드 | ||
| func loadInitialRange(_ range: ClosedRange<Date>) { | ||
| let start = calendar.startOfDay(for: range.lowerBound) | ||
| let end = calendar.startOfDay(for: range.upperBound) | ||
|
|
||
| rangeStart = start | ||
| rangeEnd = end | ||
|
|
||
| // 범위 내 모든 날짜 선택 | ||
| var dates: [DateComponents] = [] | ||
| var current = start | ||
| while current <= end { | ||
| let components = calendar.dateComponents([.year, .month, .day], from: current) | ||
| dates.append(components) | ||
| guard let next = calendar.date(byAdding: .day, value: 1, to: current) else { break } | ||
| current = next | ||
| } | ||
|
|
||
| selection?.setSelectedDates(dates, animated: false) | ||
| } | ||
|
|
||
| // 외부에서 selectedRange 변경 시 | ||
| func externalRangeUpdate(_ newRange: ClosedRange<Date>?) { | ||
| guard let range = newRange else { | ||
| rangeStart = nil | ||
| rangeEnd = nil | ||
| selection?.setSelectedDates([], animated: false) | ||
| return | ||
| } | ||
|
|
||
| // 현재 내부 상태와 다를 때만 업데이트 | ||
| if rangeStart != range.lowerBound || rangeEnd != range.upperBound { | ||
| loadInitialRange(range) | ||
| } | ||
| } | ||
|
|
||
| // 날짜 선택 가능 여부 | ||
| func multiDateSelection(_ selection: UICalendarSelectionMultiDate, canSelectDate dateComponents: DateComponents) -> Bool { | ||
| return true | ||
| } | ||
|
|
||
| // 날짜 해제 가능 여부 | ||
| func multiDateSelection(_ selection: UICalendarSelectionMultiDate, canDeselectDate dateComponents: DateComponents) -> Bool { | ||
| return true | ||
| } | ||
|
|
||
| // 날짜가 선택/해제되었을 때 | ||
| func multiDateSelection(_ selection: UICalendarSelectionMultiDate, didSelectDate dateComponents: DateComponents) { | ||
| guard let selectedDate = calendar.date(from: dateComponents) else { return } | ||
| let date = calendar.startOfDay(for: selectedDate) | ||
|
|
||
| print("🔵 날짜 선택: \(date)") | ||
|
|
||
| // 첫 번째 선택 (start) | ||
| if rangeStart == nil { | ||
| print(" 📍 첫 번째 선택 (start)") | ||
| rangeStart = date | ||
| rangeEnd = date | ||
| selection.setSelectedDates([dateComponents], animated: false) | ||
| updateBinding() | ||
| } | ||
| // 두 번째 선택 (end) | ||
| else if let start = rangeStart, calendar.isDate(start, inSameDayAs: rangeEnd ?? start) { | ||
| print(" 📍 두 번째 선택 (end)") | ||
| if date < start { | ||
| rangeStart = date | ||
| rangeEnd = start | ||
| } else { | ||
| rangeEnd = date | ||
| } | ||
| fillRange() | ||
| updateBinding() | ||
| } | ||
| // 세 번째 이후 선택 (리셋) | ||
| else { | ||
| print(" 🔄 세 번째 이후 선택 (리셋)") | ||
| rangeStart = date | ||
| rangeEnd = date | ||
| selection.setSelectedDates([dateComponents], animated: false) | ||
| updateBinding() | ||
| } | ||
| } | ||
|
|
||
| func multiDateSelection(_ selection: UICalendarSelectionMultiDate, didDeselectDate dateComponents: DateComponents) { | ||
| print("❌ 날짜 해제") | ||
| // 날짜 해제 시 전체 리셋 | ||
| rangeStart = nil | ||
| rangeEnd = nil | ||
| selection.setSelectedDates([], animated: false) | ||
| selectedRange = nil | ||
| } | ||
|
|
||
| // 범위 채우기 | ||
| private func fillRange() { | ||
| guard let start = rangeStart, let end = rangeEnd else { return } | ||
|
|
||
| var dates: [DateComponents] = [] | ||
| var current = start | ||
| while current <= end { | ||
| let components = calendar.dateComponents([.year, .month, .day], from: current) | ||
| dates.append(components) | ||
| guard let next = calendar.date(byAdding: .day, value: 1, to: current) else { break } | ||
| current = next | ||
| } | ||
|
|
||
| selection?.setSelectedDates(dates, animated: false) | ||
| print(" 🟢 범위 채우기 완료: \(dates.count)개 날짜") | ||
| } | ||
|
|
||
| // Binding 업데이트 | ||
| private func updateBinding() { | ||
| guard let start = rangeStart, let end = rangeEnd else { | ||
| selectedRange = nil | ||
| print(" 🔴 selectedRange -> nil") | ||
| return | ||
| } | ||
|
|
||
| selectedRange = start...end | ||
| print(" 🟢 selectedRange 업데이트: \(start) ~ \(end)") | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Peter1119 .black 만 해도 될거 같아요!