profile fix
This commit is contained in:
		
							parent
							
								
									2e821a0075
								
							
						
					
					
						commit
						ff155b23e5
					
				@ -6,9 +6,9 @@ struct ProfileContentGrid: View {
 | 
			
		||||
    let selectedTabIndex: Int
 | 
			
		||||
    let searchQuery: String
 | 
			
		||||
    let selectedCategory: String
 | 
			
		||||
    @State private var allPosts: [Post] = []
 | 
			
		||||
    let allPosts: [Post]
 | 
			
		||||
    let isLoading: Bool
 | 
			
		||||
    @State private var selectedPostID: PostIDWrapper? = nil
 | 
			
		||||
    @State private var isLoading = true
 | 
			
		||||
 | 
			
		||||
    var body: some View {
 | 
			
		||||
        VStack(alignment: .leading, spacing: 0) {
 | 
			
		||||
@ -87,17 +87,6 @@ struct ProfileContentGrid: View {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        .frame(maxWidth: .infinity, alignment: .topLeading)
 | 
			
		||||
        .onAppear {
 | 
			
		||||
//            guard isContentLoaded else { return }
 | 
			
		||||
 | 
			
		||||
            if allPosts.isEmpty {
 | 
			
		||||
                isLoading = true
 | 
			
		||||
                PostService.shared.fetchAllPosts { result in
 | 
			
		||||
                    self.allPosts = result
 | 
			
		||||
                    self.isLoading = false
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        .fullScreenCover(item: $selectedPostID) { wrapper in
 | 
			
		||||
            PostDetailView(postID: wrapper.id)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -6,6 +6,8 @@ struct ProfileContentTabbedGrid: View {
 | 
			
		||||
    @State private var selectedCategory = "#все"
 | 
			
		||||
    @State private var searchQuery = ""
 | 
			
		||||
    @State private var selectedSort = "По дате"
 | 
			
		||||
    @State private var allPosts: [Post] = []
 | 
			
		||||
    @State private var isLoading = true
 | 
			
		||||
 | 
			
		||||
    var body: some View {
 | 
			
		||||
        VStack(spacing: 0) {
 | 
			
		||||
@ -68,14 +70,24 @@ struct ProfileContentTabbedGrid: View {
 | 
			
		||||
                        isContentLoaded: isContentLoaded,
 | 
			
		||||
                        selectedTabIndex: index,
 | 
			
		||||
                        searchQuery: searchQuery,
 | 
			
		||||
                        selectedCategory: selectedCategory
 | 
			
		||||
                        selectedCategory: selectedCategory,
 | 
			
		||||
                        allPosts: allPosts,
 | 
			
		||||
                        isLoading: isLoading
 | 
			
		||||
                    )
 | 
			
		||||
//                    .frame(maxWidth: .infinity, minHeight: 10)
 | 
			
		||||
                    .tag(index)
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
 | 
			
		||||
        }
 | 
			
		||||
        .onAppear {
 | 
			
		||||
            if allPosts.isEmpty {
 | 
			
		||||
                isLoading = true
 | 
			
		||||
                PostService.shared.fetchAllPosts { result in
 | 
			
		||||
                    self.allPosts = result
 | 
			
		||||
                    self.isLoading = false
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // MARK: - Вкладка с меню
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user