2024-01-06 09:52:04 +00:00
|
|
|
import DesignSystem
|
|
|
|
import EmojiText
|
|
|
|
import Foundation
|
|
|
|
import Models
|
|
|
|
import SwiftData
|
2024-02-14 11:48:14 +00:00
|
|
|
import SwiftUI
|
2024-01-06 09:52:04 +00:00
|
|
|
|
2024-02-14 11:48:14 +00:00
|
|
|
extension StatusEditor.AutoCompleteView {
|
2024-01-06 09:52:04 +00:00
|
|
|
struct MentionsView: View {
|
|
|
|
@Environment(Theme.self) private var theme
|
2024-02-14 11:48:14 +00:00
|
|
|
|
2024-01-06 17:43:26 +00:00
|
|
|
var viewModel: StatusEditor.ViewModel
|
2024-02-14 11:48:14 +00:00
|
|
|
|
2024-01-06 09:52:04 +00:00
|
|
|
var body: some View {
|
|
|
|
ForEach(viewModel.mentionsSuggestions) { account in
|
|
|
|
Button {
|
|
|
|
viewModel.selectMentionSuggestion(account: account)
|
|
|
|
} label: {
|
|
|
|
HStack {
|
|
|
|
AvatarView(account.avatar, config: AvatarView.FrameConfig.badge)
|
|
|
|
VStack(alignment: .leading) {
|
|
|
|
EmojiTextApp(.init(stringValue: account.safeDisplayName),
|
|
|
|
emojis: account.emojis)
|
2024-02-05 07:55:24 +00:00
|
|
|
.emojiText.size(Font.scaledFootnoteFont.emojiSize)
|
|
|
|
.emojiText.baselineOffset(Font.scaledFootnoteFont.emojiBaselineOffset)
|
2024-01-06 09:52:04 +00:00
|
|
|
.font(.scaledFootnote)
|
|
|
|
.fontWeight(.bold)
|
|
|
|
.foregroundColor(theme.labelColor)
|
|
|
|
Text("@\(account.acct)")
|
|
|
|
.font(.scaledFootnote)
|
|
|
|
.foregroundStyle(theme.tintColor)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|