tee3apps-cms-sdk-react 0.0.33 → 0.0.34

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.
@@ -77,13 +77,17 @@ const ProductListViewTwo = (props: any) => {
77
77
  const data = props.props || props;
78
78
  const slug = data?.code; // Using code instead of slug since slug doesn't exist in your data
79
79
 
80
+ const resolvePrice = (priceData: any): number => {
81
+ if (!priceData) return 0;
82
+ if (Array.isArray(priceData)) {
83
+ return getPriceFromPricingArray(priceData);
84
+ }
85
+ return getPriceValue(priceData);
86
+ };
87
+
80
88
  // Updated price extraction to use pricing object only - same logic as GroupProductComponent
81
- const mrpPrice = data.pricing?.mrp ? getPriceFromPricingArray(data.pricing.mrp) : 0;
82
- const finalSellingPrice = data.pricing?.nlcPrice
83
- ? getPriceFromPricingArray(data.pricing.nlcPrice)
84
- : data.pricing?.costPrice
85
- ? getPriceFromPricingArray(data.pricing.costPrice)
86
- : 0;
89
+ const mrpPrice = resolvePrice(data.pricing?.mrp);
90
+ const finalSellingPrice = resolvePrice(data.pricing?.costPrice);
87
91
 
88
92
  const calculateDiscount = () => {
89
93
  if (!finalSellingPrice || !mrpPrice || mrpPrice <= finalSellingPrice) return null;
@@ -106,10 +110,40 @@ const ProductListViewTwo = (props: any) => {
106
110
  const cardColor = props.cardColor;
107
111
 
108
112
  return (
109
- <div className="card" style={{ backgroundColor: cardColor }}>
113
+ <div className="card" style={{
114
+ backgroundColor: cardColor,
115
+ position: 'relative',
116
+ width: props.layout === 'NONE' ? '400px' : '100%',
117
+ minWidth: props.layout === 'NONE' ? '400px' : 'unset',
118
+ maxWidth: props.layout === 'NONE' ? '420px' : '100%'
119
+ }}>
110
120
  <a href={`/${slug}`} target={target} rel="noopener noreferrer">
111
121
  <div className="card_content">
112
-
122
+ {(Number(data?.starrating) > 0 || Number(data?.startRatingCount) > 0) && (
123
+ <div className="review_container" style={{
124
+ position: 'absolute',
125
+ top: '10px',
126
+ right: '10px',
127
+ zIndex: 2,
128
+ backgroundColor: 'rgba(255,255,255,0.8)',
129
+ padding: '4px 8px',
130
+ borderRadius: '20px',
131
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)'
132
+ }}>
133
+ <div className="rating" style={{ display: 'flex', alignItems: 'center', gap: '3px' }}>
134
+ <svg
135
+ xmlns="http://www.w3.org/2000/svg"
136
+ viewBox="0 0 20 20"
137
+ width="12"
138
+ height="12"
139
+ fill="#f46b27"
140
+ >
141
+ <path d="M10 15l-5.878 3.09 1.122-6.545L.488 6.91l6.562-.955L10 0l2.95 5.955 6.562.955-4.756 4.635 1.122 6.545z" />
142
+ </svg>
143
+ <span className="rating_value" style={{ fontSize: '11px', fontWeight: '600' }}>{data?.starrating}</span>
144
+ </div>
145
+ </div>
146
+ )}
113
147
 
114
148
  <div className="card_middle">
115
149
  <img
@@ -119,40 +153,31 @@ const ProductListViewTwo = (props: any) => {
119
153
  />
120
154
 
121
155
  </div>
122
- <div className="card_top">
123
- <h3 className="product_name">{data?.name?.all || data?.name}</h3>
124
- <h5 className="product_option">{data?.code}</h5>
156
+ <div className="card_top" style={{ textAlign: 'center', width: '100%', marginBottom: '8px' }}>
157
+ <h3 className="product_name" style={{ margin: 0 }}>{data?.name?.all || data?.name}</h3>
158
+ <h5 className="product_option" style={{ margin: '4px 0 0 0' }}>{data?.code}</h5>
125
159
  </div>
126
- <div className="card_bottom">
160
+ <div className="card_bottom" style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', width: '100%' }}>
127
161
  <div className="price_container">
128
162
  {finalSellingPrice !== 0 && (
129
- <>
130
- <div className="price_row">
131
- <h4 className="selling_price">{finalSellingPrice.toLocaleString("en-IN")}</h4>
163
+ <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', textAlign: 'center' }}>
164
+ <div className="price_row" style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
165
+ <h4 className="selling_price" style={{ margin: 0 }}>SP: {finalSellingPrice.toLocaleString("en-IN")}</h4>
166
+ {mrpPrice > finalSellingPrice && (
167
+ <p className="mrp_price" style={{ fontSize: '11px', color: '#666', textDecoration: 'line-through', margin: '2px 0' }}>
168
+ MRP: {mrpPrice.toLocaleString("en-IN")}
169
+ </p>
170
+ )}
132
171
  {discount !== null && discount > 0 && (
133
- <span className="discounts">{discount}% OFF</span>
172
+ <span className="discounts" style={{ fontSize: '11px', color: '#28a745', fontWeight: 'bold' }}>{discount}% OFF</span>
134
173
  )}
135
174
  </div>
136
175
  {mrpPrice > finalSellingPrice && (
137
- <p className="save_amount">Save {(mrpPrice - finalSellingPrice).toLocaleString("en-IN")}</p>
176
+ <p className="save_amount" style={{ margin: '2px 0 0 0', fontSize: '11px', fontWeight: '500' }}>Save {(mrpPrice - finalSellingPrice).toLocaleString("en-IN")}</p>
138
177
  )}
139
- </>
178
+ </div>
140
179
  )}
141
180
  </div>
142
-
143
- <div className="review_container">
144
- <div className="rating">
145
- <svg
146
- xmlns="http://www.w3.org/2000/svg"
147
- viewBox="0 0 20 20"
148
- width="14"
149
- height="14"
150
- >
151
- <path d="M10 15l-5.878 3.09 1.122-6.545L.488 6.91l6.562-.955L10 0l2.95 5.955 6.562.955-4.756 4.635 1.122 6.545z" />
152
- </svg>
153
- <span className="rating_value">{data?.starrating}</span>
154
- </div>
155
- </div>
156
181
  </div>
157
182
  </div>
158
183
  </a>
@@ -27,10 +27,9 @@ const TextComponent: React.FC<{ props: ComponentProps }> = ({ props }) => {
27
27
  color: style?.fontColor || '#000',
28
28
  textAlign: textAlignment,
29
29
  fontFamily: style?.fontFamily || 'inherit',
30
- height: height || (hasDimensions ? currentMode.height : 'auto'),
31
- width: hasDimensions ? currentMode.width : '100%',
30
+ height: height || 'auto',
31
+ width: '100%',
32
32
  margin: 0,
33
- // padding: 0,
34
33
  wordWrap: "break-word",
35
34
  overflowWrap: "break-word",
36
35
  maxWidth: "100%",