@@ -30,17 +30,19 @@ public struct CategoryDetailView: View {
3030public extension CategoryDetailView {
3131 var body : some View {
3232 WithPerceptionTracking {
33- ScrollView {
33+ ScrollView ( showsIndicators : false ) {
3434 VStack ( spacing: 24 ) {
3535 header
3636 scrollObservableView
3737 LazyVStack ( spacing: 0 , pinnedViews: [ . sectionHeaders] ) {
3838 Section {
3939 contentScrollView
40+ . padding ( . horizontal, 20 )
4041 } header: {
4142 VStack ( spacing: 24 ) {
42- PokitDivider ( ) . padding ( . horizontal , - 20 )
43+ PokitDivider ( )
4344 filterHeader
45+ . padding ( . horizontal, 20 )
4446 }
4547 . padding ( . bottom, 16 )
4648 . background ( . white)
@@ -60,27 +62,26 @@ public extension CategoryDetailView {
6062 isSticky = false
6163 }
6264 } )
63- . padding ( . horizontal, 20 )
6465 . padding ( . top, 12 )
6566 . pokitNavigationBar { navigationBar }
66- //TODO: overlay(condition) merge ์ ์์
67- . overlay ( alignment: . bottomTrailing) {
68- if !store. contents. isEmpty {
69- Button ( action: { send ( . ๋งํฌ_์ถ๊ฐ_๋ฒํผ_๋๋ ์๋) } ) {
70- Image ( . icon( . plus) )
71- . resizable ( )
72- . frame ( width: 36 , height: 36 )
73- . padding ( 12 )
74- . foregroundStyle ( . pokit( . icon( . inverseWh) ) )
75- . background {
76- RoundedRectangle ( cornerRadius: 9999 , style: . continuous)
77- . fill ( . pokit( . bg( . brand) ) )
78- }
79- . frame ( width: 60 , height: 60 )
80- }
81- . padding ( . trailing, 20 )
82- . padding ( . bottom, 39 )
67+ . overlay (
68+ if: store. isContentsNotEmpty,
69+ alignment: . bottomTrailing
70+ ) {
71+ Button ( action: { send ( . ๋งํฌ_์ถ๊ฐ_๋ฒํผ_๋๋ ์๋) } ) {
72+ Image ( . icon( . plus) )
73+ . resizable ( )
74+ . frame ( width: 36 , height: 36 )
75+ . padding ( 12 )
76+ . foregroundStyle ( . pokit( . icon( . inverseWh) ) )
77+ . background {
78+ RoundedRectangle ( cornerRadius: 9999 , style: . continuous)
79+ . fill ( . pokit( . bg( . brand) ) )
80+ }
81+ . frame ( width: 60 , height: 60 )
8382 }
83+ . padding ( . trailing, 20 )
84+ . padding ( . bottom, 39 )
8485 }
8586 . ignoresSafeArea ( edges: . bottom)
8687 . sheet ( isPresented: $store. isCategorySheetPresented) {
@@ -213,14 +214,15 @@ private extension CategoryDetailView {
213214 @ViewBuilder
214215 var filterHeader : some View {
215216 let isFavoriteCategory = store. isFavoriteCategory
216- if !store. contents. isEmpty {
217+ let favoriteContentsCount = store. contents. filter { $0. content. isFavorite ?? false } . count
218+ if store. isContentsNotEmpty {
217219 HStack ( spacing: isFavoriteCategory ? 2 : 8 ) {
218220 if isFavoriteCategory {
219221 Image ( . icon( . link) )
220222 . resizable ( )
221223 . frame ( width: 16 , height: 16 )
222224 . foregroundStyle ( . pokit( . icon( . secondary) ) )
223- Text ( " \( store . contents . count ) ๊ฐ " )
225+ Text ( " \( favoriteContentsCount ) ๊ฐ " )
224226 . foregroundStyle ( . pokit( . text( . tertiary) ) )
225227 . pokitFont ( . b2( . m) )
226228 } else {
@@ -258,7 +260,7 @@ private extension CategoryDetailView {
258260 var contentScrollView : some View {
259261 Group {
260262 if !store. isLoading {
261- if store. contents . isEmpty {
263+ if ! store. isContentsNotEmpty {
262264 VStack {
263265 PokitCaution (
264266 type: . ํฌํท์์ธ_๋งํฌ์์,
@@ -275,12 +277,23 @@ private extension CategoryDetailView {
275277 let isFirst = store. state. id == self . store. contents. first? . id
276278 let isLast = store. state. id == self . store. contents. last? . id
277279
278- ContentCardView (
279- store: store,
280- type: . linkList,
281- isFirst: isFirst,
282- isLast: isLast
283- )
280+ if !self . store. isFavoriteCategory {
281+ ContentCardView (
282+ store: store,
283+ type: . linkList,
284+ isFirst: isFirst,
285+ isLast: isLast
286+ )
287+ } else {
288+ if store. content. isFavorite == true {
289+ ContentCardView (
290+ store: store,
291+ type: . linkList,
292+ isFirst: isFirst,
293+ isLast: isLast
294+ )
295+ }
296+ }
284297 }
285298
286299 if store. hasNext {
0 commit comments