From 54d2787be0e6547bfe01c4937860d9b022d43a15 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Wed, 1 Jul 2026 15:27:39 +0900 Subject: [PATCH] =?UTF-8?q?feat(home):=20=EB=9E=AD=ED=82=B9=20=EC=86=8C?= =?UTF-8?q?=EC=8B=9D=20=EC=B9=B4=EB=93=9C=EB=A5=BC=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive.xcodeproj/project.pbxproj | 8 ++ SodaLive/Sources/I18n/I18n.swift | 16 +++ .../MainHomeFollowingRankingNewsCard.swift | 116 ++++++++++++++++++ docs/20260630_메인_홈_팔로잉_탭/plan-task.md | 7 +- 4 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingRankingNewsCard.swift diff --git a/SodaLive.xcodeproj/project.pbxproj b/SodaLive.xcodeproj/project.pbxproj index 6f1bea21..c8a72d0b 100644 --- a/SodaLive.xcodeproj/project.pbxproj +++ b/SodaLive.xcodeproj/project.pbxproj @@ -270,6 +270,9 @@ 401C104D2FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10502FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift */; }; 401C104E2FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10502FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift */; }; 401C104F2FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10502FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift */; }; + 401C10512FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10542FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift */; }; + 401C10522FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10542FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift */; }; + 401C10532FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10542FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift */; }; 40235DED2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40235DEC2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift */; }; 40235DEE2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40235DEC2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift */; }; 40235DF02E37983D00B09A87 /* PersistenceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40235DEF2E37983D00B09A87 /* PersistenceController.swift */; }; @@ -1812,6 +1815,7 @@ 401C10482FEF700000A5BBA3 /* MainHomeFollowingLiveSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeFollowingLiveSection.swift; sourceTree = ""; }; 401C10492FEF900000A5BBA3 /* MainHomeFollowingChatSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeFollowingChatSection.swift; sourceTree = ""; }; 401C10502FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeFollowingScheduleSection.swift; sourceTree = ""; }; + 401C10542FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeFollowingRankingNewsCard.swift; sourceTree = ""; }; 40235DEC2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RecentContent+CoreDataClass.swift"; sourceTree = ""; }; 40235DEF2E37983D00B09A87 /* PersistenceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistenceController.swift; sourceTree = ""; }; 40235DF22E37987300B09A87 /* RecentContentService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentContentService.swift; sourceTree = ""; }; @@ -2827,6 +2831,7 @@ 401C10482FEF700000A5BBA3 /* MainHomeFollowingLiveSection.swift */, 401C10492FEF900000A5BBA3 /* MainHomeFollowingChatSection.swift */, 401C10502FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift */, + 401C10542FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift */, ); path = Components; sourceTree = ""; @@ -5499,6 +5504,7 @@ 401C10452FEF700000A5BBA3 /* MainHomeFollowingLiveSection.swift in Sources */, 401C104A2FEF900000A5BBA3 /* MainHomeFollowingChatSection.swift in Sources */, 401C104D2FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift in Sources */, + 401C10512FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */, 409143302A85652F00EEBFB1 /* CanChargeView.swift in Sources */, 40975CA32B572298004E2F1B /* LiveRoomOverlayStrokeTextButton.swift in Sources */, 40235DED2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift in Sources */, @@ -6267,6 +6273,7 @@ 401C10462FEF700000A5BBA3 /* MainHomeFollowingLiveSection.swift in Sources */, 401C104B2FEF900000A5BBA3 /* MainHomeFollowingChatSection.swift in Sources */, 401C104E2FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift in Sources */, + 401C10522FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */, B3AF650899B8FC84E0C0CDA0 /* MainPlaceholderTabView.swift in Sources */, CA65AD0D677B4A8E9CAC0E15 /* MainTab.swift in Sources */, A0643C829BE7377DC09112CB /* MainTabBarButton.swift in Sources */, @@ -7065,6 +7072,7 @@ 401C10472FEF700000A5BBA3 /* MainHomeFollowingLiveSection.swift in Sources */, 401C104C2FEF900000A5BBA3 /* MainHomeFollowingChatSection.swift in Sources */, 401C104F2FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift in Sources */, + 401C10532FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */, ACD71056E97E13E48941ABBB /* MainPlaceholderTabView.swift in Sources */, 33BA3AB731849284E62AE04B /* MainTab.swift in Sources */, B11681AC02BF51C6E2FA6FF3 /* MainTabBarButton.swift in Sources */, diff --git a/SodaLive/Sources/I18n/I18n.swift b/SodaLive/Sources/I18n/I18n.swift index 187b6ddd..1d27ee2b 100644 --- a/SodaLive/Sources/I18n/I18n.swift +++ b/SodaLive/Sources/I18n/I18n.swift @@ -3127,6 +3127,22 @@ If you block this user, the following features will be restricted. pick(ko: "최근 소식", en: "Recent news", ja: "最近のニュース") } + static func rankingMessagePrefix(_ title: String) -> String { + pick( + ko: "\(title)님이 이번 주 랭킹 ", + en: "\(title) reached ", + ja: "\(title)さんが今週のランキング" + ) + } + + static func rankingRankText(_ rank: Int) -> String { + pick(ko: "\(rank)위", en: "No. \(rank)", ja: "\(rank)位") + } + + static var rankingMessageSuffix: String { + pick(ko: "에 올랐어요!", en: " in this week's ranking!", ja: "に入りました!") + } + static var audioTag: String { pick(ko: "오디오", en: "Audio", ja: "オーディオ") } diff --git a/SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingRankingNewsCard.swift b/SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingRankingNewsCard.swift new file mode 100644 index 00000000..e3e5bb79 --- /dev/null +++ b/SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingRankingNewsCard.swift @@ -0,0 +1,116 @@ +import SwiftUI + +struct MainHomeFollowingRankingNewsCard: View { + private let imageUrl: String? + private let title: String + private let rank: Int + private let action: () -> Void + + init( + creatorRanking: FollowingCreatorRankingNewsResponse, + onTapCreator: @escaping (Int) -> Void = { _ in } + ) { + self.imageUrl = creatorRanking.profileImageUrl + self.title = creatorRanking.nickname + self.rank = creatorRanking.rank + self.action = { onTapCreator(creatorRanking.creatorId) } + } + + init( + contentRanking: FollowingContentRankingNewsResponse, + onTapContent: @escaping (Int) -> Void = { _ in } + ) { + self.imageUrl = contentRanking.contentImageUrl + self.title = contentRanking.title + self.rank = contentRanking.rank + self.action = { onTapContent(contentRanking.contentId) } + } + + var body: some View { + Button(action: action) { + HStack(alignment: .center, spacing: SodaSpacing.s14) { + RankingThumbnailView(imageUrl: imageUrl, rank: rank) + + rankingMessage + .appFont(size: 16, weight: .medium) + .lineSpacing(0) + .multilineTextAlignment(.leading) + .frame(maxWidth: .infinity, alignment: .leading) + } + .padding(SodaSpacing.s14) + .background(Color.gray900) + .clipShape(RoundedRectangle(cornerRadius: SodaRadius.r14, style: .continuous)) + } + .buttonStyle(.plain) + } + + private var rankingMessage: Text { + Text(I18n.HomeFollowing.rankingMessagePrefix(title)) + .foregroundColor(.white) + + Text(I18n.HomeFollowing.rankingRankText(rank)) + .foregroundColor(Color.soda400) + + Text(I18n.HomeFollowing.rankingMessageSuffix) + .foregroundColor(.white) + } +} + +private struct RankingThumbnailView: View { + let imageUrl: String? + let rank: Int + + var body: some View { + ZStack(alignment: .bottomTrailing) { + DownsampledKFImage(url: imageUrl.flatMap(URL.init(string:)), size: CGSize(width: 80, height: 80)) + .clipShape(RoundedRectangle(cornerRadius: SodaRadius.r14, style: .continuous)) + + LinearGradient( + colors: [Color.black.opacity(0), Color.black.opacity(0.5)], + startPoint: .top, + endPoint: .bottom + ) + .clipShape(RoundedRectangle(cornerRadius: SodaRadius.r14, style: .continuous)) + + Text("\(rank)") + .appFont(size: 40, weight: .regular, family: .pattaya) + .foregroundStyle( + LinearGradient( + colors: [.white, Color(hex: "EEEEEE")], + startPoint: .top, + endPoint: .bottom + ) + ) + .shadow(color: Color.black.opacity(0.48), radius: 2) + .offset(x: 0, y: 24) + } + .frame(width: 80, height: 80) + } +} + +struct MainHomeFollowingRankingNewsCard_Previews: PreviewProvider { + private static let previewImageUrl = "https://picsum.photos/500/500" + + static var previews: some View { + VStack(spacing: SodaSpacing.s12) { + MainHomeFollowingRankingNewsCard( + creatorRanking: FollowingCreatorRankingNewsResponse( + rank: 2, + creatorId: 1, + nickname: "크리", + profileImageUrl: previewImageUrl + ) + ) + + MainHomeFollowingRankingNewsCard( + contentRanking: FollowingContentRankingNewsResponse( + rank: 4, + contentId: 10, + contentImageUrl: previewImageUrl, + title: "콘텐츠 제목" + ) + ) + } + .padding(SodaSpacing.s14) + .background(Color.black) + .previewLayout(.sizeThatFits) + } +} diff --git a/docs/20260630_메인_홈_팔로잉_탭/plan-task.md b/docs/20260630_메인_홈_팔로잉_탭/plan-task.md index 6a217d2a..6f017608 100644 --- a/docs/20260630_메인_홈_팔로잉_탭/plan-task.md +++ b/docs/20260630_메인_홈_팔로잉_탭/plan-task.md @@ -315,7 +315,7 @@ ### Phase 8: 최근 소식 랭킹 카드 -- [ ] **Task 8.1: 최근 소식 랭킹 카드 생성** +- [x] **Task 8.1: 최근 소식 랭킹 카드 생성** - 대상 파일: - 생성: `SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingRankingNewsCard.swift` - 작업 내용: @@ -536,3 +536,8 @@ - 2026-07-01: `rg "VStack\(alignment: \.leading, spacing: SodaSpacing\.s4\)|ScheduleTimelineLine|TimelineDotView|padding\(\.vertical, 52\)|opacity\(monthlySchedules\.count > 1|HStack\(alignment: \.center, spacing: SodaSpacing\.s14\)|localhost:3845" SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingScheduleSection.swift`로 연속 line/dot 구조와 Figma localhost asset 미사용을 확인했다. - 2026-07-01: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug -derivedDataPath "/var/folders/yh/8xsbvpsj5wg2qnxzxdp11_gm0000gn/T/opencode/SodaLiveDerivedDataPhase7" build`를 실행해 timeline 수정 후 빌드 성공을 확인했다. 기존 warning은 남아 있으나 컴파일 오류는 없었다. - 2026-07-01: `MainHomeFollowingView` 및 팔로잉 하위 컴포넌트의 런타임 노출 하드코딩 문구(`팔로잉`, `LIVE`, `Direct`, `오늘`, `On Air`, 스케줄 활동 태그)를 `I18n.HomeFollowing` 참조로 전환했다. Preview 샘플 문자열과 API 응답 기반 동적 문자열은 런타임 고정 문구가 아니므로 유지했다. +- 2026-07-01: Phase 8 구현을 진행해 Figma `24:5717` 기준 `MainHomeFollowingRankingNewsCard`를 추가했다. `CREATOR_RANKING`은 `FollowingCreatorRankingNewsResponse`, `CONTENT_RANKING`은 `FollowingContentRankingNewsResponse` initializer로 분리하고, `rank`를 `N위`로 표시하며 `Color.soda400`로 강조했다. +- 2026-07-01: `SodaLive.xcodeproj/project.pbxproj`에 `MainHomeFollowingRankingNewsCard.swift` 파일 참조와 Sources build file을 추가해 Xcode navigator와 target compile sources에서 확인 가능하도록 등록했다. +- 2026-07-01: `rg "struct MainHomeFollowingRankingNewsCard|FollowingCreatorRankingNewsResponse|FollowingContentRankingNewsResponse|rank|Color.soda400|onTapCreator|onTapContent|24:5717" SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingRankingNewsCard.swift docs/20260630_메인_홈_팔로잉_탭/plan-task.md`로 Phase 8 정적 요구사항을 확인했다. +- 2026-07-01: `rg "localhost:3845|// Figma|/\*|english\(" SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingRankingNewsCard.swift` 결과가 없어 Figma localhost asset, 불필요한 주석, 잘못된 font family 호출이 없음을 확인했다. +- 2026-07-01: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug -derivedDataPath "/var/folders/yh/8xsbvpsj5wg2qnxzxdp11_gm0000gn/T/opencode/SodaLiveDerivedDataPhase8" build`를 실행해 Phase 8 신규 Swift 파일 컴파일과 빌드 성공을 확인했다. 기존 duplicate build file/run script/AppIntents/dependency scan warning은 남아 있으나 컴파일 오류는 없었다.