Skip to content

Commit 2cbacbb

Browse files
committed
Adds unable to ftch view
1 parent 6ce1b2d commit 2cbacbb

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

WooCommerce/StoreWidgets/StoreInfoWidget.swift

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,29 @@ private struct NotLoggedInView: View {
126126
}
127127
}
128128

129+
private struct UnableToFetchView: View {
130+
var body: some View {
131+
ZStack {
132+
// Background
133+
Color(.brand)
134+
135+
VStack {
136+
Image(uiImage: .wooLogoWhite)
137+
.resizable()
138+
.frame(width: Layout.logoSize.width, height: Layout.logoSize.height)
139+
140+
Spacer()
141+
142+
Text(Localization.unableToFetch)
143+
.statTextStyle()
144+
145+
Spacer()
146+
}
147+
.padding(.vertical, Layout.cardVerticalPadding)
148+
}
149+
}
150+
}
151+
129152
// MARK: Constants
130153

131154
/// Constants definition
@@ -160,6 +183,20 @@ private extension NotLoggedInView {
160183
}
161184
}
162185

186+
/// Constants definition
187+
///
188+
private extension UnableToFetchView {
189+
enum Localization {
190+
static let unableToFetch = NSLocalizedString("Unable to fetch today's stats",
191+
comment: "Title label when the widget can't fetch data.")
192+
}
193+
194+
enum Layout {
195+
static let cardVerticalPadding = 22.0
196+
static let logoSize = CGSize(width: 24, height: 16)
197+
}
198+
}
199+
163200
// MARK: Previews
164201

165202
struct StoreWidgets_Previews: PreviewProvider {
@@ -176,5 +213,8 @@ struct StoreWidgets_Previews: PreviewProvider {
176213

177214
NotLoggedInView()
178215
.previewContext(WidgetPreviewContext(family: .systemMedium))
216+
217+
UnableToFetchView()
218+
.previewContext(WidgetPreviewContext(family: .systemMedium))
179219
}
180220
}

0 commit comments

Comments
 (0)