DM: Various UX fixes
This commit is contained in:
parent
377374d34f
commit
72fbcff1dd
|
@ -119,12 +119,17 @@ public struct ConversationDetailView: View {
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "plus")
|
Image(systemName: "plus")
|
||||||
}
|
}
|
||||||
.padding(.bottom, 6)
|
.padding(.bottom, 7)
|
||||||
|
|
||||||
TextField("conversations.new.message.placeholder", text: $viewModel.newMessageText, axis: .vertical)
|
TextField("conversations.new.message.placeholder", text: $viewModel.newMessageText, axis: .vertical)
|
||||||
.textFieldStyle(.roundedBorder)
|
|
||||||
.focused($isMessageFieldFocused)
|
.focused($isMessageFieldFocused)
|
||||||
.keyboardType(.default)
|
.keyboardType(.default)
|
||||||
|
.backgroundStyle(.thickMaterial)
|
||||||
|
.padding(6)
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: 14)
|
||||||
|
.stroke(.gray, lineWidth: 1)
|
||||||
|
)
|
||||||
.font(.scaledBody)
|
.font(.scaledBody)
|
||||||
if !viewModel.newMessageText.isEmpty {
|
if !viewModel.newMessageText.isEmpty {
|
||||||
Button {
|
Button {
|
||||||
|
@ -139,7 +144,7 @@ public struct ConversationDetailView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.keyboardShortcut(.return, modifiers: .command)
|
.keyboardShortcut(.return, modifiers: .command)
|
||||||
.padding(.bottom, 5)
|
.padding(.bottom, 6)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(8)
|
.padding(8)
|
||||||
|
|
|
@ -66,9 +66,13 @@ struct ConversationMessageView: View {
|
||||||
if isOwnMessage {
|
if isOwnMessage {
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
Text(message.createdAt.asDate, style: .time)
|
Group {
|
||||||
.font(.scaledFootnote)
|
Text(message.createdAt.shortDateFormatted) +
|
||||||
.foregroundColor(.gray)
|
Text(" ")
|
||||||
|
Text(message.createdAt.asDate, style: .time)
|
||||||
|
}
|
||||||
|
.font(.scaledFootnote)
|
||||||
|
.foregroundColor(.gray)
|
||||||
if !isOwnMessage {
|
if !isOwnMessage {
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ extension ServerDate {
|
||||||
|
|
||||||
private static var createdAtShortDateFormatted: DateFormatter = {
|
private static var createdAtShortDateFormatted: DateFormatter = {
|
||||||
let dateFormatter = DateFormatter()
|
let dateFormatter = DateFormatter()
|
||||||
dateFormatter.dateStyle = .medium
|
dateFormatter.dateStyle = .short
|
||||||
|
dateFormatter.timeStyle = .none
|
||||||
return dateFormatter
|
return dateFormatter
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -32,14 +33,8 @@ extension ServerDate {
|
||||||
public var relativeFormatted: String {
|
public var relativeFormatted: String {
|
||||||
return Self.createdAtRelativeFormatter.localizedString(for: asDate, relativeTo: Date())
|
return Self.createdAtRelativeFormatter.localizedString(for: asDate, relativeTo: Date())
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
extension Calendar {
|
public var shortDateFormatted: String {
|
||||||
func numberOfDaysBetween(_ from: Date, and to: Date) -> Int {
|
return Self.createdAtShortDateFormatted.string(from: asDate)
|
||||||
let fromDate = startOfDay(for: from)
|
|
||||||
let toDate = startOfDay(for: to)
|
|
||||||
let numberOfDays = dateComponents([.day], from: fromDate, to: toDate)
|
|
||||||
|
|
||||||
return numberOfDays.day!
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue