Skip to content
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

fix: 1.0.5 버전에 따른 UI 수정 및 기능 추가 #163

Merged
merged 5 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Projects/App/Resources/Pokit-info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.4</string>
<string>1.0.5</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down
6 changes: 4 additions & 2 deletions Projects/App/Sources/MainTab/MainTabPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ public extension MainTabFeature {

/// - 포킷 `추가` 버튼 눌렀을 때
case .delegate(.포킷추가하기),
.path(.element(_, action: .링크추가및수정(.delegate(.포킷추가하기)))):
.path(.element(_, action: .링크추가및수정(.delegate(.포킷추가하기)))),
.pokit(.delegate(.포킷추가_버튼_눌렀을때)):
state.path.append(.포킷추가및수정(PokitCategorySettingFeature.State(type: .추가)))
return .none

Expand Down Expand Up @@ -164,7 +165,8 @@ public extension MainTabFeature {
state.path.append(.링크추가및수정(ContentSettingFeature.State(contentId: id)))
return .none
/// - 링크 추가하기
case .delegate(.링크추가하기):
case .delegate(.링크추가하기),
.pokit(.delegate(.링크추가_버튼_눌렀을때)):
state.categoryId = nil
state.path.append(.링크추가및수정(ContentSettingFeature.State(urlText: state.link)))
state.link = nil
Expand Down
95 changes: 76 additions & 19 deletions Projects/DSKit/Sources/Components/PokitCaution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,79 @@

import SwiftUI

public enum CautionType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

열거형 너무 좋은거 같아요! 굳!

case 카테고리없음
case 미분류_링크없음
case 링크없음
case 즐겨찾기_링크없음
case 링크부족
case 알림없음

var image: PokitImage.Character {
switch self {
case .카테고리없음, .링크없음, .즐겨찾기_링크없음, .미분류_링크없음:
return .empty
case .링크부족:
return .sad
case .알림없음:
return .pooki
}
}

var title: String {
switch self {
case .카테고리없음:
return "저장된 포킷이 없어요!"
case .미분류_링크없음:
return "미분류 링크가 없어요!"
case .링크없음:
return "저장된 링크가 없어요!"
case .즐겨찾기_링크없음:
return "즐겨찾기 링크가 없어요!"
case .링크부족:
return "링크가 부족해요!"
case .알림없음:
return "알림이 없어요"
}
}

var message: String {
switch self {
case .카테고리없음:
return "포킷을 생성해 링크를 저장해보세요"
case .미분류_링크없음:
return "링크를 포킷에 깔끔하게 분류하셨어요"
case .링크없음:
return "다양한 링크를 한 곳에 저장해보세요"
case .즐겨찾기_링크없음:
return "링크를 즐겨찾기로 관리해보세요"
case .링크부족:
return "링크를 5개 이상 저장하고 추천을 받아보세요"
case .알림없음:
return "리마인드 알림을 설정하세요"
}
}

var actionTitle: String? {
switch self {
case .카테고리없음:
return "포킷 추가하기"
case .미분류_링크없음:
return "링크 추가하기"
default: return nil
}
}
}

public struct PokitCaution: View {
private let image: PokitImage.Character
private let titleKey: String
private let message: String
private let type: CautionType
private let action: (() -> Void)?

public init(
image: PokitImage.Character,
titleKey: String,
message: String,
type: CautionType,
action: (() -> Void)? = nil
) {
self.image = image
self.titleKey = titleKey
self.message = message
self.type = type
self.action = action
}

Expand All @@ -30,27 +88,28 @@ public struct PokitCaution: View {
Spacer()

VStack(spacing: 0) {
Image(.character(image))
Image(.character(type.image))
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 180, height: 180)
.padding(.bottom, 16)

Text(titleKey)
Text(type.title)
.pokitFont(.title2)
.foregroundStyle(.pokit(.text(.secondary)))
.padding(.bottom, 8)

Text(message)
Text(type.message)
.pokitFont(.b2(.m))
.foregroundStyle(.pokit(.text(.secondary)))
.padding(.bottom, 16)

if let action {
if let action,
let actionTitle = type.actionTitle {
PokitTextButton(
"다시시도",
state: .default(.secondary),
size: .small,
actionTitle,
state: .stroke(.secondary),
size: .medium,
shape: .rectangle,
action: action
)
Expand All @@ -64,9 +123,7 @@ public struct PokitCaution: View {

#Preview {
PokitCaution(
image: .empty,
titleKey: "저장된 포킷이 없어요!",
message: "포킷을 생성해 링크를 저장해보세요",
type: .미분류_링크없음,
action: {}
)
}
6 changes: 1 addition & 5 deletions Projects/DSKit/Sources/Components/PokitList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ public struct PokitList<Item: PokitSelectItem>: View {
public var body: some View {
if list.isEmpty {
VStack {
PokitCaution(
image: .empty,
titleKey: "저장된 포킷이 없어요!",
message: "포킷을 생성해 링크를 저장해보세요"
)
PokitCaution(type: .카테고리없음)

Spacer()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ private extension CategoryDetailView {
if !store.isLoading {
if store.contents.isEmpty {
VStack {
PokitCaution(
image: .empty,
titleKey: "저장된 링크가 없어요!",
message: "다양한 링크를 한 곳에 저장해보세요"
)
PokitCaution(type: .링크없음)
.padding(.top, 20)

Spacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ private extension CategorySharingView {
if !store.isLoading {
if store.contents.isEmpty {
VStack {
PokitCaution(
image: .empty,
titleKey: "저장된 링크가 없어요!",
message: "다양한 링크를 한 곳에 저장해보세요"
)
PokitCaution(type: .링크없음)
.padding(.top, 20)

Spacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ private extension ContentListView {
Group {
if !store.isLoading {
if store.contents.isEmpty {
PokitCaution(
image: .empty,
titleKey: "즐겨찾기 링크가 없어요!",
message: "링크를 즐겨찾기로 관리해보세요"
)
PokitCaution(type: .즐겨찾기_링크없음)
.padding(.top, 100)

Spacer()
Expand Down
11 changes: 11 additions & 0 deletions Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public struct PokitRootFeature {
case 분류_버튼_눌렀을때
case 케밥_버튼_눌렀을때(BaseCategoryItem)
case 미분류_케밥_버튼_눌렀을때(BaseContentItem)
case 포킷추가_버튼_눌렀을때
case 링크추가_버튼_눌렀을때
case 카테고리_눌렀을때(BaseCategoryItem)
case 컨텐츠_항목_눌렀을때(BaseContentItem)
case 링크_공유_완료되었을때
Expand Down Expand Up @@ -123,6 +125,9 @@ public struct PokitRootFeature {
/// 링크상세로 이동
case contentDetailTapped(BaseContentItem)
case 미분류_카테고리_컨텐츠_조회

case 포킷추가_버튼_눌렀을때
case 링크추가_버튼_눌렀을때
}
}

Expand Down Expand Up @@ -209,6 +214,12 @@ private extension PokitRootFeature {
case .미분류_케밥_버튼_눌렀을때(let selectedItem):
state.selectedUnclassifiedItem = selectedItem
return .run { send in await send(.inner(.카테고리_시트_활성화(true))) }

case .포킷추가_버튼_눌렀을때:
return .run { send in await send(.delegate(.포킷추가_버튼_눌렀을때)) }

case .링크추가_버튼_눌렀을때:
return .run { send in await send(.delegate(.링크추가_버튼_눌렀을때)) }

case .카테고리_눌렀을때(let category):
return .run { send in await send(.delegate(.categoryTapped(category))) }
Expand Down
10 changes: 4 additions & 6 deletions Projects/Feature/FeaturePokit/Sources/PokitRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ private extension PokitRootView {
if categories.isEmpty {
VStack {
PokitCaution(
image: .empty,
titleKey: "저장된 포킷이 없어요!",
message: "포킷을 생성해 링크를 저장해보세요"
type: .카테고리없음,
action: { send(.포킷추가_버튼_눌렀을때) }
)
.padding(.top, 36)

Expand Down Expand Up @@ -171,9 +170,8 @@ private extension PokitRootView {
if store.contents.isEmpty {
VStack {
PokitCaution(
image: .empty,
titleKey: "저장된 링크가 없어요!",
message: "다양한 링크를 한 곳에 저장해보세요"
type: .미분류_링크없음,
action: { send(.링크추가_버튼_눌렀을때) }
)
.padding(.top, 36)

Expand Down
18 changes: 3 additions & 15 deletions Projects/Feature/FeatureRemind/Sources/Remind/RemindView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ extension RemindView {
unreadContents.isEmpty &&
favoriteContents.isEmpty {
VStack {
PokitCaution(
image: .sad,
titleKey: "링크가 부족해요!",
message: "링크를 5개 이상 저장하고 추천을 받아보세요"
)
PokitCaution(type: .링크부족)
.padding(.top, 100)

Spacer()
Expand Down Expand Up @@ -111,11 +107,7 @@ extension RemindView {
.padding(.horizontal, 20)

if recommendedContents.isEmpty {
PokitCaution(
image: .sad,
titleKey: "링크가 부족해요!",
message: "링크를 5개 이상 저장하고 추천을 받아보세요"
)
PokitCaution(type: .링크부족)
.padding(.top, 24)
.padding(.bottom, 32)
} else {
Expand Down Expand Up @@ -293,11 +285,7 @@ extension RemindView {
.padding(.bottom, 16)

if favoriteContents.isEmpty {
PokitCaution(
image: .empty,
titleKey: "즐겨찾기 링크가 없어요!",
message: "링크를 즐겨찾기로 관리해보세요"
)
PokitCaution(type: .즐겨찾기_링크없음)
.padding(.top, 16)
} else {
ForEach(favoriteContents, id: \.id) { content in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ public extension PokitAlertBoxView {
if let alertContents = store.alertContents {
if alertContents.isEmpty {
VStack {
PokitCaution(
image: .pooki,
titleKey: "알림이 없어요",
message: "리마인드 알림을 설정하세요"
)
PokitCaution(type: .알림없음)
.padding(.top, 84)
Spacer()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private extension PokitSearchView {
PokitIconRInput(
text: $store.searchText,
icon: store.isSearching ? .icon(.x) : .icon(.search),
placeholder: "제목, 메모를 검색해보세요.",
shape: .round,
focusState: $focused,
equals: true,
Expand Down
Loading