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

[2.2.0] 피드백, 수정사항 반영 #228

Merged
merged 3 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public struct NoticeListFeature {
return .send(.fetchNotices)

case .fetchNotices:
if state.provider == .emptyDepartment {
if state.provider == .emptyDepartment || state.provider.hostPrefix == "ccd" {
return .none
}
state.isLoading = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ extension KuringLink: DependencyKey {
category: .학과
)
}
NoticeProvider.departments.append(
NoticeProvider(
name: "communication_design",
hostPrefix: "ccd",
korName: "커뮤니케이션디자인학과",
category: .학과
)
)
return NoticeProvider.departments
},
registerAuthorization: {
Expand Down
24 changes: 14 additions & 10 deletions package-kuring/Sources/UIKit/DepartmentUI/DepartmentEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,32 @@ public struct DepartmentEditor: View {
// 내학과
ScrollView {
ForEach(store.myDepartments) { myDepartment in
DepartmentRow(
department: myDepartment,
style: .delete
) {
Button(action: {
store.send(.deleteMyDepartmentButtonTapped(id: myDepartment.id))
}
}, label: {
DepartmentRow(
department: myDepartment,
style: .delete
)
})
}
}
} else {
// 검색결과
ScrollView {
ForEach(store.searchResults) { result in
DepartmentRow(
department: result,
style: .radio(store.myDepartments.contains(result))
) {
Button(action: {
if store.myDepartments.contains(result) {
store.send(.cancelAdditionButtonTapped(id: result.id))
} else {
store.send(.addDepartmentButtonTapped(id: result.id))
}
}
}, label: {
DepartmentRow(
department: result,
style: .radio(store.myDepartments.contains(result))
)
})
}
}
}
Expand Down
38 changes: 16 additions & 22 deletions package-kuring/Sources/UIKit/DepartmentUI/DepartmentRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import DepartmentFeatures
public struct DepartmentRow: View {
public let department: NoticeProvider
public let style: ButtonStyle
public let action: () -> Void

public enum ButtonStyle {
case delete
Expand All @@ -33,33 +32,28 @@ public struct DepartmentRow: View {

switch style {
case .delete:
Button(action: action) {
Text("삭제")
.foregroundStyle(Color.Kuring.caption1)
}
Text("삭제")
.foregroundStyle(Color.Kuring.caption1)
case let .radio(isSelected):
Button(action: action) {
Image(
systemName: isSelected
? "checkmark.circle.fill"
: "plus.circle"
)
.foregroundStyle(
isSelected
? Color.Kuring.primary
: Color.Kuring.gray200
)
}
Image(
systemName: isSelected
? "checkmark.circle.fill"
: "plus.circle"
)
.foregroundStyle(
isSelected
? Color.Kuring.primary
: Color.Kuring.gray200
)
}
}
.padding(.horizontal, 4)
.padding(.vertical, 10)
}

public init(department: NoticeProvider, style: ButtonStyle, action: @escaping () -> Void) {
public init(department: NoticeProvider, style: ButtonStyle) {
self.department = department
self.style = style
self.action = action
}

/// 대표 학과 여부를 나타내는 칩
Expand All @@ -76,10 +70,10 @@ public struct DepartmentRow: View {

#Preview {
Group {
DepartmentRow(department: .국제, style: .delete) { }
DepartmentRow(department: .국제, style: .delete)

DepartmentRow(department: .국제, style: .radio(true)) { }
DepartmentRow(department: .국제, style: .radio(true))

DepartmentRow(department: .국제, style: .radio(false)) { }
DepartmentRow(department: .국제, style: .radio(false))
}
}
4 changes: 2 additions & 2 deletions package-kuring/Sources/UIKit/NoticeUI/NoticeApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public struct NoticeApp: View {
SearchFeature.State()
)
) {
Image(systemName: "magnifyingglass")
Image("magnifyingglass", bundle: Bundle.notices)
.foregroundStyle(Color.Kuring.gray400)
}
}
Expand All @@ -49,7 +49,7 @@ public struct NoticeApp: View {
Button {
store.send(.changeSubscriptionButtonTapped)
} label: {
Image(systemName: "bell")
Image("bell", bundle: Bundle.notices)
.foregroundStyle(Color.Kuring.gray400)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ extension NoticeContentView {
Spacer()
}
}

@ViewBuilder
func CannotFetchDepartmentView() -> some View {
VStack(spacing: 32) {
Spacer()

Text("홈페이지 사정 상,\n공지를 불러올 수 없는 학과예요.")
.font(.system(size: 15, weight: .medium))
.multilineTextAlignment(.center)
.foregroundStyle(Color.Kuring.caption2)

Spacer()
}
}

// TODO: 디자인 시스템 분리
/// 상단에 블러가 존재하는 버튼
Expand Down
18 changes: 18 additions & 0 deletions package-kuring/Sources/UIKit/NoticeUI/NoticeContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ struct NoticeContentView: View {

if self.store.provider == .emptyDepartment {
NoDepartmentView()
}
// MARK: 커뮤니케이션디자인학과의 경우에만 예외로 다른 화면을 넣어줘야 함
else if self.store.provider.hostPrefix == "ccd" {
Section {
CannotFetchDepartmentView()
} header: {
VStack(spacing: 0) {
DepartmentSelectorLink(
department: self.store.provider,
isLoading: $store.isLoading.sending(\.loadingChanged)
) {
self.store.send(.changeDepartmentButtonTapped)
}

Divider()
.frame(height: 0.25)
}
}
} else {
NoticeList(store: self.store)
}
Expand Down
9 changes: 4 additions & 5 deletions package-kuring/Sources/UIKit/NoticeUI/NoticeDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ public struct NoticeDetailView: View {
Button {
self.store.send(.bookmarkButtonTapped)
} label: {
Image(
systemName: self.store.isBookmarked
? "bookmark.fill"
: "bookmark"
Image(self.store.isBookmarked
lgvv marked this conversation as resolved.
Show resolved Hide resolved
? "bookmark-fill"
: "bookmark", bundle: Bundle.notices
)
}

ShareLink(
item: store.notice.url
) {
Image(systemName: "square.and.arrow.up")
Image("share", bundle: Bundle.notices)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
lgvv marked this conversation as resolved.
Show resolved Hide resolved
"images" : [
{
"filename" : "bell.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "bell-dark.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "bookmark-fill.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "bookmark-fill-dark.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "bookmark.svg",
lgvv marked this conversation as resolved.
Show resolved Hide resolved
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "bookmark-dark.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "mag.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "mag-dark.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading