Render descriptions with shared Markdown preview
Use one Markdown presentation for free-form content. - issue and pull-request descriptions and comments - milestone and commit descriptions
This commit is contained in:
@@ -733,7 +733,8 @@ final class MilestoneViewController: RefreshingTableViewController {
|
||||
final class MilestoneCell: UITableViewCell {
|
||||
private let stateIcon = UIImageView()
|
||||
private let titleLabel = UILabel()
|
||||
private let descriptionLabel = UILabel()
|
||||
private let stack = UIStackView()
|
||||
private var descriptionView: UIView?
|
||||
private let metaLabel = UILabel()
|
||||
private let progress = UIProgressView(progressViewStyle: .bar)
|
||||
|
||||
@@ -744,16 +745,13 @@ final class MilestoneCell: UITableViewCell {
|
||||
let titleStack = UIStackView(arrangedSubviews: [stateIcon, titleLabel])
|
||||
titleStack.alignment = .firstBaseline
|
||||
titleStack.spacing = 8
|
||||
descriptionLabel.font = .preferredFont(forTextStyle: .subheadline)
|
||||
descriptionLabel.textColor = .secondaryLabel
|
||||
descriptionLabel.numberOfLines = 2
|
||||
metaLabel.font = .preferredFont(forTextStyle: .caption1)
|
||||
metaLabel.textColor = .tertiaryLabel
|
||||
metaLabel.numberOfLines = 2
|
||||
progress.progressTintColor = .systemGreen
|
||||
let stack = UIStackView(
|
||||
arrangedSubviews: [titleStack, descriptionLabel, progress, metaLabel]
|
||||
)
|
||||
stack.addArrangedSubview(titleStack)
|
||||
stack.addArrangedSubview(progress)
|
||||
stack.addArrangedSubview(metaLabel)
|
||||
stack.axis = .vertical
|
||||
stack.spacing = 7
|
||||
stack.translatesAutoresizingMaskIntoConstraints = false
|
||||
@@ -778,7 +776,12 @@ final class MilestoneCell: UITableViewCell {
|
||||
textStyle: .headline
|
||||
)
|
||||
titleLabel.text = row.title
|
||||
descriptionLabel.text = row.description
|
||||
descriptionView?.removeFromSuperview()
|
||||
if !row.description.isEmpty {
|
||||
let view = markdownView(row.description)
|
||||
stack.insertArrangedSubview(view, at: 1)
|
||||
descriptionView = view
|
||||
}
|
||||
metaLabel.text = row.meta
|
||||
progress.progress = Float(row.progress)
|
||||
progress.trackTintColor = row.hasIssues ? .systemOrange : .systemGray5
|
||||
|
||||
Reference in New Issue
Block a user