@@ -22,9 +22,13 @@ struct AnalyticsProductCard: View {
2222 ///
2323 let isRedacted : Bool
2424
25- /// Indicates if there was an error loading the data for the card
25+ /// Indicates if there was an error loading stats part of the card.
2626 ///
27- let showSyncError : Bool
27+ let showStatsError : Bool
28+
29+ /// Indicates if there was an error loading items sold part of the card.
30+ ///
31+ let showItemsSoldError : Bool
2832
2933 var body : some View {
3034 VStack ( alignment: . leading) {
@@ -50,7 +54,7 @@ struct AnalyticsProductCard: View {
5054 . shimmering ( active: isRedacted)
5155 }
5256
53- if showSyncError {
57+ if showStatsError {
5458 Text ( Localization . noProducts)
5559 . foregroundColor ( Color ( . text) )
5660 . subheadlineStyle ( )
@@ -62,6 +66,14 @@ struct AnalyticsProductCard: View {
6266 . padding ( . top, Layout . columnSpacing)
6367 . redacted ( reason: isRedacted ? . placeholder : [ ] )
6468 . shimmering ( active: isRedacted)
69+
70+ if showItemsSoldError {
71+ Text ( Localization . noItemsSold)
72+ . foregroundColor ( Color ( . text) )
73+ . subheadlineStyle ( )
74+ . frame ( maxWidth: . infinity, alignment: . leading)
75+ . padding ( . top, Layout . columnSpacing)
76+ }
6577 }
6678 . padding ( Layout . cardPadding)
6779 }
@@ -74,6 +86,8 @@ private extension AnalyticsProductCard {
7486 static let itemsSold = NSLocalizedString ( " Items Sold " , comment: " Title for the items sold column on the products card on the analytics hub screen. " )
7587 static let noProducts = NSLocalizedString ( " Unable to load product analytics " ,
7688 comment: " Text displayed when there is an error loading product stats data. " )
89+ static let noItemsSold = NSLocalizedString ( " Unable to load product items sold analytics " ,
90+ comment: " Text displayed when there is an error loading items sold stats data. " )
7791 }
7892
7993 enum Layout {
@@ -98,15 +112,17 @@ struct AnalyticsProductCardPreviews: PreviewProvider {
98112 . init( imageURL: imageURL, name: " Bird Of Paradise " , details: " Net Sales: $23.50 " , value: " 2 " ) ,
99113 ] ,
100114 isRedacted: false ,
101- showSyncError: false )
115+ showStatsError: false ,
116+ showItemsSoldError: false )
102117 . previewLayout ( . sizeThatFits)
103118
104119 AnalyticsProductCard ( itemsSold: " - " ,
105120 delta: " 0% " ,
106121 deltaBackgroundColor: . withColorStudio( . gray, shade: . shade0) ,
107122 itemsSoldData: [ ] ,
108123 isRedacted: false ,
109- showSyncError: true )
124+ showStatsError: true ,
125+ showItemsSoldError: true )
110126 . previewLayout ( . sizeThatFits)
111127 . previewDisplayName ( " No data " )
112128 }
0 commit comments