2023-01-17 10:36:01 +00:00
|
|
|
import Account
|
2022-12-23 09:41:55 +00:00
|
|
|
import DesignSystem
|
2023-01-17 10:36:01 +00:00
|
|
|
import Env
|
2022-12-23 09:41:55 +00:00
|
|
|
import Models
|
2023-01-17 10:36:01 +00:00
|
|
|
import Network
|
2024-01-06 18:27:26 +00:00
|
|
|
import StatusKit
|
2023-01-17 10:36:01 +00:00
|
|
|
import SwiftUI
|
2022-12-23 09:41:55 +00:00
|
|
|
|
2023-09-18 19:03:52 +00:00
|
|
|
@MainActor
|
2022-12-23 09:41:55 +00:00
|
|
|
public struct ExploreView: View {
|
2023-09-18 19:03:52 +00:00
|
|
|
@Environment(Theme.self) private var theme
|
2023-09-18 05:01:23 +00:00
|
|
|
@Environment(Client.self) private var client
|
|
|
|
@Environment(RouterPath.self) private var routerPath
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2023-09-18 05:01:23 +00:00
|
|
|
@State private var viewModel = ExploreViewModel()
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2023-10-05 06:22:45 +00:00
|
|
|
@Binding var scrollToTopSignal: Int
|
|
|
|
|
|
|
|
public init(scrollToTopSignal: Binding<Int>) {
|
|
|
|
_scrollToTopSignal = scrollToTopSignal
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-23 09:41:55 +00:00
|
|
|
public var body: some View {
|
2023-10-05 06:22:45 +00:00
|
|
|
ScrollViewReader { proxy in
|
|
|
|
List {
|
|
|
|
scrollToTopView
|
|
|
|
.padding(.bottom, 4)
|
|
|
|
if !viewModel.isLoaded {
|
|
|
|
quickAccessView
|
|
|
|
.padding(.bottom, 5)
|
|
|
|
loadingView
|
|
|
|
} else if !viewModel.searchQuery.isEmpty {
|
|
|
|
if let results = viewModel.results[viewModel.searchQuery] {
|
|
|
|
if results.isEmpty, !viewModel.isSearching {
|
|
|
|
EmptyView(iconName: "magnifyingglass",
|
|
|
|
title: "explore.search.empty.title",
|
|
|
|
message: "explore.search.empty.message")
|
|
|
|
.listRowBackground(theme.secondaryBackgroundColor)
|
|
|
|
.listRowSeparator(.hidden)
|
|
|
|
} else {
|
|
|
|
makeSearchResultsView(results: results)
|
|
|
|
}
|
2023-01-28 07:29:49 +00:00
|
|
|
} else {
|
2023-10-05 06:22:45 +00:00
|
|
|
HStack {
|
|
|
|
Spacer()
|
|
|
|
ProgressView()
|
|
|
|
Spacer()
|
|
|
|
}
|
2023-12-19 08:51:20 +00:00
|
|
|
#if !os(visionOS)
|
2023-10-05 06:22:45 +00:00
|
|
|
.listRowBackground(theme.secondaryBackgroundColor)
|
2023-12-19 08:51:20 +00:00
|
|
|
#endif
|
2023-10-05 06:22:45 +00:00
|
|
|
.listRowSeparator(.hidden)
|
|
|
|
.id(UUID())
|
2023-01-28 07:29:49 +00:00
|
|
|
}
|
2023-10-05 06:22:45 +00:00
|
|
|
} else if viewModel.allSectionsEmpty {
|
|
|
|
EmptyView(iconName: "magnifyingglass",
|
|
|
|
title: "explore.search.title",
|
|
|
|
message: "explore.search.message-\(client.server)")
|
2024-02-14 11:48:14 +00:00
|
|
|
#if !os(visionOS)
|
2023-10-05 06:22:45 +00:00
|
|
|
.listRowBackground(theme.secondaryBackgroundColor)
|
2024-02-14 11:48:14 +00:00
|
|
|
#endif
|
2023-10-05 06:22:45 +00:00
|
|
|
.listRowSeparator(.hidden)
|
2023-07-18 06:04:18 +00:00
|
|
|
} else {
|
2023-10-05 06:22:45 +00:00
|
|
|
quickAccessView
|
|
|
|
.padding(.bottom, 4)
|
|
|
|
|
|
|
|
if !viewModel.trendingTags.isEmpty {
|
|
|
|
trendingTagsSection
|
|
|
|
}
|
|
|
|
if !viewModel.suggestedAccounts.isEmpty {
|
|
|
|
suggestedAccountsSection
|
|
|
|
}
|
|
|
|
if !viewModel.trendingStatuses.isEmpty {
|
|
|
|
trendingPostsSection
|
|
|
|
}
|
|
|
|
if !viewModel.trendingLinks.isEmpty {
|
|
|
|
trendingLinksSection
|
2023-07-18 06:04:18 +00:00
|
|
|
}
|
2023-01-12 05:30:43 +00:00
|
|
|
}
|
2023-10-05 06:22:45 +00:00
|
|
|
}
|
|
|
|
.environment(\.defaultMinListRowHeight, .scrollToViewHeight)
|
|
|
|
.task {
|
|
|
|
viewModel.client = client
|
|
|
|
await viewModel.fetchTrending()
|
|
|
|
}
|
|
|
|
.refreshable {
|
|
|
|
Task {
|
2023-11-07 10:22:36 +00:00
|
|
|
SoundEffectManager.shared.playSound(.pull)
|
|
|
|
HapticManager.shared.fireHaptic(.dataRefresh(intensity: 0.3))
|
2023-10-05 06:22:45 +00:00
|
|
|
await viewModel.fetchTrending()
|
2023-11-07 10:22:36 +00:00
|
|
|
HapticManager.shared.fireHaptic(.dataRefresh(intensity: 0.7))
|
|
|
|
SoundEffectManager.shared.playSound(.refresh)
|
2023-01-12 05:30:43 +00:00
|
|
|
}
|
2023-10-05 06:22:45 +00:00
|
|
|
}
|
2023-11-14 18:48:14 +00:00
|
|
|
.listStyle(.plain)
|
2023-12-19 08:51:20 +00:00
|
|
|
#if !os(visionOS)
|
2024-02-14 11:48:14 +00:00
|
|
|
.scrollContentBackground(.hidden)
|
|
|
|
.background(theme.secondaryBackgroundColor)
|
2023-12-19 08:51:20 +00:00
|
|
|
#endif
|
2024-02-14 11:48:14 +00:00
|
|
|
.navigationTitle("explore.navigation-title")
|
|
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
|
|
.searchable(text: $viewModel.searchQuery,
|
|
|
|
isPresented: $viewModel.isSearchPresented,
|
|
|
|
placement: .navigationBarDrawer(displayMode: .always),
|
|
|
|
prompt: Text("explore.search.prompt"))
|
|
|
|
.searchScopes($viewModel.searchScope) {
|
|
|
|
ForEach(ExploreViewModel.SearchScope.allCases, id: \.self) { scope in
|
|
|
|
Text(scope.localizedString)
|
|
|
|
}
|
2023-01-12 05:30:43 +00:00
|
|
|
}
|
2024-02-14 11:48:14 +00:00
|
|
|
.task(id: viewModel.searchQuery) {
|
|
|
|
await viewModel.search()
|
|
|
|
}
|
|
|
|
.onChange(of: scrollToTopSignal) {
|
|
|
|
if viewModel.scrollToTopVisible {
|
|
|
|
viewModel.isSearchPresented.toggle()
|
|
|
|
} else {
|
|
|
|
withAnimation {
|
|
|
|
proxy.scrollTo(ScrollToView.Constants.scrollToTop, anchor: .top)
|
|
|
|
}
|
2023-10-05 06:22:45 +00:00
|
|
|
}
|
|
|
|
}
|
2023-07-18 06:52:10 +00:00
|
|
|
}
|
2022-12-23 14:28:22 +00:00
|
|
|
}
|
2023-07-19 05:46:25 +00:00
|
|
|
|
2023-07-18 06:39:52 +00:00
|
|
|
private var quickAccessView: some View {
|
|
|
|
ScrollView(.horizontal) {
|
|
|
|
HStack {
|
2024-02-10 10:26:22 +00:00
|
|
|
Button("explore.section.trending.links") {
|
|
|
|
routerPath.navigate(to: RouterDestination.trendingLinks(cards: viewModel.trendingLinks))
|
|
|
|
}
|
|
|
|
.buttonStyle(.bordered)
|
|
|
|
Button("explore.section.trending.posts") {
|
|
|
|
routerPath.navigate(to: RouterDestination.trendingTimeline)
|
2023-07-18 06:39:52 +00:00
|
|
|
}
|
|
|
|
.buttonStyle(.bordered)
|
|
|
|
Button("explore.section.suggested-users") {
|
|
|
|
routerPath.navigate(to: RouterDestination.accountsList(accounts: viewModel.suggestedAccounts))
|
|
|
|
}
|
|
|
|
.buttonStyle(.bordered)
|
2024-02-10 10:26:22 +00:00
|
|
|
Button("explore.section.trending.tags") {
|
|
|
|
routerPath.navigate(to: RouterDestination.tagsList(tags: viewModel.trendingTags))
|
2023-07-18 06:39:52 +00:00
|
|
|
}
|
|
|
|
.buttonStyle(.bordered)
|
|
|
|
}
|
|
|
|
.padding(.horizontal, 16)
|
|
|
|
}
|
|
|
|
.scrollIndicators(.never)
|
|
|
|
.listRowInsets(EdgeInsets())
|
2023-12-19 08:51:20 +00:00
|
|
|
#if !os(visionOS)
|
2024-02-14 11:48:14 +00:00
|
|
|
.listRowBackground(theme.secondaryBackgroundColor)
|
2023-12-19 08:51:20 +00:00
|
|
|
#endif
|
2024-02-14 11:48:14 +00:00
|
|
|
.listRowSeparator(.hidden)
|
2023-07-18 06:39:52 +00:00
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-27 09:04:39 +00:00
|
|
|
private var loadingView: some View {
|
|
|
|
ForEach(Status.placeholders()) { status in
|
2023-09-18 05:01:23 +00:00
|
|
|
StatusRowView(viewModel: .init(status: status, client: client, routerPath: routerPath))
|
2022-12-27 09:04:39 +00:00
|
|
|
.padding(.vertical, 8)
|
|
|
|
.redacted(reason: .placeholder)
|
2023-09-18 16:55:11 +00:00
|
|
|
.allowsHitTesting(false)
|
2024-02-14 11:48:14 +00:00
|
|
|
#if !os(visionOS)
|
2022-12-29 09:39:34 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-14 11:48:14 +00:00
|
|
|
#endif
|
2022-12-27 09:04:39 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-27 09:04:39 +00:00
|
|
|
@ViewBuilder
|
|
|
|
private func makeSearchResultsView(results: SearchResults) -> some View {
|
2023-09-16 12:15:03 +00:00
|
|
|
if !results.accounts.isEmpty, viewModel.searchScope == .all || viewModel.searchScope == .people {
|
2023-01-19 17:14:08 +00:00
|
|
|
Section("explore.section.users") {
|
2022-12-27 09:04:39 +00:00
|
|
|
ForEach(results.accounts) { account in
|
|
|
|
if let relationship = results.relationships.first(where: { $0.id == account.id }) {
|
|
|
|
AccountsListRow(viewModel: .init(account: account, relationShip: relationship))
|
2024-02-14 11:48:14 +00:00
|
|
|
#if !os(visionOS)
|
2022-12-29 09:39:34 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-14 11:48:14 +00:00
|
|
|
#else
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2024-02-14 11:48:14 +00:00
|
|
|
#endif
|
2022-12-27 09:04:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-09-16 12:15:03 +00:00
|
|
|
if !results.hashtags.isEmpty, viewModel.searchScope == .all || viewModel.searchScope == .hashtags {
|
2023-01-19 17:14:08 +00:00
|
|
|
Section("explore.section.tags") {
|
2022-12-27 09:04:39 +00:00
|
|
|
ForEach(results.hashtags) { tag in
|
|
|
|
TagRowView(tag: tag)
|
2024-02-14 11:48:14 +00:00
|
|
|
#if !os(visionOS)
|
2022-12-29 09:39:34 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-14 11:48:14 +00:00
|
|
|
#else
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2024-02-14 11:48:14 +00:00
|
|
|
#endif
|
2022-12-27 09:04:39 +00:00
|
|
|
.padding(.vertical, 4)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-09-16 12:15:03 +00:00
|
|
|
if !results.statuses.isEmpty, viewModel.searchScope == .all || viewModel.searchScope == .posts {
|
2023-01-19 17:14:08 +00:00
|
|
|
Section("explore.section.posts") {
|
2022-12-27 09:04:39 +00:00
|
|
|
ForEach(results.statuses) { status in
|
2023-09-18 05:01:23 +00:00
|
|
|
StatusRowView(viewModel: .init(status: status, client: client, routerPath: routerPath))
|
2024-02-14 11:48:14 +00:00
|
|
|
#if !os(visionOS)
|
2022-12-29 09:39:34 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-14 11:48:14 +00:00
|
|
|
#else
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2024-02-14 11:48:14 +00:00
|
|
|
#endif
|
2022-12-27 09:04:39 +00:00
|
|
|
.padding(.vertical, 8)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-23 14:28:22 +00:00
|
|
|
private var suggestedAccountsSection: some View {
|
2023-01-19 17:14:08 +00:00
|
|
|
Section("explore.section.suggested-users") {
|
2022-12-23 14:28:22 +00:00
|
|
|
ForEach(viewModel.suggestedAccounts
|
2023-03-13 12:38:28 +00:00
|
|
|
.prefix(upTo: viewModel.suggestedAccounts.count > 3 ? 3 : viewModel.suggestedAccounts.count))
|
|
|
|
{ account in
|
|
|
|
if let relationship = viewModel.suggestedAccountsRelationShips.first(where: { $0.id == account.id }) {
|
|
|
|
AccountsListRow(viewModel: .init(account: account, relationShip: relationship))
|
2024-02-14 11:48:14 +00:00
|
|
|
#if !os(visionOS)
|
2023-03-13 12:38:28 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-14 11:48:14 +00:00
|
|
|
#else
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2024-02-14 11:48:14 +00:00
|
|
|
#endif
|
2022-12-23 14:28:22 +00:00
|
|
|
}
|
2023-03-13 12:38:28 +00:00
|
|
|
}
|
2023-03-02 19:15:07 +00:00
|
|
|
NavigationLink(value: RouterDestination.accountsList(accounts: viewModel.suggestedAccounts)) {
|
2023-01-19 17:14:08 +00:00
|
|
|
Text("see-more")
|
2022-12-24 14:09:17 +00:00
|
|
|
.foregroundColor(theme.tintColor)
|
2022-12-23 09:41:55 +00:00
|
|
|
}
|
2023-12-19 08:51:20 +00:00
|
|
|
#if !os(visionOS)
|
2022-12-29 09:39:34 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-06 14:17:20 +00:00
|
|
|
#else
|
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2023-12-19 08:51:20 +00:00
|
|
|
#endif
|
2022-12-23 14:28:22 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-23 14:28:22 +00:00
|
|
|
private var trendingTagsSection: some View {
|
2023-01-19 17:14:08 +00:00
|
|
|
Section("explore.section.trending.tags") {
|
2022-12-23 14:28:22 +00:00
|
|
|
ForEach(viewModel.trendingTags
|
2023-03-13 12:38:28 +00:00
|
|
|
.prefix(upTo: viewModel.trendingTags.count > 5 ? 5 : viewModel.trendingTags.count))
|
|
|
|
{ tag in
|
|
|
|
TagRowView(tag: tag)
|
2024-02-14 11:48:14 +00:00
|
|
|
#if !os(visionOS)
|
2023-03-13 12:38:28 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-14 11:48:14 +00:00
|
|
|
#else
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2024-02-14 11:48:14 +00:00
|
|
|
#endif
|
2023-03-13 12:38:28 +00:00
|
|
|
.padding(.vertical, 4)
|
|
|
|
}
|
2023-03-02 19:15:07 +00:00
|
|
|
NavigationLink(value: RouterDestination.tagsList(tags: viewModel.trendingTags)) {
|
2023-01-19 17:14:08 +00:00
|
|
|
Text("see-more")
|
2022-12-24 14:09:17 +00:00
|
|
|
.foregroundColor(theme.tintColor)
|
2022-12-23 14:28:22 +00:00
|
|
|
}
|
2023-12-19 08:51:20 +00:00
|
|
|
#if !os(visionOS)
|
2022-12-29 09:39:34 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-06 14:17:20 +00:00
|
|
|
#else
|
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2023-12-19 08:51:20 +00:00
|
|
|
#endif
|
2022-12-23 14:28:22 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-23 14:28:22 +00:00
|
|
|
private var trendingPostsSection: some View {
|
2023-01-19 17:14:08 +00:00
|
|
|
Section("explore.section.trending.posts") {
|
2022-12-23 14:28:22 +00:00
|
|
|
ForEach(viewModel.trendingStatuses
|
2023-03-13 12:38:28 +00:00
|
|
|
.prefix(upTo: viewModel.trendingStatuses.count > 3 ? 3 : viewModel.trendingStatuses.count))
|
|
|
|
{ status in
|
2023-09-18 05:01:23 +00:00
|
|
|
StatusRowView(viewModel: .init(status: status, client: client, routerPath: routerPath))
|
2024-02-14 11:48:14 +00:00
|
|
|
#if !os(visionOS)
|
2023-03-13 12:38:28 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-14 11:48:14 +00:00
|
|
|
#else
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2024-02-14 11:48:14 +00:00
|
|
|
#endif
|
2023-03-13 12:38:28 +00:00
|
|
|
.padding(.vertical, 8)
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2023-03-02 19:15:07 +00:00
|
|
|
NavigationLink(value: RouterDestination.trendingTimeline) {
|
2023-01-19 17:14:08 +00:00
|
|
|
Text("see-more")
|
2022-12-24 14:09:17 +00:00
|
|
|
.foregroundColor(theme.tintColor)
|
2022-12-23 09:41:55 +00:00
|
|
|
}
|
2023-12-19 08:51:20 +00:00
|
|
|
#if !os(visionOS)
|
2022-12-29 09:39:34 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-06 14:17:20 +00:00
|
|
|
#else
|
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2023-12-19 08:51:20 +00:00
|
|
|
#endif
|
2022-12-23 09:41:55 +00:00
|
|
|
}
|
2022-12-23 14:28:22 +00:00
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-23 14:28:22 +00:00
|
|
|
private var trendingLinksSection: some View {
|
2023-01-19 17:14:08 +00:00
|
|
|
Section("explore.section.trending.links") {
|
2022-12-23 14:28:22 +00:00
|
|
|
ForEach(viewModel.trendingLinks
|
2023-03-13 12:38:28 +00:00
|
|
|
.prefix(upTo: viewModel.trendingLinks.count > 3 ? 3 : viewModel.trendingLinks.count))
|
|
|
|
{ card in
|
|
|
|
StatusRowCardView(card: card)
|
2024-02-10 10:26:22 +00:00
|
|
|
.environment(\.isCompact, true)
|
2024-02-14 11:48:14 +00:00
|
|
|
#if !os(visionOS)
|
2023-03-13 12:38:28 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-14 11:48:14 +00:00
|
|
|
#else
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2024-02-14 11:48:14 +00:00
|
|
|
#endif
|
2023-03-13 12:38:28 +00:00
|
|
|
.padding(.vertical, 8)
|
|
|
|
}
|
2023-10-01 07:37:09 +00:00
|
|
|
|
2023-09-27 06:38:17 +00:00
|
|
|
NavigationLink(value: RouterDestination.trendingLinks(cards: viewModel.trendingLinks)) {
|
2023-01-19 17:14:08 +00:00
|
|
|
Text("see-more")
|
2022-12-24 14:09:17 +00:00
|
|
|
.foregroundColor(theme.tintColor)
|
2022-12-23 14:28:22 +00:00
|
|
|
}
|
2023-12-19 08:51:20 +00:00
|
|
|
#if !os(visionOS)
|
2022-12-29 09:39:34 +00:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2024-02-06 14:17:20 +00:00
|
|
|
#else
|
|
|
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
2024-02-14 11:48:14 +00:00
|
|
|
.foregroundStyle(.background).hoverEffect())
|
2024-02-06 14:17:20 +00:00
|
|
|
.listRowHoverEffectDisabled()
|
2023-12-19 08:51:20 +00:00
|
|
|
#endif
|
2022-12-23 09:41:55 +00:00
|
|
|
}
|
|
|
|
}
|
2023-10-05 06:22:45 +00:00
|
|
|
|
|
|
|
private var scrollToTopView: some View {
|
|
|
|
ScrollToView()
|
|
|
|
.frame(height: .scrollToViewHeight)
|
|
|
|
.onAppear {
|
|
|
|
viewModel.scrollToTopVisible = true
|
|
|
|
}
|
|
|
|
.onDisappear {
|
|
|
|
viewModel.scrollToTopVisible = false
|
|
|
|
}
|
|
|
|
}
|
2022-12-23 09:41:55 +00:00
|
|
|
}
|