spoko-design-system 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +2 -1
- package/.github/workflows/code-quality.yml +3 -3
- package/.github/workflows/sonarcloud.yml +1 -1
- package/.prettierrc +1 -0
- package/CHANGELOG.md +12 -0
- package/package.json +8 -2
- package/src/MyComponent.astro +1 -1
- package/src/components/Badge.vue +2 -2
- package/src/components/Badges.vue +17 -7
- package/src/components/Breadcrumbs.vue +47 -39
- package/src/components/Button.vue +31 -30
- package/src/components/ButtonCopy.astro +12 -17
- package/src/components/ButtonCopy.vue +26 -25
- package/src/components/Card.astro +4 -6
- package/src/components/Carousel.astro +4 -4
- package/src/components/Category/CategoriesCarousel.astro +75 -75
- package/src/components/Category/CategoryDetails.astro +75 -79
- package/src/components/Category/CategoryLink.vue +8 -12
- package/src/components/Category/CategorySidebarToggler.vue +2 -7
- package/src/components/Category/CategoryTile.astro +3 -3
- package/src/components/Category/CategoryViewToggler.astro +18 -18
- package/src/components/Category/SubCategoryLink.vue +13 -13
- package/src/components/Faq.astro +16 -17
- package/src/components/FaqItem.astro +27 -27
- package/src/components/FeaturesList.vue +19 -29
- package/src/components/FuckRussia.vue +40 -27
- package/src/components/HandDrive.astro +11 -15
- package/src/components/Header/Header.astro +165 -166
- package/src/components/Header/SkipToContent.astro +1 -1
- package/src/components/Headline.vue +44 -27
- package/src/components/Image.astro +5 -7
- package/src/components/Input.vue +143 -153
- package/src/components/Jumbotron/index.astro +143 -156
- package/src/components/Jumbotron/types.ts +28 -29
- package/src/components/Jumbotron/variants/Default.astro +44 -40
- package/src/components/Jumbotron/variants/Hero.astro +45 -53
- package/src/components/Jumbotron/variants/Post.astro +68 -64
- package/src/components/Jumbotron/variants/PostSplit.astro +89 -81
- package/src/components/Jumbotron.astro +12 -12
- package/src/components/LanguageSuggestion.astro +66 -69
- package/src/components/LeftSidebar.astro +10 -10
- package/src/components/MainColors.vue +2 -2
- package/src/components/MainInput.vue +6 -3
- package/src/components/Modal.astro +2 -2
- package/src/components/PartNumber.vue +2 -3
- package/src/components/Post/PostCategories.astro +2 -4
- package/src/components/Post/PostCategories.vue +2 -2
- package/src/components/PostHeader.astro +4 -6
- package/src/components/PrCode.vue +20 -19
- package/src/components/Product/ProductButton.vue +2 -5
- package/src/components/Product/ProductCarousel.astro +38 -27
- package/src/components/Product/ProductColors.vue +46 -42
- package/src/components/Product/ProductDetailName.vue +22 -22
- package/src/components/Product/ProductDetails.vue +115 -99
- package/src/components/Product/ProductDoc.vue +27 -25
- package/src/components/Product/ProductEngineType.vue +13 -10
- package/src/components/Product/ProductImage.astro +18 -19
- package/src/components/Product/ProductLink.vue +55 -58
- package/src/components/Product/ProductLinkInfo.astro +15 -18
- package/src/components/Product/ProductModel.vue +25 -24
- package/src/components/Product/ProductModels.vue +29 -33
- package/src/components/Product/ProductName.vue +15 -15
- package/src/components/Product/ProductNumber.astro +23 -31
- package/src/components/Product/ProductPositions.vue +32 -34
- package/src/components/ProductCarousel.astro +5 -5
- package/src/components/ProductCodes.vue +12 -14
- package/src/components/ProductDetailName.vue +18 -20
- package/src/components/ProductDetailsList.vue +48 -27
- package/src/components/Quote.vue +8 -6
- package/src/components/ReloadPrompt.astro +39 -47
- package/src/components/SlimBanner.vue +44 -19
- package/src/components/Table.vue +4 -6
- package/src/components/Translations.vue +17 -8
- package/src/components/flags/FlagPL.vue +4 -3
- package/src/components/flags/FlagUA.vue +2 -2
- package/src/components/layout/CallToAction.astro +17 -12
- package/src/components/layout/Container.astro +3 -1
- package/src/components/layout/Header.astro +12 -21
- package/src/config.ts +43 -43
- package/src/design.config.ts +63 -63
- package/src/env.d.ts +4 -4
- package/src/layouts/Layout.astro +10 -19
- package/src/layouts/MainLayout.astro +13 -19
- package/src/layouts/partials/FooterCommon.astro +2 -2
- package/src/layouts/partials/HeadCommon.astro +9 -9
- package/src/layouts/partials/HeadSEO.astro +12 -5
- package/src/pages/components/icons.astro +130 -121
- package/src/pages/core/shadows.astro +18 -11
- package/src/pages/index.astro +178 -75
- package/src/pwa.ts +4 -4
- package/src/styles/base/base.css +14 -19
- package/src/styles/base/grid.css +54 -58
- package/src/styles/base/typography.css +40 -40
- package/src/styles/content.css +25 -23
- package/src/styles/main.css +5 -6
- package/src/types/Product.ts +31 -31
- package/src/types/astro.d.ts +1 -1
- package/src/types/index.ts +234 -237
- package/src/utils/api/getCategories.ts +9 -9
- package/src/utils/category/getMainCategoryList.ts +22 -22
- package/src/utils/category/getSortedCategories.ts +7 -11
- package/src/utils/product/getPriceFormatted.ts +14 -11
- package/src/utils/product/getProductChecklist.ts +10 -11
- package/src/utils/product/useFormatProductNumber.ts +18 -9
- package/src/utils/seo/getShorterDescription.ts +6 -4
- package/src/utils/text/formatDate.ts +2 -3
- package/src/utils/text/formatLocaleNumber.ts +2 -2
- package/src/utils/text/formatPad.ts +2 -2
- package/src/utils/text/getNumberFormatted.ts +10 -10
- package/src/utils/text/getTranslatedLink.ts +3 -3
- package/src/utils/text.ts +11 -8
package/src/types/index.ts
CHANGED
|
@@ -1,237 +1,234 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
2
|
-
|
|
3
|
-
export interface Breadcrumb {
|
|
4
|
-
name: string
|
|
5
|
-
path: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
href: string
|
|
236
|
-
hreflang: 'en' | 'pl' | 'x-default'
|
|
237
|
-
}
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
export interface Breadcrumb {
|
|
4
|
+
name: string;
|
|
5
|
+
path: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface Navigation {
|
|
9
|
+
currentIndex: number | null;
|
|
10
|
+
prev: Product | null;
|
|
11
|
+
next: Product | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ResponsiveImage {
|
|
15
|
+
media: string;
|
|
16
|
+
src: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface SubCategory {
|
|
20
|
+
id: number;
|
|
21
|
+
name: string;
|
|
22
|
+
parent_id: number;
|
|
23
|
+
title?: string;
|
|
24
|
+
desc?: string;
|
|
25
|
+
slug: string;
|
|
26
|
+
sort: number | null;
|
|
27
|
+
description?: string;
|
|
28
|
+
hasProducts: boolean;
|
|
29
|
+
photo?: string | null;
|
|
30
|
+
children?: SubCategory[];
|
|
31
|
+
seoTitle?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Category {
|
|
35
|
+
id: number;
|
|
36
|
+
parent_id: number | null;
|
|
37
|
+
title?: string;
|
|
38
|
+
slug: string;
|
|
39
|
+
sort: number | null;
|
|
40
|
+
description?: string;
|
|
41
|
+
hasProducts: boolean;
|
|
42
|
+
photo?: string | null;
|
|
43
|
+
children: SubCategory[];
|
|
44
|
+
seoTitle?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface CatObject {
|
|
48
|
+
id: number;
|
|
49
|
+
name: string;
|
|
50
|
+
desc: string;
|
|
51
|
+
parent_id: number | null;
|
|
52
|
+
title?: string;
|
|
53
|
+
slug: string;
|
|
54
|
+
sort?: number | null;
|
|
55
|
+
description?: string;
|
|
56
|
+
hasProducts: boolean;
|
|
57
|
+
photo?: string | null;
|
|
58
|
+
children: SubCategory[];
|
|
59
|
+
seoTitle?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface CatLevels {
|
|
63
|
+
lvl1: Category | CatObject | null;
|
|
64
|
+
lvl2: CatObject | null;
|
|
65
|
+
lvl3: CatObject | null;
|
|
66
|
+
}
|
|
67
|
+
export interface CatInfo {
|
|
68
|
+
category: CatObject | null;
|
|
69
|
+
subcategory: CatObject | null;
|
|
70
|
+
subsubcategory: CatObject | null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface Replacement {
|
|
74
|
+
date: string | null;
|
|
75
|
+
info: string | null;
|
|
76
|
+
number: string;
|
|
77
|
+
prcodes: string[] | null;
|
|
78
|
+
manufacturer: string | null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface Color {
|
|
82
|
+
id: Number;
|
|
83
|
+
slug: String;
|
|
84
|
+
name?: String;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface DetailList {
|
|
88
|
+
name: string;
|
|
89
|
+
id: string;
|
|
90
|
+
value: string | number[] | Color[];
|
|
91
|
+
translated: boolean;
|
|
92
|
+
icon: boolean | null;
|
|
93
|
+
isArrayValue: boolean | null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface importantDetail {
|
|
97
|
+
name: string;
|
|
98
|
+
id: string;
|
|
99
|
+
value: string | number[];
|
|
100
|
+
translated: boolean;
|
|
101
|
+
icon: boolean | null;
|
|
102
|
+
isArrayValue: boolean | null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface Detail {
|
|
106
|
+
name: string;
|
|
107
|
+
value: string | number[];
|
|
108
|
+
translated: boolean;
|
|
109
|
+
icon: boolean | null;
|
|
110
|
+
isArrayValue: boolean | null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface DetailObject {
|
|
114
|
+
importantDetails: importantDetail[];
|
|
115
|
+
list: DetailList[];
|
|
116
|
+
checklist: DetailList[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface Image {
|
|
120
|
+
id: number;
|
|
121
|
+
path: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ImageType {
|
|
125
|
+
id: number;
|
|
126
|
+
path: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface ImageApi {
|
|
130
|
+
id: number;
|
|
131
|
+
slug: string;
|
|
132
|
+
path: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface ImageObject {
|
|
136
|
+
id: number;
|
|
137
|
+
path: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface ProductFile {
|
|
141
|
+
id: number;
|
|
142
|
+
name: string;
|
|
143
|
+
slug: string;
|
|
144
|
+
path: string;
|
|
145
|
+
type: number;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface Product {
|
|
149
|
+
id: number;
|
|
150
|
+
number: string;
|
|
151
|
+
info: string | null;
|
|
152
|
+
date: string | null;
|
|
153
|
+
prcodes: string[] | null;
|
|
154
|
+
engines: string[] | null;
|
|
155
|
+
engine_type: EngineType[] | null;
|
|
156
|
+
manufacturer: string[] | null;
|
|
157
|
+
manufacturer_number: string | null;
|
|
158
|
+
related: string[] | null;
|
|
159
|
+
color_ids: string[] | null;
|
|
160
|
+
position: string[] | null;
|
|
161
|
+
model: string[] | null;
|
|
162
|
+
replacement: Replacement[] | null;
|
|
163
|
+
details: DetailList[] | null;
|
|
164
|
+
photo: string;
|
|
165
|
+
files: number[] | null;
|
|
166
|
+
images: Image[] | null;
|
|
167
|
+
category_id: number;
|
|
168
|
+
hand_drive: number | null;
|
|
169
|
+
materials: MaterialsObject[] | null;
|
|
170
|
+
sort: number;
|
|
171
|
+
created_at: string;
|
|
172
|
+
updated_at: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface MaterialsObject {
|
|
176
|
+
name: string;
|
|
177
|
+
list: Material[];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface Product2FullSearch {
|
|
181
|
+
number: string;
|
|
182
|
+
category_id: number;
|
|
183
|
+
photo: string;
|
|
184
|
+
hand_drive: number | null;
|
|
185
|
+
manufacturer: string[] | null;
|
|
186
|
+
date: string | null;
|
|
187
|
+
text: string;
|
|
188
|
+
details: DetailList[] | null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface Link {
|
|
192
|
+
path: String;
|
|
193
|
+
name: String;
|
|
194
|
+
}
|
|
195
|
+
export interface EngineType {
|
|
196
|
+
id: Number;
|
|
197
|
+
type: String;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface Model {
|
|
201
|
+
id: Number;
|
|
202
|
+
slug: String;
|
|
203
|
+
sort: Number;
|
|
204
|
+
name: String;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface Material {
|
|
208
|
+
id: Number;
|
|
209
|
+
name: String;
|
|
210
|
+
slug: String;
|
|
211
|
+
sort: Number | null;
|
|
212
|
+
value?: String | null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface ProductImage {
|
|
216
|
+
title: string;
|
|
217
|
+
alt: string;
|
|
218
|
+
link: string;
|
|
219
|
+
style?: string;
|
|
220
|
+
__typename: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface Position {
|
|
224
|
+
id: number;
|
|
225
|
+
slug: string;
|
|
226
|
+
sort: number;
|
|
227
|
+
name: string;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface Hreflang {
|
|
231
|
+
rel: 'alternate' | 'canonical';
|
|
232
|
+
href: string;
|
|
233
|
+
hreflang: 'en' | 'pl' | 'x-default';
|
|
234
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getData } from
|
|
2
|
-
|
|
3
|
-
export const getApiCategories = getData('categories')
|
|
4
|
-
|
|
5
|
-
// const getApiCategories = async () => {
|
|
6
|
-
// return await getData('categories');
|
|
7
|
-
// }
|
|
8
|
-
|
|
9
|
-
export default getApiCategories;
|
|
1
|
+
import { getData } from '../getData';
|
|
2
|
+
|
|
3
|
+
export const getApiCategories = getData('categories');
|
|
4
|
+
|
|
5
|
+
// const getApiCategories = async () => {
|
|
6
|
+
// return await getData('categories');
|
|
7
|
+
// }
|
|
8
|
+
|
|
9
|
+
export default getApiCategories;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import type { CatObject
|
|
2
|
-
|
|
3
|
-
import { getApiCategories } from
|
|
4
|
-
import { getSortedCategories } from
|
|
5
|
-
|
|
6
|
-
// Retrieve main categories:
|
|
7
|
-
export const getMainCategoryList = async (locale: string = 'en'): Promise<CatObject[]> => {
|
|
8
|
-
// Fetch categories from API
|
|
9
|
-
const categories = await getApiCategories();
|
|
10
|
-
|
|
11
|
-
// Use category data directly (English only)
|
|
12
|
-
const processedCategories = categories.map(
|
|
13
|
-
return {
|
|
14
|
-
...category,
|
|
15
|
-
name: category.name || category.slug,
|
|
16
|
-
desc: category.desc || ''
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// Sort and return processed categories
|
|
21
|
-
return processedCategories.sort(getSortedCategories);
|
|
22
|
-
};
|
|
1
|
+
import type { CatObject } from '@types/index';
|
|
2
|
+
|
|
3
|
+
import { getApiCategories } from '@utils/api/getCategories';
|
|
4
|
+
import { getSortedCategories } from '@utils/category/getSortedCategories';
|
|
5
|
+
|
|
6
|
+
// Retrieve main categories:
|
|
7
|
+
export const getMainCategoryList = async (locale: string = 'en'): Promise<CatObject[]> => {
|
|
8
|
+
// Fetch categories from API
|
|
9
|
+
const categories = await getApiCategories();
|
|
10
|
+
|
|
11
|
+
// Use category data directly (English only)
|
|
12
|
+
const processedCategories = categories.map(category => {
|
|
13
|
+
return {
|
|
14
|
+
...category,
|
|
15
|
+
name: category.name || category.slug,
|
|
16
|
+
desc: category.desc || '',
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Sort and return processed categories
|
|
21
|
+
return processedCategories.sort(getSortedCategories);
|
|
22
|
+
};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import type { CatObject, SubCategory } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
else
|
|
10
|
-
return 0
|
|
11
|
-
}
|
|
1
|
+
import type { CatObject, SubCategory } from '@types/index';
|
|
2
|
+
|
|
3
|
+
// compareFn
|
|
4
|
+
export const getSortedCategories = (a: CatObject | SubCategory, b: CatObject | SubCategory) => {
|
|
5
|
+
if (a.sort && b.sort) return a.sort - b.sort;
|
|
6
|
+
else return 0;
|
|
7
|
+
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
export const getPriceFormatted
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return new Intl.NumberFormat('pl-PL', { style: 'currency', currency: 'PLN' }).format(product.price_pln)
|
|
8
|
-
}
|
|
9
|
-
return 'no price'
|
|
1
|
+
export const getPriceFormatted = (product: any) => {
|
|
2
|
+
// Default to EUR formatting for English-only design system
|
|
3
|
+
if (product.price_eur) {
|
|
4
|
+
return new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(
|
|
5
|
+
product.price_eur
|
|
6
|
+
);
|
|
10
7
|
}
|
|
11
|
-
|
|
8
|
+
if (product.price_pln) {
|
|
9
|
+
return new Intl.NumberFormat('pl-PL', { style: 'currency', currency: 'PLN' }).format(
|
|
10
|
+
product.price_pln
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return 'no price';
|
|
14
|
+
};
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
export default getPriceFormatted;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
+
export const getProductCheckList = productDetails => {
|
|
2
|
+
if (!productDetails || !productDetails.length) {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
1
5
|
|
|
2
|
-
|
|
3
|
-
if (!productDetails || !productDetails.length) {
|
|
4
|
-
return null;
|
|
5
|
-
}
|
|
6
|
+
const list = productDetails.filter(item => item.icon);
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
if (!list.length) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return list.map(detail => detail.value || 'Detail');
|
|
14
|
-
}
|
|
12
|
+
return list.map(detail => detail.value || 'Detail');
|
|
13
|
+
};
|
|
15
14
|
|
|
16
15
|
export default getProductCheckList;
|
|
@@ -11,32 +11,41 @@ interface FormattedNumbers {
|
|
|
11
11
|
dash: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export default function useFormatProductNumber(productNumber: string | null): {
|
|
14
|
+
export default function useFormatProductNumber(productNumber: string | null): {
|
|
15
|
+
formattedNumbers: FormattedNumbers | null;
|
|
16
|
+
} {
|
|
15
17
|
if (!productNumber) return { formattedNumbers: null };
|
|
16
18
|
|
|
17
19
|
const formatProductNumber = (number: string, separator: string): string => {
|
|
18
20
|
let formatted = number;
|
|
19
21
|
|
|
20
22
|
if (isLetter(number[0]) && !isLetter(number[1]) && number.length === 9) {
|
|
21
|
-
formatted = formatted.replace(
|
|
23
|
+
formatted = formatted.replace(
|
|
24
|
+
LIQUIDS_PATTERN,
|
|
25
|
+
`$1${separator}$2${separator}$3${separator}$4`
|
|
26
|
+
);
|
|
22
27
|
} else if (number.length >= 13) {
|
|
23
|
-
formatted = formatted.replace(
|
|
28
|
+
formatted = formatted.replace(
|
|
29
|
+
WHEELS_EMBLEMS_PATTERN,
|
|
30
|
+
`$1${separator}$2${separator}$3${separator}$4${separator}$5`
|
|
31
|
+
);
|
|
24
32
|
} else if (number.length > 12) {
|
|
25
|
-
formatted = formatted.replace(
|
|
33
|
+
formatted = formatted.replace(
|
|
34
|
+
ACCESSORIES_MATS_PATTERN,
|
|
35
|
+
`$1${separator}$2${separator}$3${separator}$4${separator}$5`
|
|
36
|
+
);
|
|
26
37
|
} else {
|
|
27
38
|
formatted = formatted.replace(OTHER_PARTS_PATTERN, `$1${separator}`);
|
|
28
39
|
}
|
|
29
40
|
|
|
30
|
-
return formatted
|
|
31
|
-
.replace(' ', separator)
|
|
32
|
-
.replace(/[^a-zA-Z0-9]$/, ''); // Remove the end trailing separator
|
|
41
|
+
return formatted.replace(' ', separator).replace(/[^a-zA-Z0-9]$/, ''); // Remove the end trailing separator
|
|
33
42
|
};
|
|
34
43
|
|
|
35
44
|
const formattedNumbers: FormattedNumbers = {
|
|
36
45
|
standard: formatProductNumber(productNumber, '\u00A0'),
|
|
37
46
|
dot: formatProductNumber(productNumber, '.'),
|
|
38
|
-
dash: formatProductNumber(productNumber, '-')
|
|
47
|
+
dash: formatProductNumber(productNumber, '-'),
|
|
39
48
|
};
|
|
40
49
|
|
|
41
50
|
return { formattedNumbers };
|
|
42
|
-
}
|
|
51
|
+
}
|