@@ -34,71 +34,79 @@ struct ExplorePage: BaseHomePageView {
3434 var body : some View {
3535 List {
3636 // Today Hot Section
37- Section {
38- ForEach ( state. exploreInfo. dailyHotInfo) { item in
39- ZStack {
40- NavigationLink ( destination: FeedDetailPage ( initData: FeedInfo . Item ( id: item. id) ) ) {
41- EmptyView ( )
37+ if !state. exploreInfo. dailyHotInfo. isEmpty {
38+ Section {
39+ ForEach ( state. exploreInfo. dailyHotInfo) { item in
40+ ZStack {
41+ NavigationLink ( destination: FeedDetailPage ( initData: FeedInfo . Item ( id: item. id) ) ) {
42+ EmptyView ( )
43+ }
44+ . opacity ( 0 )
45+
46+ HStack ( spacing: 12 ) {
47+ AvatarView ( url: item. avatar, size: 30 )
48+ Text ( item. title)
49+ . foregroundColor ( Color . primaryText)
50+ . lineLimit ( 2 )
51+ . greedyWidth ( . leading)
52+ }
53+ . padding ( . vertical, 4 )
4254 }
43- . opacity ( 0 )
44-
45- HStack ( spacing: 12 ) {
46- AvatarView ( url: item. avatar, size: 30 )
47- Text ( item. title)
48- . foregroundColor ( Color . primaryText)
49- . lineLimit ( 2 )
50- . greedyWidth ( . leading)
51- }
52- . padding ( . vertical, 4 )
55+ . listRowInsets ( EdgeInsets ( top: 0 , leading: 10 , bottom: 0 , trailing: 10 ) )
56+ . listRowBackground ( Color . itemBg)
5357 }
54- . listRowInsets ( EdgeInsets ( top: 0 , leading: 10 , bottom: 0 , trailing: 10 ) )
55- . listRowBackground ( Color . itemBg)
58+ } header: {
59+ SectionTitleView ( " 今日热议 " )
60+ . listRowInsets ( EdgeInsets ( ) )
61+ . listRowBackground ( Color . itemBg)
5662 }
57- } header: {
58- SectionTitleView ( " 今日热议 " )
59- . listRowInsets ( EdgeInsets ( ) )
60- . listRowBackground ( Color . itemBg)
63+ . listRowSeparator ( . hidden)
6164 }
62- . listRowSeparator ( . hidden)
6365
6466 // Hot Nodes Section
65- Section {
66- FlowStack ( data: state. exploreInfo. hottestNodeInfo) { node in
67- NodeView ( id: node. id, name: node. name)
68- }
69- . listRowInsets ( EdgeInsets ( top: 0 , leading: 10 , bottom: 0 , trailing: 10 ) )
70- . listRowBackground ( Color . itemBg)
71- } header: {
72- SectionTitleView ( " 最热节点 " )
67+ if !state. exploreInfo. hottestNodeInfo. isEmpty {
68+ Section {
69+ FlowStack ( data: state. exploreInfo. hottestNodeInfo) { node in
70+ NodeView ( id: node. id, name: node. name)
71+ }
72+ . listRowInsets ( EdgeInsets ( top: 0 , leading: 10 , bottom: 0 , trailing: 10 ) )
7373 . listRowBackground ( Color . itemBg)
74+ } header: {
75+ SectionTitleView ( " 最热节点 " )
76+ . listRowBackground ( Color . itemBg)
77+ }
78+ . listRowSeparator ( . hidden)
7479 }
75- . listRowSeparator ( . hidden)
7680
7781 // New Nodes Section
78- Section {
79- FlowStack ( data: state. exploreInfo. recentNodeInfo) { node in
80- NodeView ( id: node. id, name: node. name)
81- }
82- . listRowInsets ( EdgeInsets ( top: 0 , leading: 10 , bottom: 0 , trailing: 10 ) )
83- . listRowBackground ( Color . itemBg)
84- } header: {
85- SectionTitleView ( " 新增节点 " )
82+ if !state. exploreInfo. recentNodeInfo. isEmpty {
83+ Section {
84+ FlowStack ( data: state. exploreInfo. recentNodeInfo) { node in
85+ NodeView ( id: node. id, name: node. name)
86+ }
87+ . listRowInsets ( EdgeInsets ( top: 0 , leading: 10 , bottom: 0 , trailing: 10 ) )
8688 . listRowBackground ( Color . itemBg)
89+ } header: {
90+ SectionTitleView ( " 新增节点 " )
91+ . listRowBackground ( Color . itemBg)
92+ }
93+ . listRowSeparator ( . hidden)
8794 }
88- . listRowSeparator ( . hidden)
8995
9096 // Node Navigation Section
91- Section {
92- ForEach ( state. exploreInfo. nodeNavInfo) { navItem in
93- NodeNavItemView ( data: navItem)
94- . listRowInsets ( EdgeInsets ( top: 0 , leading: 10 , bottom: 0 , trailing: 10 ) )
97+ if !state. exploreInfo. nodeNavInfo. isEmpty {
98+ Section {
99+ ForEach ( state. exploreInfo. nodeNavInfo) { navItem in
100+ NodeNavItemView ( data: navItem)
101+ . listRowInsets ( EdgeInsets ( top: 0 , leading: 10 , bottom: 0 , trailing: 10 ) )
102+ . listRowBackground ( Color . itemBg)
103+ }
104+ } header: {
105+ SectionTitleView ( " 节点导航 " )
95106 . listRowBackground ( Color . itemBg)
96107 }
97- } header: {
98- SectionTitleView ( " 节点导航 " )
99- . listRowBackground ( Color . itemBg)
108+ . listRowSeparator ( . hidden)
100109 }
101- . listRowSeparator ( . hidden)
102110 }
103111 . listStyle ( . plain)
104112 . scrollContentBackground ( . hidden)
0 commit comments