@@ -13,12 +13,14 @@ import TinyConstraints
1313
1414class PostViewCell: UITableViewCell
1515{
16− let nameLabel: UILabel = {
17− let label = UILabel()
18− label.textColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
19− label.text = "vbogomazova"
20− label.font = UIFont.boldSystemFont(ofSize: 16)
21− return label
16+ var onUserDisplay: ((Int)->())?
17+
18+ let nameLabel: UIButton = {
19+ let button = UIButton()
20+ button.setTitleColor(.black, for: .normal)
21+ button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 16)
22+ button.contentHorizontalAlignment = UIControl.ContentHorizontalAlignment.left
23+ return button
2224 }()
2325
2426 let fullNameLabel: UILabel = {
@@ -56,19 +58,19 @@ class PostViewCell: UITableViewCell
5658 let markdownParser = MarkdownParser(font: UIFont.systemFont(ofSize: 16))
5759 let markdown = text
5860 markdownParser.enabledElements = .disabledAutomaticLink
59− markdownParser.header.fontIncrease = 6
61+ markdownParser.header.fontIncrease = 16
6062 markdownParser.code.textBackgroundColor = #colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)
6163
6264 let textView = UITextView()
6365 textView.isScrollEnabled = false
6466 textView.isEditable = false
65− textView.isUserInteractionEnabled = false
67+ //textView.isUserInteractionEnabled = false
68+ textView.isSelectable = true
6669 textView.attributedText = markdownParser.parse(markdown)
6770 return textView
6871 }
6972
7073 var views: [UIView] = []
71− var data : [UIImage] = []
7274 var post: Model.Posts?
7375
7476 func fill(with info: [Model.Attachments], _ isFullVersoin: Bool, post: Model.Posts)
@@ -77,14 +79,14 @@ class PostViewCell: UITableViewCell
7779 // important
7880 contentView.subviews.forEach({ $0.removeFromSuperview() })
7981
80− data = []
8182 views = []
8283 for attachment in info
8384 {
8485 views.append(createTextView(with: attachment.markdown))
8586 }
8687
87− nameLabel.text = "\(post.user?.firstName ?? "") \(post.user?.secondName ?? "")"
88+ nameLabel.setTitle("\(post.user?.firstName ?? "") \(post.user?.secondName ?? "")", for: .normal)
89+ nameLabel.addTarget(self, action: #selector(displayProfile), for: .touchUpInside)
8890 fullNameLabel.text = "\(post.authorId)"
8991 setUpInStackView(isFullVersoin)
9092 }
@@ -162,4 +164,9 @@ class PostViewCell: UITableViewCell
162164 commentsSharesStackView.edgesToSuperview(excluding: .top, insets: .bottom(10) + .left(16) + .right(16))
163165 stackView.bottomToTop(of: commentsSharesStackView)
164166 }
167+
168+ @objc func displayProfile(){
169+ print("buttonTapped")
170+ onUserDisplay?(post!.authorId)
171+ }
165172}