-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
미니
committed
Sep 21, 2023
1 parent
9e27f0f
commit 1613c28
Showing
6 changed files
with
224 additions
and
53 deletions.
There are no files selected for viewing
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
78 changes: 78 additions & 0 deletions
78
.../ChallengeScene/EmptyChallengeListSection/EmptyChallengeDetail/EmptyChallengeDetail.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,78 @@ | ||
// | ||
// EmptyChallengeDetail.swift | ||
// igoMoney | ||
// | ||
// Copyright (c) 2023 Minii All rights reserved. | ||
|
||
import SwiftUI | ||
|
||
import ComposableArchitecture | ||
|
||
struct EmptyChallengeDetail: View { | ||
let store: StoreOf<ChallengeDetailCore> | ||
|
||
var body: some View { | ||
VStack(alignment: .leading, spacing: 8) { | ||
// 챌린지 타이틀 | ||
WithViewStore(store, observe: { $0.title }) { viewStore in | ||
Text("같이 절약 챌린지 성공해봐요!") | ||
.multilineTextAlignment(.leading) | ||
.minimumScaleFactor(0.5) | ||
.lineLimit(2) | ||
.font(.system(size: 16, weight: .bold)) | ||
} | ||
|
||
// 챌린지 생성자 닉네임 | ||
WithViewStore(store, observe: { $0.user }) { viewStore in | ||
Text(viewStore.nickName) | ||
.font(.system(size: 12, weight: .medium)) | ||
} | ||
|
||
VStack(alignment: .leading, spacing: 2) { | ||
// 챌린지 머니 | ||
WithViewStore(store, observe: { $0.targetMoneyDescription }) { viewStore in | ||
Text(viewStore.state) | ||
.padding(.horizontal, 2) | ||
.background(ColorConstants.primary7) | ||
.cornerRadius(4) | ||
} | ||
|
||
Text("내일부터 시작") | ||
.padding(.horizontal, 2) | ||
.background(ColorConstants.primary7) | ||
.cornerRadius(4) | ||
} | ||
.font(.system(size: 12, weight: .medium)) | ||
|
||
HStack { | ||
Spacer() | ||
|
||
// 사용자 이미지 | ||
WithViewStore(store, observe: { $0.user.profileImagePath }) { viewStore in | ||
if let path = viewStore.state { | ||
// 사용자 프로필 이미지로 변경하기 | ||
Image("default_profile") | ||
.resizable() | ||
.scaledToFit() | ||
.frame(width: 60) | ||
} else { | ||
Image("default_profile") | ||
.resizable() | ||
.scaledToFit() | ||
.frame(width: 60) | ||
} | ||
} | ||
} | ||
} | ||
.padding(16) | ||
.background( | ||
RoundedRectangle(cornerRadius: 10) | ||
.fill(.white) | ||
.shadow( | ||
color: ColorConstants.gray2.opacity(0.3), | ||
radius: 8, | ||
y: 2 | ||
) | ||
) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...llengeScene/EmptyChallengeListSection/EmptyChallengeDetail/EmptyChallengeDetailCore.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,33 @@ | ||
// | ||
// EmptyChallengeDetailCore.swift | ||
// igoMoney | ||
// | ||
// Copyright (c) 2023 Minii All rights reserved. | ||
|
||
import Foundation | ||
|
||
import ComposableArchitecture | ||
|
||
struct ChallengeDetailCore: Reducer { | ||
struct State: Equatable, Identifiable { | ||
let id: UUID | ||
|
||
var title: String | ||
var content: String | ||
var targetAmount: Int | ||
var user: User | ||
|
||
var targetMoneyDescription: String { | ||
return "💸 \(targetAmount)원" | ||
} | ||
} | ||
|
||
enum Action: Equatable, Sendable { | ||
|
||
} | ||
|
||
func reduce(into state: inout State, action: Action) -> Effect<Action> { | ||
return .none | ||
} | ||
} | ||
|
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
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
43 changes: 43 additions & 0 deletions
43
igoMoney/igoMoney/Source/Models/ChallengeInformation.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,43 @@ | ||
// | ||
// ChallengeInformation.swift | ||
// igoMoney | ||
// | ||
// Copyright (c) 2023 Minii All rights reserved. | ||
|
||
import Foundation | ||
|
||
struct ChallengeInformation: Decodable, Equatable { | ||
let title: String | ||
let content: String | ||
let targetAmount: Int | ||
let user: User | ||
|
||
static let `default`: [Self] = Array( | ||
repeating: ChallengeInformation( | ||
title: "일주일에 3만원으로 살아남기 👊🏻", | ||
content: "", | ||
targetAmount: 30000, | ||
user: .default | ||
), | ||
count: 16 | ||
) | ||
|
||
|
||
static func == (lhs: ChallengeInformation, rhs: ChallengeInformation) -> Bool { | ||
return lhs.title == rhs.title && lhs.user.id == rhs.user.id | ||
} | ||
} | ||
|
||
struct User: Decodable, Equatable { | ||
let id: String | ||
let nickName: String | ||
let profileImagePath: String? | ||
let email: String | ||
|
||
static let `default` = User( | ||
id: UUID().uuidString, | ||
nickName: "아이고머니", | ||
profileImagePath: nil, | ||
email: "[email protected]" | ||
) | ||
} |