IceCubesApp/Packages/StatusKit/Sources/StatusKit/Row/Subviews/StatusRowTagView.swift
Thomas Ricouard 1f858414d8 format .
2024-02-14 12:48:14 +01:00

29 lines
805 B
Swift

import DesignSystem
import Env
import SwiftUI
struct StatusRowTagView: View {
@Environment(CurrentAccount.self) private var currentAccount
@Environment(RouterPath.self) private var routerPath
@Environment(\.isHomeTimeline) private var isHomeTimeline
let viewModel: StatusRowViewModel
var body: some View {
if isHomeTimeline,
let tag = viewModel.finalStatus.content.links.first(where: { link in
link.type == .hashtag && currentAccount.tags.contains(where: { $0.name.lowercased() == link.title.lowercased() })
})
{
Text("#\(tag.title)")
.font(.scaledFootnote)
.foregroundStyle(.secondary)
.fontWeight(.semibold)
.onTapGesture {
routerPath.navigate(to: .hashTag(tag: tag.title, account: nil))
}
}
}
}