@@ -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 {
@@ -300,12 +302,23 @@ private extension CategoryDetailView {
300302 let isFirst = store. state. id == self . store. contents. first? . id
301303 let isLast = store. state. id == self . store. contents. last? . id
302304
303- ContentCardView (
304- store: store,
305- type: . linkList,
306- isFirst: isFirst,
307- isLast: isLast
308- )
305+ if !self . store. isFavoriteCategory {
306+ ContentCardView (
307+ store: store,
308+ type: . linkList,
309+ isFirst: isFirst,
310+ isLast: isLast
311+ )
312+ } else {
313+ if store. content. isFavorite == true {
314+ ContentCardView (
315+ store: store,
316+ type: . linkList,
317+ isFirst: isFirst,
318+ isLast: isLast
319+ )
320+ }
321+ }
309322 }
310323
311324 if store. hasNext {
0 commit comments