@@ -73,32 +73,44 @@ private struct CategoryTeaserBase: View {
7373 }
7474
7575
76+ @ViewBuilder
7677 private var background : some View {
77- Color ( . emptyWikiItemBackground)
78- . overlay {
79- if let imageRequest = categoryInfo. base. thumbnailImage {
80- LazyImage ( request: imageRequest, transaction: . init( animation: . linear) ) { imageState in
81- if let image = imageState. image {
82- image. resizable ( )
83- . aspectRatio ( contentMode: . fill)
84- . scaledToFill ( )
85- } else {
86- Color . clear
78+ let imageRequest = categoryInfo. base. thumbnailImage
79+
80+ ZStack {
81+ if let imageRequest {
82+ Color ( . emptyWikiItemBackground)
83+ . overlay {
84+ LazyImage ( request: imageRequest, transaction: . init( animation: . linear) ) { imageState in
85+ if let image = imageState. image {
86+ image. resizable ( )
87+ . aspectRatio ( contentMode: . fill)
88+ . scaledToFill ( )
89+ } else {
90+ Color . clear
91+ }
8792 }
8893 }
89- }
90- }
91- . overlay {
92- if categoryInfo. base. thumbnailImage != nil {
93- LinearGradient (
94- stops: [
95- . init( color: . init( white: 0 , opacity: 0 ) , location: 0 ) ,
96- . init( color: . init( white: 0 , opacity: 0.1 ) , location: 0.35 ) ,
97- . init( color: . init( white: 0 , opacity: 0.2 ) , location: 0.5 ) ,
98- . init( color: . init( white: 0 , opacity: 0.8 ) , location: 1 ) ,
99- ] , startPoint: . top, endPoint: . bottom)
100- }
94+ } else {
95+ ProceduralBackground ( categoryName: categoryInfo. base. commonsCategory ?? categoryInfo. base. wikidataId ?? " " )
96+ . blur ( radius: 5 )
97+ . clipped ( )
10198 }
99+ }
100+ . overlay {
101+ LinearGradient (
102+ stops: [
103+ . init( color: . init( white: 0 , opacity: 0 ) , location: 0 ) ,
104+ . init( color: . init( white: 0 , opacity: 0.1 ) , location: 0.35 ) ,
105+ . init( color: . init( white: 0 , opacity: 0.2 ) , location: 0.5 ) ,
106+ . init( color: . init( white: 0 , opacity: 0.8 ) , location: 1 ) ,
107+ ] , startPoint: . top, endPoint: . bottom)
108+ }
109+
110+
111+
112+
113+
102114 }
103115}
104116
0 commit comments