refactor(navigation): 전역 경로 기반 단일 내비게이션 흐름으로 전환한다

This commit is contained in:
Yu Sung
2026-03-06 16:34:44 +09:00
parent f145de87aa
commit 42ce09d927
34 changed files with 1181 additions and 873 deletions

View File

@@ -15,91 +15,87 @@ struct OriginalWorkDetailView: View {
let originalId: Int
var body: some View {
NavigationStack {
BaseView(isLoading: $viewModel.isLoading) {
ZStack(alignment: .top) {
if let imageUrl = viewModel.response?.imageUrl {
KFImage(URL(string: imageUrl))
.cancelOnDisappear(true)
Group { BaseView(isLoading: $viewModel.isLoading) {
ZStack(alignment: .top) {
if let imageUrl = viewModel.response?.imageUrl {
KFImage(URL(string: imageUrl))
.cancelOnDisappear(true)
.resizable()
.scaledToFill()
.frame(width: screenSize().width, height: (168 * 288 / 306) + 56)
.clipped()
.blur(radius: 25)
}
Color.black.opacity(0.5).ignoresSafeArea()
VStack(spacing: 0) {
HStack(spacing: 0) {
Image("ic_back")
.resizable()
.scaledToFill()
.frame(width: screenSize().width, height: (168 * 288 / 306) + 56)
.clipped()
.blur(radius: 25)
}
Color.black.opacity(0.5).ignoresSafeArea()
VStack(spacing: 0) {
HStack(spacing: 0) {
Image("ic_back")
.resizable()
.frame(width: 24, height: 24)
.onTapGesture {
AppState.shared.back()
}
Spacer()
}
.padding(.horizontal, 24)
.frame(height: 56)
.frame(width: 24, height: 24)
.onTapGesture {
AppState.shared.back()
}
if let response = viewModel.response {
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 0) {
OriginalWorkDetailHeaderView(item: response)
.padding(.horizontal, 24)
.padding(.bottom, 24)
HStack(spacing: 0) {
SeriesDetailTabView(
title: I18n.Tab.character,
width: screenSize().width / 2,
isSelected: viewModel.currentTab == .character
) {
if viewModel.currentTab != .character {
viewModel.currentTab = .character
}
}
SeriesDetailTabView(
title: I18n.Tab.workInfo,
width: screenSize().width / 2,
isSelected: viewModel.currentTab == .info
) {
if viewModel.currentTab != .info {
viewModel.currentTab = .info
}
Spacer()
}
.padding(.horizontal, 24)
.frame(height: 56)
if let response = viewModel.response {
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 0) {
OriginalWorkDetailHeaderView(item: response)
.padding(.horizontal, 24)
.padding(.bottom, 24)
HStack(spacing: 0) {
SeriesDetailTabView(
title: I18n.Tab.character,
width: screenSize().width / 2,
isSelected: viewModel.currentTab == .character
) {
if viewModel.currentTab != .character {
viewModel.currentTab = .character
}
}
.background(Color.black)
Rectangle()
.foregroundColor(Color.gray90.opacity(0.5))
.frame(height: 1)
.frame(maxWidth: .infinity)
switch(viewModel.currentTab) {
case .info:
OriginalWorkInfoView(response: response)
default:
OriginalWorkCharacterView(characters: viewModel.characters)
SeriesDetailTabView(
title: I18n.Tab.workInfo,
width: screenSize().width / 2,
isSelected: viewModel.currentTab == .info
) {
if viewModel.currentTab != .info {
viewModel.currentTab = .info
}
}
}
.background(Color.black)
Rectangle()
.foregroundColor(Color.gray90.opacity(0.5))
.frame(height: 1)
.frame(maxWidth: .infinity)
switch(viewModel.currentTab) {
case .info:
OriginalWorkInfoView(response: response)
default:
OriginalWorkCharacterView(characters: viewModel.characters)
}
}
}
}
}
}
.onAppear {
if viewModel.response == nil {
viewModel.originalId = originalId
}
}
.navigationDestination(for: Int.self) { characterId in
CharacterDetailView(characterId: characterId)
}
.onAppear {
if viewModel.response == nil {
viewModel.originalId = originalId
}
}
}
}
}
@@ -129,14 +125,13 @@ struct OriginalWorkCharacterView: View {
ForEach(characters.indices, id: \.self) { idx in
let item = characters[idx]
NavigationLink(value: item.characterId) {
CharacterItemView(
character: item,
size: width,
rank: 0,
isShowRank: false
)
}
CharacterItemView(
character: item,
size: width,
rank: 0,
isShowRank: false
)
.onTapGesture { AppState.shared.setAppStep(step: .characterDetail(characterId: item.characterId)) }
}
}
.padding(.horizontal, horizontalPadding)