Skip to content

Commit

Permalink
Merge pull request #1692 from planetary-social/adjust-note-card-heade…
Browse files Browse the repository at this point in the history
…r-UI

Adjust note card header UI
  • Loading branch information
joshuatbrown authored Nov 27, 2024
2 parents 15ed6b9 + 7c292ef commit 0dfd5f3
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 175 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix typo in minimum age warning
- Fix crash when tapping Post button on macOS. [#1687](https://github.com/planetary-social/nos/issues/1687)
- Fix tapping follower notification not opening follower profile. [#11](https://github.com/verse-pbc/issues/issues/11)
- Adjusted note header UI to make it more readable. [#23](https://github.com/verse-pbc/issues/issues/23)

### Internal Changes
- minor strings simplifications
Expand Down
154 changes: 0 additions & 154 deletions Nos/Assets/Localization/Reply.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -225,160 +225,6 @@
}
}
},
"posted" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "hat gepostet"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "posted"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "publicado"
}
},
"fa" : {
"stringUnit" : {
"state" : "translated",
"value" : "ارسال شده"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "a publié"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "投稿しました"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "게시됨"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "geplaatst"
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
"value" : "postou"
}
},
"sv" : {
"stringUnit" : {
"state" : "translated",
"value" : "postade"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "已发布"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "已發佈"
}
}
}
},
"replied" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "hat geantwortet"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "replied"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "contestado"
}
},
"fa" : {
"stringUnit" : {
"state" : "translated",
"value" : "پاسخ داد"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "a répondu"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "返信しました"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "답글 남김"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "beantwoord"
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
"value" : "respondeu"
}
},
"sv" : {
"stringUnit" : {
"state" : "translated",
"value" : "svarade"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "已回复"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "已回覆"
}
}
}
},
"repliedToYourNote" : {
"extractionState" : "manual",
"localizations" : {
Expand Down
4 changes: 2 additions & 2 deletions Nos/Extensions/Date+Elapsed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension Date {
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .none
dateFormatter.dateFormat = DateFormatter.dateFormat(
fromTemplate: "MMMMd",
fromTemplate: "MMM d",
options: 0,
locale: calendar.locale
)
Expand Down Expand Up @@ -89,7 +89,7 @@ extension Date {
private func formatLongDate(_ calendar: Calendar) -> String {
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .none
dateFormatter.dateStyle = .long
dateFormatter.dateStyle = .medium
dateFormatter.calendar = calendar
dateFormatter.locale = calendar.locale
dateFormatter.timeZone = calendar.timeZone
Expand Down
7 changes: 0 additions & 7 deletions Nos/Views/Components/Author/AuthorLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ struct AuthorLabel: View {
var authorName = AttributedString(author.safeName)
authorName.foregroundColor = .primaryTxt
authorName.font = .clarity(.semibold)
if let note {
let postedOrRepliedString = String(localized: note.isReply ? "replied" : "posted", table: "Reply")
var postedOrReplied = AttributedString(" " + postedOrRepliedString)
postedOrReplied.foregroundColor = .secondaryTxt

authorName.append(postedOrReplied)
}
return authorName
}

Expand Down
3 changes: 3 additions & 0 deletions Nos/Views/Note/NoteCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct NoteCard: View {
Spacer()
}
}
.padding(5)
.allowsHitTesting(!note.isPreview)
Divider().overlay(Color.cardDividerTop).shadow(color: .cardDividerTopShadow, radius: 0, x: 0, y: 1)
Group {
Expand Down Expand Up @@ -144,6 +145,8 @@ struct NoteCard: View {
}
}
.padding(.leading, 13)
.padding(.trailing, 5)
.padding(.vertical, 5)
.allowsHitTesting(!note.isPreview)
}
}
Expand Down
5 changes: 3 additions & 2 deletions Nos/Views/Note/NoteCardHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ struct NoteCardHeader: View {
@ObservedObject var author: Author

var body: some View {
HStack(alignment: .center) {
HStack(alignment: .center, spacing: 8) {
AuthorLabel(author: author, note: note)
Spacer()
if let expirationTime = note.expirationDate?.distanceString() {
Image.disappearingMessages
.resizable()
Expand All @@ -24,6 +23,8 @@ struct NoteCardHeader: View {
.font(.clarity(.medium))
.foregroundColor(.secondaryTxt)
}

Spacer()
}
.padding(.leading, 10)
}
Expand Down
20 changes: 10 additions & 10 deletions NosTests/Extensions/Date+ElapsedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,28 @@ final class Date_ElapsedTests: XCTestCase {
XCTAssertEqual(
try XCTUnwrap(calendar.date(byAdding: .weekOfMonth, value: -1, to: date))
.distanceString(date, calendar: calendar),
"December 2"
"Dec 2"
)
XCTAssertEqual(
try XCTUnwrap(calendar.date(byAdding: .month, value: -1, to: date))
.distanceString(date, calendar: calendar),
"November 9"
"Nov 9"
)
XCTAssertEqual(
try XCTUnwrap(calendar.date(byAdding: .year, value: -1, to: date))
.addingTimeInterval(1)
.distanceString(date, calendar: calendar),
"December 9"
"Dec 9"
)
XCTAssertEqual(
try XCTUnwrap(calendar.date(byAdding: .year, value: -1, to: date))
.distanceString(date, calendar: calendar),
"December 9, 2022"
"Dec 9, 2022"
)
XCTAssertEqual(
try XCTUnwrap(calendar.date(byAdding: .year, value: -2, to: date))
.distanceString(date, calendar: calendar),
"December 9, 2021"
"Dec 9, 2021"
)
}

Expand Down Expand Up @@ -124,28 +124,28 @@ final class Date_ElapsedTests: XCTestCase {
XCTAssertEqual(
try XCTUnwrap(calendar.date(byAdding: .weekOfMonth, value: -1, to: date))
.distanceString(date, calendar: calendar),
"2 décembre"
"2 déc."
)
XCTAssertEqual(
try XCTUnwrap(calendar.date(byAdding: .month, value: -1, to: date))
.distanceString(date, calendar: calendar),
"9 novembre"
"9 nov."
)
XCTAssertEqual(
try XCTUnwrap(calendar.date(byAdding: .year, value: -1, to: date))
.addingTimeInterval(1)
.distanceString(date, calendar: calendar),
"9 décembre"
"9 déc."
)
XCTAssertEqual(
try XCTUnwrap(calendar.date(byAdding: .year, value: -1, to: date))
.distanceString(date, calendar: calendar),
"9 décembre 2022"
"9 déc. 2022"
)
XCTAssertEqual(
try XCTUnwrap(calendar.date(byAdding: .year, value: -2, to: date))
.distanceString(date, calendar: calendar),
"9 décembre 2021"
"9 déc. 2021"
)
}
// swiftlint:enable function_body_length
Expand Down

0 comments on commit 0dfd5f3

Please sign in to comment.