Compare commits

...

1 Commits
main ... FAB

Author SHA1 Message Date
cheykrym
9ad744f3f1 FAB add post 2025-07-24 23:15:51 +03:00
2 changed files with 49 additions and 41 deletions

View File

@ -43,15 +43,7 @@ struct ProfileContentTabbedGrid: View {
.cornerRadius(8) .cornerRadius(8)
.font(.subheadline) .font(.subheadline)
Button {
// Создать пост
} label: {
Label("Создать", systemImage: "plus")
.font(.subheadline)
.padding(8)
.background(Color.blue.opacity(0.2))
.cornerRadius(8)
}
} else { } else {
TextField("Поиск", text: $searchQuery) TextField("Поиск", text: $searchQuery)
.padding(.horizontal, 10) .padding(.horizontal, 10)

View File

@ -30,41 +30,57 @@ struct ProfileTab: View {
if !isContentLoaded { if !isContentLoaded {
SplashScreenView() SplashScreenView()
} else { } else {
VStack(spacing: 0) { ZStack(alignment: .bottomTrailing) {
// Скрытые NavigationLink для программного перехода VStack(spacing: 0) {
NavigationLink(destination: FollowersView(followers: followers), isActive: $isShowingFollowers) { EmptyView() } // Скрытые NavigationLink для программного перехода
NavigationLink(destination: FollowingView(following: following), isActive: $isShowingFollowing) { EmptyView() } NavigationLink(destination: FollowersView(followers: followers), isActive: $isShowingFollowers) { EmptyView() }
NavigationLink(destination: FollowingView(following: following), isActive: $isShowingFollowing) { EmptyView() }
if let (post, posts) = selectedPostData { if let (post, posts) = selectedPostData {
NavigationLink( NavigationLink(
destination: PostFeedView(posts: posts, selectedPostID: post.id), destination: PostFeedView(posts: posts, selectedPostID: post.id),
isActive: Binding( isActive: Binding(
get: { selectedPostData != nil }, get: { selectedPostData != nil },
set: { if !$0 { selectedPostData = nil } } set: { if !$0 { selectedPostData = nil } }
), ),
label: { EmptyView() } label: { EmptyView() }
)
}
RefreshableScrollView(isRefreshing: $isRefreshing, onRefresh: {
fetchData()
}) {
VStack(spacing: 12) {
header
// .frame(minHeight: 300)
.frame(maxWidth: .infinity)
.background(Color(.systemBackground))
ProfileContentTabbedGrid(
isContentLoaded: isContentLoaded,
allPosts: $allPosts,
isLoading: $isLoading,
onPostTapped: { post, posts in
self.selectedPostData = (post, posts)
}
) )
} }
RefreshableScrollView(isRefreshing: $isRefreshing, onRefresh: {
fetchData()
}) {
VStack(spacing: 12) {
header
// .frame(minHeight: 300)
.frame(maxWidth: .infinity)
.background(Color(.systemBackground))
ProfileContentTabbedGrid(
isContentLoaded: isContentLoaded,
allPosts: $allPosts,
isLoading: $isLoading,
onPostTapped: { post, posts in
self.selectedPostData = (post, posts)
}
)
}
}
} }
// FAB
Button(action: {
// TODO: Действие для создания поста
}) {
Image(systemName: "plus")
.font(.system(size: 24, weight: .bold))
.foregroundColor(.white)
.padding()
.background(Color.blue)
.clipShape(Circle())
.shadow(radius: 5)
}
.padding()
} }
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar { .toolbar {