@@ -24,14 +24,26 @@ class FullPostController: UITableViewController {
2424
2525 func setUpNavigationBar(){
2626 navigationController?.navigationBar.prefersLargeTitles = false
27− navigationItem.title = "\(String(describing: post?.fromUser.login))"
27+ navigationItem.title = "\(post?.fromUser.login ?? "")"
2828 navigationItem.rightBarButtonItems = [UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(self.options))]
2929 }
3030
3131 @objc func options(){
32− // copy link
33− // share
34− //
32+ // drafts
33+ // saved
34+
35+ let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
36+ let editAction = UIAlertAction(title: "Send via message", style: .default)
37+ let shareAction = UIAlertAction(title: "Send via project", style: .default)
38+ let settingsAction = UIAlertAction(title: "Copy link", style: .default)
39+ let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
40+
41+ optionMenu.addAction(editAction)
42+ optionMenu.addAction(shareAction)
43+ optionMenu.addAction(settingsAction)
44+ optionMenu.addAction(cancelAction)
45+
46+ self.present(optionMenu, animated: true, completion: nil)
3547 }
3648 // MARK: - Table view data source
3749
@@ -40,42 +52,52 @@ class FullPostController: UITableViewController {
4052 return 2
4153 }
4254
43− override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
44− let view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 50))
45− view.backgroundColor = .white
46− switch section {
47− case 0:
48− return view
49− default:
50− return nil
51− }
52− }
5355
54− override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView?
56+ override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
5557 {
56− let view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 50))
58+ let mainView = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 50))
59+
60+ let scrollView = UIScrollView()
61+
62+ scrollView.backgroundColor = .white
63+
64+ mainView.addSubview(scrollView)
65+ scrollView.edgesToSuperview()
5766
58− let label = UILabel()
59− label.font = UIFont.systemFont(ofSize: 14, weight: .regular)
60− label.text = post?.comments.count == 0 ? "Add first relpy" : "\(post?.comments.count ?? 0) replies"
61− label.textColor = #colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)
67+ scrollView.showsHorizontalScrollIndicator = false
6268
63− let button = UIButton(type: .detailDisclosure)
69+ var buttons: [UIButton] = []
70+ for hash in post!.hashtags {
71+ let button = UIButton()
72+ button.setTitle("#" + hash, for: .normal)
73+ button.backgroundColor = #colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)
74+ button.layer.cornerRadius = 10
75+ button.titleLabel?.font = UIFont.systemFont(ofSize: 14)
76+ button.setTitleColor(.black, for: .normal)
77+ buttons.append(button)
78+ }
79+
80+ let stackView = UIStackView(arrangedSubviews: buttons)
81+
82+ scrollView.addSubview(stackView)
6483
65− view.backgroundColor = .white
66− view.addSubview(button)
67− view.addSubview(label)
84+ stackView.axis = .horizontal
85+ stackView.alignment = .center
86+ stackView.spacing = 20
6887
69− label.edgesToSuperview(excluding: .right, insets: .left(16))
70− button.edgesToSuperview(excluding: .left, insets: .right(16))
88+ stackView.edgesToSuperview(insets: .left(20) + .top(10) + .right(20))
89+
90+ scrollView.contentSize = CGSize(width: 500, height: 50)
7191
7292 switch section {
7393 case 0:
74− return view
94+ return mainView
7595 default:
7696 return nil
7797 }
7898 }
99+
100+
79101 override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
80102 switch section {
81103 case 0:
@@ -85,14 +107,6 @@ class FullPostController: UITableViewController {
85107 }
86108 }
87109
88− override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
89− switch section {
90− case 0:
91− return 50
92− default:
93− return 0
94− }
95− }
96110 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
97111 {
98112 switch section {