From 0a258f20f86bbb83b833c2c7d0d98745ca319306 Mon Sep 17 00:00:00 2001 From: Itunu Raimi Date: Mon, 18 Nov 2024 15:08:23 +0100 Subject: [PATCH 1/7] remove unused localized strings --- Nos/Assets/Localization/Reply.xcstrings | 142 ------------------------ 1 file changed, 142 deletions(-) diff --git a/Nos/Assets/Localization/Reply.xcstrings b/Nos/Assets/Localization/Reply.xcstrings index ce815cedd..1d7e6d4b8 100644 --- a/Nos/Assets/Localization/Reply.xcstrings +++ b/Nos/Assets/Localization/Reply.xcstrings @@ -213,148 +213,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" : "投稿しました" - } - }, - "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" : "返信しました" - } - }, - "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" : { From a851290aaf97cbae4a42c0039ed648e954d0a28f Mon Sep 17 00:00:00 2001 From: Itunu Raimi Date: Mon, 18 Nov 2024 15:08:54 +0100 Subject: [PATCH 2/7] remove "posted" and "replied" from UI --- Nos/Views/Components/Author/AuthorLabel.swift | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Nos/Views/Components/Author/AuthorLabel.swift b/Nos/Views/Components/Author/AuthorLabel.swift index 001f23158..0ac212483 100644 --- a/Nos/Views/Components/Author/AuthorLabel.swift +++ b/Nos/Views/Components/Author/AuthorLabel.swift @@ -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 } From 399de64a427f6befa6708e0ee7417703e5781033 Mon Sep 17 00:00:00 2001 From: Itunu Raimi Date: Mon, 18 Nov 2024 15:10:14 +0100 Subject: [PATCH 3/7] adjust spacing and UI --- Nos/Views/Note/NoteCard.swift | 3 ++- Nos/Views/Note/NoteCardHeader.swift | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Nos/Views/Note/NoteCard.swift b/Nos/Views/Note/NoteCard.swift index d24ffdb17..d040f18f5 100644 --- a/Nos/Views/Note/NoteCard.swift +++ b/Nos/Views/Note/NoteCard.swift @@ -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 { @@ -143,7 +144,7 @@ struct NoteCard: View { ReplyButton(note: note, replyAction: replyAction) } } - .padding(.leading, 13) + .padding(5) .allowsHitTesting(!note.isPreview) } } diff --git a/Nos/Views/Note/NoteCardHeader.swift b/Nos/Views/Note/NoteCardHeader.swift index 4112b24eb..beb935043 100644 --- a/Nos/Views/Note/NoteCardHeader.swift +++ b/Nos/Views/Note/NoteCardHeader.swift @@ -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() @@ -24,6 +23,8 @@ struct NoteCardHeader: View { .font(.clarity(.medium)) .foregroundColor(.secondaryTxt) } + + Spacer() } .padding(.leading, 10) } From e4ae00b8306a4ea751e237af9ae42d3acd5d9c25 Mon Sep 17 00:00:00 2001 From: Itunu Raimi Date: Mon, 18 Nov 2024 15:10:32 +0100 Subject: [PATCH 4/7] adjust date format to make month short form --- Nos/Extensions/Date+Elapsed.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nos/Extensions/Date+Elapsed.swift b/Nos/Extensions/Date+Elapsed.swift index e91a503b3..e7e0f247e 100644 --- a/Nos/Extensions/Date+Elapsed.swift +++ b/Nos/Extensions/Date+Elapsed.swift @@ -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 ) From 2b2fb6bc91bbef1d5a58b57f9eca215b02ad505d Mon Sep 17 00:00:00 2001 From: Itunu Raimi Date: Mon, 18 Nov 2024 15:10:41 +0100 Subject: [PATCH 5/7] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a92ca06f9..ceda52738 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Release Notes - Fix typo in minimum age warning - Fix crash when tapping Post button on macOS. [#1687](https://github.com/planetary-social/nos/issues/1687) +- Adjusted note header UI to make it more readable. [#23](https://github.com/verse-pbc/issues/issues/23) ### Internal Changes From 81bec5247aae776dcb158757a192c1ef6241bd66 Mon Sep 17 00:00:00 2001 From: Itunu Raimi Date: Mon, 18 Nov 2024 15:21:18 +0100 Subject: [PATCH 6/7] fix footer leading padding --- Nos/Views/Note/NoteCard.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Nos/Views/Note/NoteCard.swift b/Nos/Views/Note/NoteCard.swift index d040f18f5..30f844bd3 100644 --- a/Nos/Views/Note/NoteCard.swift +++ b/Nos/Views/Note/NoteCard.swift @@ -144,7 +144,9 @@ struct NoteCard: View { ReplyButton(note: note, replyAction: replyAction) } } - .padding(5) + .padding(.leading, 13) + .padding(.trailing, 5) + .padding(.vertical, 5) .allowsHitTesting(!note.isPreview) } } From 6ea950661a659d4d2c649086d3d2c8025b6b37a4 Mon Sep 17 00:00:00 2001 From: Itunu Raimi Date: Tue, 19 Nov 2024 14:26:01 +0100 Subject: [PATCH 7/7] fix tests --- Nos/Extensions/Date+Elapsed.swift | 2 +- NosTests/Extensions/Date+ElapsedTests.swift | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Nos/Extensions/Date+Elapsed.swift b/Nos/Extensions/Date+Elapsed.swift index e7e0f247e..cbd4214c3 100644 --- a/Nos/Extensions/Date+Elapsed.swift +++ b/Nos/Extensions/Date+Elapsed.swift @@ -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 diff --git a/NosTests/Extensions/Date+ElapsedTests.swift b/NosTests/Extensions/Date+ElapsedTests.swift index d195c72e6..f01ea4e04 100644 --- a/NosTests/Extensions/Date+ElapsedTests.swift +++ b/NosTests/Extensions/Date+ElapsedTests.swift @@ -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" ) } @@ -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