-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat/#19] Calendar 기능 상세 구현
- Loading branch information
Showing
20 changed files
with
685 additions
and
275 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
Projects/Folio/Shared/DesignSystem/Resources/Color.xcassets/Black.colorset/Contents.json
This file contains 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,33 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"color" : { | ||
"platform" : "universal", | ||
"reference" : "labelColor" | ||
}, | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0xFF", | ||
"green" : "0xFF", | ||
"red" : "0xFE" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Projects/Folio/Shared/DesignSystem/Resources/Color.xcassets/Contents.json
This file contains 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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
Projects/Folio/Shared/DesignSystem/Resources/Color.xcassets/White.colorset/Contents.json
This file contains 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,38 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0xFF", | ||
"green" : "0xFF", | ||
"red" : "0xFE" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0xFF", | ||
"green" : "0xFF", | ||
"red" : "0xFE" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Projects/Folio/Shared/DesignSystem/Sources/Color+Extension.swift
This file contains 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,14 @@ | ||
// | ||
// Color+Extension.swift | ||
// FolioSharedDesignSystem | ||
// | ||
// Created by 송영모 on 2023/09/18. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public extension Color { | ||
static func blackOrWhite(_ isSelected: Bool = false) -> Self { | ||
return isSelected ? Color(uiColor: .label) : Color(uiColor: .systemBackground) | ||
} | ||
} |
This file contains 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
79 changes: 79 additions & 0 deletions
79
Projects/Toolinder/Feature/Calendar/Interface/Sources/Asset/Cell/TradeItemCellStore.swift
This file contains 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,79 @@ | ||
// | ||
// TradeItemCellStore.swift | ||
// ToolinderFeatureCalendarDemo | ||
// | ||
// Created by 송영모 on 2023/09/18. | ||
// | ||
|
||
import Foundation | ||
|
||
import ComposableArchitecture | ||
|
||
import ToolinderDomain | ||
|
||
public struct TradeItemCellStore: Reducer { | ||
public init() {} | ||
|
||
public enum ViewType { | ||
case `default` | ||
case edit | ||
} | ||
|
||
public struct State: Equatable, Identifiable { | ||
public let id: UUID | ||
public let trade: Trade | ||
|
||
public let viewType: ViewType | ||
public let dateStyle: DateFormatter.Style | ||
public let timeStyle: DateFormatter.Style | ||
|
||
public var isSelected: Bool | ||
public init( | ||
id: UUID = .init(), | ||
trade: Trade, | ||
viewType: ViewType = .default, | ||
dateStyle: DateFormatter.Style, | ||
timeStyle: DateFormatter.Style, | ||
isSelected: Bool = false | ||
) { | ||
self.id = id | ||
self.trade = trade | ||
self.viewType = viewType | ||
self.dateStyle = dateStyle | ||
self.timeStyle = timeStyle | ||
self.isSelected = isSelected | ||
} | ||
} | ||
|
||
public enum Action: Equatable { | ||
case onAppear | ||
|
||
case tapped | ||
case editButtonTapped | ||
|
||
case delegate(Delegate) | ||
|
||
public enum Delegate: Equatable { | ||
case tapped | ||
case editButtonTapped | ||
} | ||
} | ||
|
||
public var body: some ReducerOf<Self> { | ||
Reduce { state, action in | ||
switch action { | ||
case .onAppear: | ||
return .none | ||
|
||
case .tapped: | ||
return .send(.delegate(.tapped)) | ||
|
||
case .editButtonTapped: | ||
return .send(.delegate(.editButtonTapped)) | ||
|
||
default: | ||
return .none | ||
} | ||
} | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
Projects/Toolinder/Feature/Calendar/Interface/Sources/Asset/Cell/TradeItemCellView.swift
This file contains 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,86 @@ | ||
// | ||
// TradeItemCellView.swift | ||
// ToolinderFeatureCalendarDemo | ||
// | ||
// Created by 송영모 on 2023/09/18. | ||
// | ||
|
||
import SwiftUI | ||
|
||
import ComposableArchitecture | ||
|
||
import ToolinderShared | ||
import ToolinderDomain | ||
|
||
public struct TradeItemCellView: View { | ||
private let store: StoreOf<TradeItemCellStore> | ||
|
||
public init(store: StoreOf<TradeItemCellStore>) { | ||
self.store = store | ||
} | ||
|
||
public var body: some View { | ||
WithViewStore(self.store, observe: { $0 }) { viewStore in | ||
HStack { | ||
tradeView(viewStore: viewStore) | ||
|
||
switch viewStore.state.viewType { | ||
case .default: | ||
EmptyView() | ||
case .edit: | ||
editButtonView(viewStore: viewStore) | ||
} | ||
} | ||
} | ||
} | ||
|
||
private func tradeView(viewStore: ViewStoreOf<TradeItemCellStore>) -> some View { | ||
HStack(spacing: 10) { | ||
Text( | ||
viewStore.trade.date.localizedString( | ||
dateStyle: viewStore.state.dateStyle, | ||
timeStyle: viewStore.state.timeStyle | ||
) | ||
) | ||
.font(.headline) | ||
.fontWeight(.semibold) | ||
|
||
viewStore.state.trade.ticker?.type?.image | ||
.font(.title3) | ||
.foregroundStyle(viewStore.state.trade.side == .buy ? .pink : .mint) | ||
|
||
Text(viewStore.state.trade.ticker?.name ?? "") | ||
.font(.body) | ||
.fontWeight(.semibold) | ||
|
||
Spacer() | ||
} | ||
.frame(height: 35) | ||
.padding(10) | ||
.background(viewStore.state.isSelected ? Color(uiColor: .systemGray5) : Color(uiColor: .systemGray6)) | ||
.clipShape( | ||
RoundedRectangle( | ||
cornerRadius: 8 | ||
) | ||
) | ||
.onTapGesture { | ||
viewStore.send(.tapped) | ||
} | ||
} | ||
|
||
private func editButtonView(viewStore: ViewStoreOf<TradeItemCellStore>) -> some View { | ||
Button(action: { | ||
viewStore.send(.editButtonTapped) | ||
}, label: { | ||
Image(systemName: "square.and.pencil") | ||
}) | ||
.frame(height: 35) | ||
.padding(10) | ||
.background(viewStore.state.isSelected ? Color(uiColor: .systemGray5) : Color(uiColor: .systemGray6)) | ||
.clipShape( | ||
RoundedRectangle( | ||
cornerRadius: 8 | ||
) | ||
) | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...s/Toolinder/Feature/Calendar/Interface/Sources/Asset/Cell/TradePreviewItemCellStore.swift
This file contains 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,60 @@ | ||
// | ||
// TradePreviewItemCellStore.swift | ||
// ToolinderFeatureCalendarDemo | ||
// | ||
// Created by 송영모 on 2023/09/18. | ||
// | ||
|
||
import Foundation | ||
|
||
import ComposableArchitecture | ||
|
||
import ToolinderDomain | ||
|
||
public struct TradePreviewItemCellStore: Reducer { | ||
public init() {} | ||
|
||
public struct State: Equatable, Identifiable { | ||
public let id: UUID | ||
|
||
public let trade: Trade | ||
public var isSelected: Bool | ||
|
||
public init( | ||
id: UUID = .init(), | ||
trade: Trade, | ||
isSelected: Bool = false | ||
) { | ||
self.id = id | ||
self.trade = trade | ||
self.isSelected = isSelected | ||
} | ||
} | ||
|
||
public enum Action: Equatable { | ||
case onAppear | ||
|
||
case tapped | ||
|
||
case delegate(Delegate) | ||
|
||
public enum Delegate: Equatable { | ||
case tapped | ||
} | ||
} | ||
|
||
public var body: some ReducerOf<Self> { | ||
Reduce { state, action in | ||
switch action { | ||
case .onAppear: | ||
return .none | ||
|
||
case .tapped: | ||
return .send(.delegate(.tapped)) | ||
|
||
default: | ||
return .none | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.