From 556204879610cb0b9f9bd7879df08cbea0c6bb2b Mon Sep 17 00:00:00 2001 From: alpavanoglu Date: Thu, 25 Apr 2024 13:51:40 +0200 Subject: [PATCH 1/4] Add `CommentModerationOptionsView` --- .../DesignSystem/Foundation/IconName.swift | 3 + .../clock.imageset/Contents.json | 12 ++ .../Icons.xcassets/clock.imageset/clock.pdf | Bin 0 -> 2609 bytes .../exclamation.circle.imageset/Contents.json | 12 ++ .../exclamation.circle.pdf | Bin 0 -> 2667 bytes .../trash.imageset/Contents.json | 12 ++ .../trash.imageset/delete_24px.pdf | Bin 0 -> 2456 bytes .../CommentModerationOptionsView.swift | 122 ++++++++++++++++++ WordPress/WordPress.xcodeproj/project.pbxproj | 12 ++ 9 files changed, 173 insertions(+) create mode 100644 Modules/Sources/DesignSystem/Foundation/Icons.xcassets/clock.imageset/Contents.json create mode 100644 Modules/Sources/DesignSystem/Foundation/Icons.xcassets/clock.imageset/clock.pdf create mode 100644 Modules/Sources/DesignSystem/Foundation/Icons.xcassets/exclamation.circle.imageset/Contents.json create mode 100644 Modules/Sources/DesignSystem/Foundation/Icons.xcassets/exclamation.circle.imageset/exclamation.circle.pdf create mode 100644 Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/Contents.json create mode 100644 Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/delete_24px.pdf create mode 100644 WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift diff --git a/Modules/Sources/DesignSystem/Foundation/IconName.swift b/Modules/Sources/DesignSystem/Foundation/IconName.swift index f2cf77ea5d1a..4818ad3e9556 100644 --- a/Modules/Sources/DesignSystem/Foundation/IconName.swift +++ b/Modules/Sources/DesignSystem/Foundation/IconName.swift @@ -10,11 +10,14 @@ import SwiftUI public enum IconName: String, CaseIterable { case ellipsisHorizontal = "ellipsis.horizontal" case checkmark + case clock + case trash case gearshapeFill = "gearshape.fill" case blockShare = "block.share" case starFill = "star.fill" case starOutline = "star.outline" case chevronRight = "chevron.right" + case exclamationCircle = "exclamation.circle" } // MARK: - Load Image diff --git a/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/clock.imageset/Contents.json b/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/clock.imageset/Contents.json new file mode 100644 index 000000000000..e899d634dd4a --- /dev/null +++ b/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/clock.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "clock.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/clock.imageset/clock.pdf b/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/clock.imageset/clock.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a78485ce36749cc01ef214a2e31f2422777e2b59 GIT binary patch literal 2609 zcmd^BO;6iE5WVlO*b5R=!uD=#Y)dE-BoI|Cf+js6p&pF0B%!gL+D--h`p($9vo;3N zp1YTf-^{$74|^sDH`B{w;e?C{?(yROk#T-{%H8kJJH_4G>-$HQ)_}orzp8vyuek)n zxrSzCvEOwZn&(#6__U4-;4727+9jpR)90RkJl0f;{e9hBdRdg2#^$Oj_GPLnyn-yx z&xw2%*1IyVr##Fx4DT9Py3%vrXB$TLp7>#(*h?DuAuQNEoVm(HMK-JHEg| za&iz6DRpv!TMVk8T_8VesU^UO&}jR0u&BL|2q}6KYbP@-LQIhbMuMT?wcUm&3Eg(k z*a>4iFcpk}Hz}LUC5; z-OvpGTSx)tgPqYAPxWk3C$(zy7oz!DTqV`dMrzj!KK7P@-5Gt!opBsgdh7IcgC`f( z&DnOhPClkKD`miefZlWbgt7PKkdBrBzXE4ADt|GH0+$*yL6EzJLcNs-qoha0g12E4(w zU-MW)ojM`ZW`Mzd*(@Pcjv36kiFi`%!B-68uK?*V39mA_(>3q0uH!7cmW;`+q^w~Jb(fL6BZ9yi6DS{UO~}oM-hbst9W1qA3Jkc>)qlRRtg+39<2+#@*}U$Ymkdr-Nc}md_@Jel3*2 zZ3HSQ;vgJR*}H~63xdF8{=xyxN#e;UN`#~bK{U@Da|d)?A*t(XbimUg42@k!4hW9) zRbUAOisjS;paY>wZExTZ@tDW<#z2jtKnnQ3_pv~4gcl0Q3;Ft%oa`BC?mgM=4Wx0)<4XtT}=9Qutw~*8J_$Z)g!LkS3}v}n-7cXEZ;t+ z?^E~7Xpch!-S)&x-l7|i+q8kKpU3f_Qr*TK^%eT7E#^bbRyFaVwA1qNF3^N+mxOIn zf}n2FSy7ZtP4D#nv?<-BE7bv4YPnATbrWkQyVUiy=)WW;WznbtJn9Pc;En!ZXsGNU zr%oDbGtj|)UN0e3sxz3=KH^Ea16#Hie+`Jk#9-PwR64^NJ=)ACX_MyVYH0ghsRt5J z#z;HH%utS_D2yoJ-J=~C0elCvkC1y%#9%)Uv{=lb6tAEVQXE1ue67WUJuMzYP_Tg^ zhp&LwP#9RQrb^ejs)#P{rzsToxGp#9gdVS#CvA!Sd09ezb@@!c{KfjW(zSr%)=gS9 PraC-~V{&wKaees*KiNL9 literal 0 HcmV?d00001 diff --git a/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/Contents.json b/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/Contents.json new file mode 100644 index 000000000000..edf3b2af38c5 --- /dev/null +++ b/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "delete_24px.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/delete_24px.pdf b/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/delete_24px.pdf new file mode 100644 index 0000000000000000000000000000000000000000..22ebb55bddaf2cb038d8eb3e53b3dd65d46fd2ce GIT binary patch literal 2456 zcmd^ATTk0C6n^)w@Cy=5!ik-W6A4v<7OH7OuyzkfXb&MZZCRRhNtj^2e&^(3J4+GU z^Zd}BeD=A0$3Exic6N2jnIwc$mlh9CgwnG!>U@3OE9%_cJUpqi1`L+-S>@|`Lj@dM zbkMvkp7)kQ^WE+>I<4Xo?3GDg?UPdF>FZ#BGU-e$pC9VR=~YqgI&7h;;<-#!g)a2T zi;Log-cy&k%`$@Ud&o%Nz!Yd!b*Yjaac1i0HdTxH1)VPKue2gR2=CRk=~FG~J;7W* zcBP;owEokb(bUJZP^CH1R)m&7CuXtBV^30pW)`ZCW=8)IW@~TABgx4ZLR7x$QU(dj zO0aBgeT64*zd=2XzEgGo|E_w-cpP|KP@e_5>be?Z0jn-qBxMx1ln4D)*%6OPkB8i| zz>EmE3Bn6Q%6-N|Sdv;rKMaaK5V$j(g>LMJVDvC*S&f)q+99YM*52 z2l`0{8pS8swcw`5-a#es8Jbpj`BKl9byBNl|B^R<%j=~2-big1$In5}HLZClIdh8r zplj~Kz0sEgUHv@UZ<6;-_nmuW1A%VT=uF-+H<`3)gR#DOg#)I#@g#eO{;K6Wz}dPY z4p2KQ4mVCT*jC98wd+WOSfukjFY1ck1Z3YcTyz6<=|vLFGK z8$wcyPDSHWkq_Jq6a}=Q5fmF+b(w54RT8B4;|$0>u8N&Hp~u_RNlUS_C<@>g>1*oc aEVsWDaslL4byC(1JJ9R`a&&ZgbM+heyBCfC literal 0 HcmV?d00001 diff --git a/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift b/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift new file mode 100644 index 000000000000..421e0a0e985b --- /dev/null +++ b/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift @@ -0,0 +1,122 @@ +import SwiftUI +import DesignSystem + +struct CommentModerationOptionsView: View { + private struct Item { + let title: String + let iconName: IconName + let tintColor: Color + let backgroundColor: Color + } + + private let items = [ + Item( + title: Strings.approveTitle, + iconName: .checkmark, + tintColor: .DS.Background.primary, + backgroundColor: .DS.Foreground.brand(isJetpack: true) + ), + Item( + title: Strings.pendingTitle, + iconName: .clock, + tintColor: .DS.Background.primary, + backgroundColor: .DS.Foreground.secondary + ), + Item( + title: Strings.trashTitle, + iconName: .trash, + tintColor: .DS.Background.primary, + backgroundColor: .DS.Foreground.warning + ), + Item( + title: Strings.spamTitle, + iconName: .exclamationCircle, + tintColor: .DS.Background.primary, + backgroundColor: .DS.Foreground.error + ), + ] + + var body: some View { + VStack(alignment: .leading, spacing: .DS.Padding.medium) { + title + optionsVStack + } + .padding(.horizontal, .DS.Padding.double) + } + + 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(items, id: \.title) { item in + optionHStack(item: item) + } + } + } + + private func optionHStack(item: Item) -> some View { + HStack(spacing: .DS.Padding.double) { + Circle() + .fill(item.backgroundColor) + .frame( + width: .DS.Padding.large, + height: .DS.Padding.large + ) + .overlay { + Image.DS.icon(named: item.iconName) + .resizable() + .foregroundStyle(item.tintColor) + .frame( + width: .DS.Padding.medium, + height: .DS.Padding.medium + ) + } + + Text(item.title) + .font(.DS.Body.large) + .foregroundStyle( + Color.DS.Foreground.primary + ) + + Spacer() + } + } +} + +private extension CommentModerationOptionsView { + enum Strings { + static let title = NSLocalizedString( + "comment.moderation.sheet.title", + value: "Choose comment status", + comment: "Title for the comment moderation sheet." + ) + 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() +} diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index 69d6d39f1803..0e679fc82089 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -262,6 +262,7 @@ 069A4AA72664448F00413FA9 /* GutenbergFeaturedImageHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 069A4AA52664448F00413FA9 /* GutenbergFeaturedImageHelper.swift */; }; 080C44A91CE14A9F00B3A02F /* MenuDetailsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 080C449E1CE14A9F00B3A02F /* MenuDetailsViewController.m */; }; 0815CF461E96F22600069916 /* MediaImportService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0815CF451E96F22600069916 /* MediaImportService.swift */; }; + 08169B9D2BDA68F600055454 /* CommentModerationOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08169B9C2BDA68F600055454 /* CommentModerationOptionsView.swift */; }; 081E4B4C281C019A0085E89C /* TooltipAnchor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 081E4B4B281C019A0085E89C /* TooltipAnchor.swift */; }; 08216FAA1CDBF95100304BA7 /* MenuItemEditing.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 08216FA71CDBF95100304BA7 /* MenuItemEditing.storyboard */; }; 08216FAB1CDBF95100304BA7 /* MenuItemEditingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08216FA91CDBF95100304BA7 /* MenuItemEditingViewController.m */; }; @@ -6034,6 +6035,7 @@ 080C449D1CE14A9F00B3A02F /* MenuDetailsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuDetailsViewController.h; sourceTree = ""; }; 080C449E1CE14A9F00B3A02F /* MenuDetailsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuDetailsViewController.m; sourceTree = ""; }; 0815CF451E96F22600069916 /* MediaImportService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaImportService.swift; sourceTree = ""; }; + 08169B9C2BDA68F600055454 /* CommentModerationOptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentModerationOptionsView.swift; sourceTree = ""; }; 081E4B4B281C019A0085E89C /* TooltipAnchor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TooltipAnchor.swift; sourceTree = ""; }; 08216FA71CDBF95100304BA7 /* MenuItemEditing.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MenuItemEditing.storyboard; sourceTree = ""; }; 08216FA81CDBF95100304BA7 /* MenuItemEditingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuItemEditingViewController.h; sourceTree = ""; }; @@ -10173,6 +10175,14 @@ path = Classes; sourceTree = ""; }; + 08169B9B2BDA68E000055454 /* Comment Moderation */ = { + isa = PBXGroup; + children = ( + 08169B9C2BDA68F600055454 /* CommentModerationOptionsView.swift */, + ); + path = "Comment Moderation"; + sourceTree = ""; + }; 081E4B4A281BFB520085E89C /* Feature Highlight */ = { isa = PBXGroup; children = ( @@ -16526,6 +16536,7 @@ CC1D800D1656D8B2002A542F /* Notifications */ = { isa = PBXGroup; children = ( + 08169B9B2BDA68E000055454 /* Comment Moderation */, 3FEC241325D73C53007AFE63 /* Milestone Notifications */, 402FFB1D218C2B8D00FF4A0B /* Style */, B5FD453E199D0F2800286FBB /* Controllers */, @@ -22445,6 +22456,7 @@ 8B0CE7D12481CFE8004C4799 /* ReaderDetailHeaderView.swift in Sources */, E240859C183D82AE002EB0EF /* WPAnimatedBox.m in Sources */, 4A1E77CC2989F2F7006281CC /* WPAccount+DeduplicateBlogs.swift in Sources */, + 08169B9D2BDA68F600055454 /* CommentModerationOptionsView.swift in Sources */, 08472A201C727E020040769D /* PostServiceOptions.m in Sources */, 9A38DC6A218899FB006A409B /* DiffTitleValue.swift in Sources */, B0AC50DD251E96270039E022 /* ReaderCommentsViewController.swift in Sources */, From 82e81bb74b234ed4b30a85b612b4a03d85823d72 Mon Sep 17 00:00:00 2001 From: alpavanoglu Date: Thu, 25 Apr 2024 14:08:43 +0200 Subject: [PATCH 2/4] Add background color to body --- .../Comment Moderation/CommentModerationOptionsView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift b/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift index 421e0a0e985b..1307477389cc 100644 --- a/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift +++ b/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift @@ -42,6 +42,7 @@ struct CommentModerationOptionsView: View { optionsVStack } .padding(.horizontal, .DS.Padding.double) + .background(Color.DS.Background.primary) } private var title: some View { From dc020aefc9ecbfc8c4891f426bbbaa94e13c9b49 Mon Sep 17 00:00:00 2001 From: alpavanoglu Date: Mon, 29 Apr 2024 12:20:45 +0200 Subject: [PATCH 3/4] Update design to match new icons --- .../DesignSystem/Foundation/IconName.swift | 1 + .../checkmark.circle.imageset/Contents.json | 12 +++++++ .../check-circle.pdf | Bin 0 -> 2607 bytes .../trash.imageset/delete_24px.pdf | Bin 2456 -> 2461 bytes .../CommentModerationOptionsView.swift | 34 ++++++------------ 5 files changed, 24 insertions(+), 23 deletions(-) create mode 100644 Modules/Sources/DesignSystem/Foundation/Icons.xcassets/checkmark.circle.imageset/Contents.json create mode 100644 Modules/Sources/DesignSystem/Foundation/Icons.xcassets/checkmark.circle.imageset/check-circle.pdf diff --git a/Modules/Sources/DesignSystem/Foundation/IconName.swift b/Modules/Sources/DesignSystem/Foundation/IconName.swift index 4818ad3e9556..c447d69718e9 100644 --- a/Modules/Sources/DesignSystem/Foundation/IconName.swift +++ b/Modules/Sources/DesignSystem/Foundation/IconName.swift @@ -10,6 +10,7 @@ import SwiftUI public enum IconName: String, CaseIterable { case ellipsisHorizontal = "ellipsis.horizontal" case checkmark + case checkmarkCircle = "checkmark.circle" case clock case trash case gearshapeFill = "gearshape.fill" diff --git a/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/checkmark.circle.imageset/Contents.json b/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/checkmark.circle.imageset/Contents.json new file mode 100644 index 000000000000..9b023857dade --- /dev/null +++ b/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/checkmark.circle.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "check-circle.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/checkmark.circle.imageset/check-circle.pdf b/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/checkmark.circle.imageset/check-circle.pdf new file mode 100644 index 0000000000000000000000000000000000000000..212f25d27097401bd6a876b92f593511720acd0b GIT binary patch literal 2607 zcmd^BO;6iE5WVlO*b5R=BKA6V97`w?BoI|Cf+js6p&pF0B%%IDZKnc$eP?X%jE#e6 z&)o~-H#=`;-)wd`x}9B}s(~+rlD5nqo`jTVXVUuqveVMKyLouhQ3)6<>#I)Jq`?-t$o6@p3rs;f zFD|lYc`xmOT`e{o*FbFj04j(q%3Ozuux9%AHqwjvg`6(iUr`}`31z~G`jo7`k6ckA z$hHTb6SxXA8rUPpcRg7|DZ9C@M6k_P+(L;n=J-QcJ9;A?MJm1tq0?1!WU#QU0^3&i z*BLtKuh1c(A9UUQzq{_3t3gJ$>u;|jc3n}o9I_JO4%{*BmJE_td2oFyCqraKd<}?$ z4BEv>35vu4Ud~P&3^7S0S}0Y=d@V2KV=NMzwhBhWL;zDzi(oL)weRXwWA-a3TU8Vk zpvL5+S{MTrD1_0Lb;wIR5KZiykV2?>u9YAZfnxo^cvw}PU^$HlSXkZmSf~*lVrZl~oTH{OpVZo)}%rnoE49nwit}^}Z|^Hs|qf6Mjr>21<_u zfo1~IN#3KIOzL9;nR!!39i^J7=^KUqY7$wX*}4!GNIT08zvoC;cgf`@jS0jiou_G5 z7V;ivARp;ATp0Z5BU*&Ql8VL=)B)#qvN>DRp#L~ z*114=KhHqi<04D+i9Ft}PHKs*MV5iSC|}htYq@>Zs0D~ylwn?0>NrDtB#w?QZ?66T D14S=g literal 0 HcmV?d00001 diff --git a/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/delete_24px.pdf b/Modules/Sources/DesignSystem/Foundation/Icons.xcassets/trash.imageset/delete_24px.pdf index 22ebb55bddaf2cb038d8eb3e53b3dd65d46fd2ce..090a0b869020d7454e98497b73a596bec20433a0 100644 GIT binary patch literal 2461 zcmd^BQBT`25PtWs@Cy=5B8g)=i6vACTBxQC!P-3_p*@7uv}I}1CFunG`kj;5aYzu` z^ZWqLXWw_{yYuHB-OjE~i4!73u!r-9Cxr3Y8Fs(F>?L;ZZXTXwQUM0T{VKC{wZT4Y zT(r=<$PatVp#E;wYMaJz34BGImHW7mS@P0bpG;b+<>8^KonGa|uEiFz%nwB(OXb4s zytv4p@jdn&uO8jRr%n|4)MwaddhrKPfn`}0GTtF~CVy`extL$z>C*m6O7sg6ZDgoV z&1|@4mXaOvoQMja1P}`gV1z0t%6-9bnPjlshT6roLu1jV7HW*r&VCH*I8(Gik0?Xm z5R%!dJu=KxS&=GRQ(wrCTCY)R&=0E4{_m_z%UK5k zQzHz@0rP?oT3<)6PsBSY>0&qAz=snFFNmP+wW$fv@EgR0k&GRqzLuZfyO-)>HTN>$ zp1GG0pQXmF4%b3^N3fFWMW=_C&((Zc#g(krFG>Axc^#KO>sce^>a!=joj&(x?i?#o zXcfM{Hu!Qu+RxMdCjOXO%lCjo0quKZPVyezWYQcP$h3li=31F*-zd=ECPROv`!3{c zT_P7!JIlw_QxP^*Vu5iT8BmGmd6wl>iSN~m(;ewHUdtA^maA?2uWy%P>YhQ>7W(a- z=2;~(@TfAN!CUpjR#>! zyOU4jDo*ot-}bqXkI2J>phh~?UmS1_f(Up!lmj&|yqwKoVgPXh*IEs;i?D$qVRW!7 zq;I)MG~5+&xCK3W-}52UeTaa24OKpdOyz~xyNO`lPCCiyE@M;g@(U(S dz1-#YRjOP-a?2_%syaLHGr~hhN0&EOe*k=B7x@4H literal 2456 zcmd^ATTk0C6n^)w@Cy=5!ik-W6A4v<7OH7OuyzkfXb&MZZCRRhNtj^2e&^(3J4+GU z^Zd}BeD=A0$3Exic6N2jnIwc$mlh9CgwnG!>U@3OE9%_cJUpqi1`L+-S>@|`Lj@dM zbkMvkp7)kQ^WE+>I<4Xo?3GDg?UPdF>FZ#BGU-e$pC9VR=~YqgI&7h;;<-#!g)a2T zi;Log-cy&k%`$@Ud&o%Nz!Yd!b*Yjaac1i0HdTxH1)VPKue2gR2=CRk=~FG~J;7W* zcBP;owEokb(bUJZP^CH1R)m&7CuXtBV^30pW)`ZCW=8)IW@~TABgx4ZLR7x$QU(dj zO0aBgeT64*zd=2XzEgGo|E_w-cpP|KP@e_5>be?Z0jn-qBxMx1ln4D)*%6OPkB8i| zz>EmE3Bn6Q%6-N|Sdv;rKMaaK5V$j(g>LMJVDvC*S&f)q+99YM*52 z2l`0{8pS8swcw`5-a#es8Jbpj`BKl9byBNl|B^R<%j=~2-big1$In5}HLZClIdh8r zplj~Kz0sEgUHv@UZ<6;-_nmuW1A%VT=uF-+H<`3)gR#DOg#)I#@g#eO{;K6Wz}dPY z4p2KQ4mVCT*jC98wd+WOSfukjFY1ck1Z3YcTyz6<=|vLFGK z8$wcyPDSHWkq_Jq6a}=Q5fmF+b(w54RT8B4;|$0>u8N&Hp~u_RNlUS_C<@>g>1*oc aEVsWDaslL4byC(1JJ9R`a&&ZgbM+heyBCfC diff --git a/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift b/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift index 1307477389cc..c3d5c2d7f862 100644 --- a/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift +++ b/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift @@ -6,33 +6,28 @@ struct CommentModerationOptionsView: View { let title: String let iconName: IconName let tintColor: Color - let backgroundColor: Color } private let items = [ Item( title: Strings.approveTitle, - iconName: .checkmark, - tintColor: .DS.Background.primary, - backgroundColor: .DS.Foreground.brand(isJetpack: true) + iconName: .checkmarkCircle, + tintColor: .DS.Foreground.brand(isJetpack: true) ), Item( title: Strings.pendingTitle, iconName: .clock, - tintColor: .DS.Background.primary, - backgroundColor: .DS.Foreground.secondary + tintColor: .DS.Foreground.secondary ), Item( title: Strings.trashTitle, iconName: .trash, - tintColor: .DS.Background.primary, - backgroundColor: .DS.Foreground.warning + tintColor: .DS.Foreground.warning ), Item( title: Strings.spamTitle, iconName: .exclamationCircle, - tintColor: .DS.Background.primary, - backgroundColor: .DS.Foreground.error + tintColor: .DS.Foreground.error ), ] @@ -61,21 +56,14 @@ struct CommentModerationOptionsView: View { private func optionHStack(item: Item) -> some View { HStack(spacing: .DS.Padding.double) { - Circle() - .fill(item.backgroundColor) + Image.DS.icon(named: item.iconName) + .resizable() + .renderingMode(.template) + .foregroundStyle(item.tintColor) .frame( - width: .DS.Padding.large, - height: .DS.Padding.large + width: .DS.Padding.medium, + height: .DS.Padding.medium ) - .overlay { - Image.DS.icon(named: item.iconName) - .resizable() - .foregroundStyle(item.tintColor) - .frame( - width: .DS.Padding.medium, - height: .DS.Padding.medium - ) - } Text(item.title) .font(.DS.Body.large) From 9ccbdcee0e9fc1630a63a2a1ed9dcd16da4af63f Mon Sep 17 00:00:00 2001 From: alpavanoglu Date: Mon, 29 Apr 2024 19:41:27 +0200 Subject: [PATCH 4/4] Wrap HStack with Button --- .../CommentModerationOptionsView.swift | 104 ++++++++++++------ 1 file changed, 71 insertions(+), 33 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift b/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift index c3d5c2d7f862..6fc883c2af86 100644 --- a/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift +++ b/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationOptionsView.swift @@ -2,35 +2,16 @@ import SwiftUI import DesignSystem struct CommentModerationOptionsView: View { - private struct Item { - let title: String - let iconName: IconName - let tintColor: Color - } - private let items = [ - Item( - title: Strings.approveTitle, - iconName: .checkmarkCircle, - tintColor: .DS.Foreground.brand(isJetpack: true) - ), - Item( - title: Strings.pendingTitle, - iconName: .clock, - tintColor: .DS.Foreground.secondary - ), - Item( - title: Strings.trashTitle, - iconName: .trash, - tintColor: .DS.Foreground.warning - ), - Item( - title: Strings.spamTitle, - iconName: .exclamationCircle, - tintColor: .DS.Foreground.error - ), + private var options: [Option] = [ + .approve, + .pending, + .trash, + .spam ] + var optionSelected: ((Option) -> Void)? + var body: some View { VStack(alignment: .leading, spacing: .DS.Padding.medium) { title @@ -48,24 +29,28 @@ struct CommentModerationOptionsView: View { private var optionsVStack: some View { VStack(spacing: .DS.Padding.medium) { - ForEach(items, id: \.title) { item in - optionHStack(item: item) + ForEach(options, id: \.title) { option in + Button { + optionSelected?(option) + } label: { + optionHStack(option: option) + } } } } - private func optionHStack(item: Item) -> some View { + private func optionHStack(option: Option) -> some View { HStack(spacing: .DS.Padding.double) { - Image.DS.icon(named: item.iconName) + Image.DS.icon(named: option.iconName) .resizable() .renderingMode(.template) - .foregroundStyle(item.tintColor) + .foregroundStyle(option.tintColor) .frame( width: .DS.Padding.medium, height: .DS.Padding.medium ) - Text(item.title) + Text(option.title) .font(.DS.Body.large) .foregroundStyle( Color.DS.Foreground.primary @@ -76,13 +61,66 @@ struct CommentModerationOptionsView: View { } } -private extension CommentModerationOptionsView { +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",