mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-04-27 02:14:45 +00:00
Editor: Add response context
This commit is contained in:
parent
6a162471f5
commit
039eab0d06
4 changed files with 16 additions and 6 deletions
|
@ -33,11 +33,18 @@ public struct StatusEditorView: View {
|
||||||
TextView($viewModel.statusText, $viewModel.selectedRange)
|
TextView($viewModel.statusText, $viewModel.selectedRange)
|
||||||
.placeholder("What's on your mind")
|
.placeholder("What's on your mind")
|
||||||
.padding(.horizontal, .layoutPadding)
|
.padding(.horizontal, .layoutPadding)
|
||||||
|
StatusEditorMediaView(viewModel: viewModel)
|
||||||
if let status = viewModel.embededStatus {
|
if let status = viewModel.embededStatus {
|
||||||
StatusEmbededView(status: status)
|
StatusEmbededView(status: status)
|
||||||
.padding(.horizontal, .layoutPadding)
|
.padding(.horizontal, .layoutPadding)
|
||||||
|
.disabled(true)
|
||||||
|
} else if let status = viewModel.replyToStatus {
|
||||||
|
Divider()
|
||||||
|
.padding(.top, 20)
|
||||||
|
StatusEmbededView(status: status)
|
||||||
|
.padding(.horizontal, .layoutPadding)
|
||||||
|
.disabled(true)
|
||||||
}
|
}
|
||||||
StatusEditorMediaView(viewModel: viewModel)
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
.padding(.top, 8)
|
.padding(.top, 8)
|
||||||
|
|
|
@ -31,9 +31,9 @@ extension StatusEditorViewModel {
|
||||||
case .new, .mention:
|
case .new, .mention:
|
||||||
return "New Post"
|
return "New Post"
|
||||||
case .edit:
|
case .edit:
|
||||||
return "Edit your post"
|
return "Editing your post"
|
||||||
case let .replyTo(status):
|
case let .replyTo(status):
|
||||||
return "Reply to \(status.reblog?.account.displayName ?? status.account.displayName)"
|
return "Replying to \(status.reblog?.account.displayName ?? status.account.displayName)"
|
||||||
case let .quote(status):
|
case let .quote(status):
|
||||||
return "Quote of \(status.reblog?.account.displayName ?? status.account.displayName)"
|
return "Quote of \(status.reblog?.account.displayName ?? status.account.displayName)"
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ public struct StatusRowView: View {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
if !viewModel.isCompact {
|
if !viewModel.isCompact {
|
||||||
reblogView
|
reblogView
|
||||||
replyView
|
replyView
|
||||||
}
|
}
|
||||||
statusView
|
statusView
|
||||||
if !viewModel.isCompact {
|
if !viewModel.isCompact && viewModel.showActions {
|
||||||
StatusActionsView(viewModel: viewModel)
|
StatusActionsView(viewModel: viewModel)
|
||||||
.padding(.vertical, 8)
|
.padding(.vertical, 8)
|
||||||
.tint(viewModel.isFocused ? theme.tintColor : .gray)
|
.tint(viewModel.isFocused ? theme.tintColor : .gray)
|
||||||
|
|
|
@ -7,6 +7,7 @@ public class StatusRowViewModel: ObservableObject {
|
||||||
let status: Status
|
let status: Status
|
||||||
let isCompact: Bool
|
let isCompact: Bool
|
||||||
let isFocused: Bool
|
let isFocused: Bool
|
||||||
|
let showActions: Bool
|
||||||
|
|
||||||
@Published var favouritesCount: Int
|
@Published var favouritesCount: Int
|
||||||
@Published var isFavourited: Bool
|
@Published var isFavourited: Bool
|
||||||
|
@ -27,10 +28,12 @@ public class StatusRowViewModel: ObservableObject {
|
||||||
|
|
||||||
public init(status: Status,
|
public init(status: Status,
|
||||||
isCompact: Bool = false,
|
isCompact: Bool = false,
|
||||||
isFocused: Bool = false) {
|
isFocused: Bool = false,
|
||||||
|
showActions: Bool = true) {
|
||||||
self.status = status
|
self.status = status
|
||||||
self.isCompact = isCompact
|
self.isCompact = isCompact
|
||||||
self.isFocused = isFocused
|
self.isFocused = isFocused
|
||||||
|
self.showActions = showActions
|
||||||
if let reblog = status.reblog {
|
if let reblog = status.reblog {
|
||||||
self.isFavourited = reblog.favourited == true
|
self.isFavourited = reblog.favourited == true
|
||||||
self.isReblogged = reblog.reblogged == true
|
self.isReblogged = reblog.reblogged == true
|
||||||
|
|
Loading…
Reference in a new issue