-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync with base branch and fix conflicts
- Loading branch information
Showing
12 changed files
with
213 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...es/Sources/DesignSystem/Foundation/Icons.xcassets/checkmark.circle.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "check-circle.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+2.55 KB
...Sources/DesignSystem/Foundation/Icons.xcassets/checkmark.circle.imageset/check-circle.pdf
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
Modules/Sources/DesignSystem/Foundation/Icons.xcassets/clock.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "clock.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+2.55 KB
Modules/Sources/DesignSystem/Foundation/Icons.xcassets/clock.imageset/clock.pdf
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
.../Sources/DesignSystem/Foundation/Icons.xcassets/exclamation.circle.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "exclamation.circle.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+2.6 KB
...DesignSystem/Foundation/Icons.xcassets/exclamation.circle.imageset/exclamation.circle.pdf
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "delete_24px.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+2.4 KB
Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/delete_24px.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
...s/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
import SwiftUI | ||
import DesignSystem | ||
|
||
struct CommentModerationOptionsView: View { | ||
|
||
private var options: [Option] = [ | ||
.approve, | ||
.pending, | ||
.trash, | ||
.spam | ||
] | ||
|
||
var optionSelected: ((Option) -> Void)? | ||
|
||
var body: some View { | ||
VStack(alignment: .leading, spacing: .DS.Padding.medium) { | ||
title | ||
optionsVStack | ||
} | ||
.padding(.horizontal, .DS.Padding.double) | ||
.background(Color.DS.Background.primary) | ||
} | ||
|
||
private var title: some View { | ||
Text(Strings.title) | ||
.font(.DS.Body.Emphasized.large) | ||
.foregroundStyle(Color.DS.Foreground.primary) | ||
} | ||
|
||
private var optionsVStack: some View { | ||
VStack(spacing: .DS.Padding.medium) { | ||
ForEach(options, id: \.title) { option in | ||
Button { | ||
optionSelected?(option) | ||
} label: { | ||
optionHStack(option: option) | ||
} | ||
} | ||
} | ||
} | ||
|
||
private func optionHStack(option: Option) -> some View { | ||
HStack(spacing: .DS.Padding.double) { | ||
Image.DS.icon(named: option.iconName) | ||
.resizable() | ||
.renderingMode(.template) | ||
.foregroundStyle(option.tintColor) | ||
.frame( | ||
width: .DS.Padding.medium, | ||
height: .DS.Padding.medium | ||
) | ||
|
||
Text(option.title) | ||
.font(.DS.Body.large) | ||
.foregroundStyle( | ||
Color.DS.Foreground.primary | ||
) | ||
|
||
Spacer() | ||
} | ||
} | ||
} | ||
|
||
extension CommentModerationOptionsView { | ||
enum Strings { | ||
static let title = NSLocalizedString( | ||
"comment.moderation.sheet.title", | ||
value: "Choose comment status", | ||
comment: "Title for the comment moderation sheet." | ||
) | ||
} | ||
} | ||
|
||
extension CommentModerationOptionsView { | ||
enum Option { | ||
case approve | ||
case pending | ||
case trash | ||
case spam | ||
|
||
var title: String { | ||
switch self { | ||
case .approve: | ||
return Strings.approveTitle | ||
case .pending: | ||
return Strings.pendingTitle | ||
case .trash: | ||
return Strings.trashTitle | ||
case .spam: | ||
return Strings.spamTitle | ||
} | ||
} | ||
|
||
var iconName: IconName { | ||
switch self { | ||
case .approve: | ||
return .checkmarkCircle | ||
case .pending: | ||
return .clock | ||
case .trash: | ||
return .trash | ||
case .spam: | ||
return .exclamationCircle | ||
} | ||
} | ||
|
||
var tintColor: Color { | ||
switch self { | ||
case .approve: | ||
return .DS.Foreground.brand(isJetpack: true) | ||
case .pending: | ||
return .DS.Foreground.secondary | ||
case .trash: | ||
return .DS.Foreground.warning | ||
case .spam: | ||
return .DS.Foreground.error | ||
} | ||
} | ||
} | ||
} | ||
|
||
private extension CommentModerationOptionsView.Option { | ||
enum Strings { | ||
static let approveTitle = NSLocalizedString( | ||
"comment.moderation.sheet.approve.title", | ||
value: "Approve", | ||
comment: "Approve option title for the comment moderation sheet." | ||
) | ||
static let pendingTitle = NSLocalizedString( | ||
"comment.moderation.sheet.pending.title", | ||
value: "Pending", | ||
comment: "Pending option title for the comment moderation sheet." | ||
) | ||
static let trashTitle = NSLocalizedString( | ||
"comment.moderation.sheet.trash.title", | ||
value: "Trash", | ||
comment: "Trash option title for the comment moderation sheet." | ||
) | ||
static let spamTitle = NSLocalizedString( | ||
"comment.moderation.sheet.spam.title", | ||
value: "Spam", | ||
comment: "Spam option title for the comment moderation sheet." | ||
) | ||
} | ||
} | ||
|
||
#Preview { | ||
CommentModerationOptionsView() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters