Skip to content

Discussions UI improvements #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Discussion/Discussion/Domain/Model/DiscussionTopic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public struct CoursewareTopics: Hashable, Identifiable {

public init(id: String, name: String, threadListURL: String, children: [CoursewareTopics]) {
self.id = id
self.name = name
self.name = name.isEmpty ? DiscussionLocalization.Topics.unnamed : name
self.threadListURL = threadListURL
self.children = children
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public struct ParentCommentView: View {
? Theme.Colors.accentColor
: Theme.Colors.textSecondaryLight)
}
}.padding(.top, 31)
}.padding(.top, 15)
Text(comments.postTitle)
.font(Theme.Fonts.titleLarge)
.foregroundColor(Theme.Colors.textPrimary)
Expand Down Expand Up @@ -133,7 +133,6 @@ public struct ParentCommentView: View {
? Theme.Colors.alert
: Theme.Colors.textSecondaryLight)
.font(Theme.Fonts.labelLarge)
.padding(.top, 8)
}
.padding(.horizontal, 24)
if isThread {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public struct ResponsesView: View {
Text(DiscussionLocalization.commentsCount(viewModel.itemsCount))
Spacer()
}
.padding(.top, 40)
.padding(.top, 20)
.padding(.bottom, 14)
.padding(.leading, 24)
.font(Theme.Fonts.titleMedium)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ public struct ThreadView: View {
Text(DiscussionLocalization.responsesCount(viewModel.itemsCount))
Spacer()
}
.padding(.top, 40)
.padding(.bottom, 14)
.padding(.top, 20)
.padding(.leading, 24)
.font(Theme.Fonts.titleMedium)
.foregroundColor(Theme.Colors.textPrimary)
Expand All @@ -99,7 +98,8 @@ public struct ThreadView: View {
addCommentAvailable: true,
onAvatarTap: { username in
viewModel.router.showUserDetails(username: username)
}, onLikeTap: {
},
onLikeTap: {
Task {
await viewModel.vote(
id: comment.commentID,
Expand All @@ -123,7 +123,7 @@ public struct ThreadView: View {
viewModel.router.showComments(
commentID: comment.commentID,
parentComment: comment,
threadStateSubject: viewModel.threadStateSubject,
threadStateSubject: viewModel.threadStateSubject,
animated: true
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public struct DiscussionTopicsView: View {
viewModel.router.showDiscussionsSearch(courseID: courseID)
}
.padding(.horizontal, 24)
.padding(.bottom, 20)
.padding(.top, 10)
.accessibilityElement(children: .ignore)
.accessibilityLabel(DiscussionLocalization.Topics.search)

Expand All @@ -68,7 +68,7 @@ public struct DiscussionTopicsView: View {
.font(Theme.Fonts.titleMedium)
.foregroundColor(Theme.Colors.textSecondary)
.padding(.horizontal, 24)
.padding(.top, 40)
.padding(.top, 10)
Spacer()
}
HStack(spacing: 8) {
Expand Down Expand Up @@ -109,7 +109,7 @@ public struct DiscussionTopicsView: View {
.padding(.leading, -20)

}
}.padding(.bottom, 26)
}.padding(.bottom, 16)
ForEach(Array(topics.enumerated()), id: \.offset) { _, topic in
if topic.name != DiscussionLocalization.Topics.allPosts
&& topic.name != DiscussionLocalization.Topics.postImFollowing {
Expand All @@ -120,13 +120,13 @@ public struct DiscussionTopicsView: View {
.font(Theme.Fonts.titleMedium)
.foregroundColor(Theme.Colors.textSecondary)
Spacer()
}.padding(.top, 32)
}.padding(.top, 12)
.padding(.bottom, 8)
.padding(.horizontal, 24)
} else {
VStack {
TopicCell(topic: topic)
.padding(.vertical, 24)
.padding(.vertical, 10)
Divider()
}.padding(.horizontal, 24)
}
Expand Down Expand Up @@ -210,6 +210,7 @@ public struct TopicCell: View {
Text(topic.name)
.font(Theme.Fonts.titleMedium)
.foregroundColor(Theme.Colors.textPrimary)
.multilineTextAlignment(.leading)
Spacer()
Image(systemName: "chevron.right")
.foregroundColor(Theme.Colors.accentColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public class DiscussionTopicsViewModel: ObservableObject {
style: .basic
),
DiscussionTopic(
name: DiscussionLocalization.Topics.postImFollowing, action: {
name: DiscussionLocalization.Topics.postImFollowing,
action: {
self.analytics.discussionFollowingClicked(courseId: self.courseID,
courseName: self.title)
self.router.showThreads(
Expand Down
4 changes: 3 additions & 1 deletion Discussion/Discussion/Presentation/Posts/PostsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ public struct PostsView: View {
.padding(.horizontal, 24)

ForEach(posts, id: \.offset) { index, post in
PostCell(post: post).padding(24)
PostCell(post: post)
.padding(.horizontal, 24)
.padding(.vertical, 10)
.id(UUID())
.onAppear {
Task {
Expand Down
2 changes: 2 additions & 0 deletions Discussion/Discussion/SwiftGen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ public enum DiscussionLocalization {
public static let postImFollowing = DiscussionLocalization.tr("Localizable", "TOPICS.POST_IM_FOLLOWING", fallback: "Posts I'm following")
/// Search all posts
public static let search = DiscussionLocalization.tr("Localizable", "TOPICS.SEARCH", fallback: "Search all posts")
/// Unnamed subcategory
public static let unnamed = DiscussionLocalization.tr("Localizable", "TOPICS.UNNAMED", fallback: "Unnamed subcategory")
}
}
// swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length
Expand Down
1 change: 1 addition & 0 deletions Discussion/Discussion/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"TOPICS.ALL_POSTS" = "All Posts";
"TOPICS.POST_IM_FOLLOWING" = "Posts I'm following";
"TOPICS.MAIN_CATEGORIES" = "Main categories";
"TOPICS.UNNAMED" = "Unnamed subcategory";

"POSTS.SORT.RECENT_ACTIVITY" = "Recent Activity";
"POSTS.SORT.MOST_ACTIVITY" = "Most Activity";
Expand Down
1 change: 1 addition & 0 deletions Discussion/Discussion/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"TOPICS.ALL_POSTS" = "Всі пости";
"TOPICS.POST_IM_FOLLOWING" = "Улюблені пости";
"TOPICS.MAIN_CATEGORIES" = "Основні категорії";
"TOPICS.UNNAMED" = "Unnamed subcategory";

"POSTS.SORT.RECENT_ACTIVITY" = "Остання активність";
"POSTS.SORT.MOST_ACTIVITY" = "Найактивниші";
Expand Down
Loading