Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #361

Merged
merged 7 commits into from
Oct 13, 2023
Merged

Dev #361

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 35 additions & 22 deletions packages/evershop/src/components/common/ProductNoThumbnail.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
import React from 'react';
import PropTypes from 'prop-types';

const ProductNoThumbnail = ({ width, height }) => (
<svg
width={width || 100}
height={height || 100}
viewBox="0 0 251 276"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M62.2402 34.2864L0.329313 68.5728L0.131725 137.524L0 206.538L62.3061 240.95C96.5546 259.858 124.81 275.363 125.139 275.363C125.468 275.363 142.527 266.035 163.142 254.69C183.691 243.282 211.748 227.841 225.448 220.277L250.278 206.538V191.789V176.978L248.829 177.735C247.973 178.176 219.915 193.617 186.457 212.147C152.933 230.677 125.205 245.677 124.81 245.614C124.349 245.488 102.219 233.387 75.5444 218.639L27.0037 191.853V137.65V83.447L48.9359 71.346C60.9229 64.7282 82.9211 52.6271 97.7401 44.4337C112.493 36.2402 124.876 29.5594 125.139 29.5594C125.402 29.5594 142.593 38.9504 163.339 50.4212L223.801 83.447L233.337 78.0776L250.278 68.5728L223.801 54.1397C202.857 42.2908 125.6 -0.0629802 124.941 4.62725e-05C124.546 4.62725e-05 96.2912 15.4415 62.2402 34.2864Z"
fill="#BBBBBB"
/>
<path
d="M188.367 102.796C154.514 121.515 126.325 137.019 125.732 137.146C125.073 137.335 108.542 128.511 87.0045 116.662L49.397 95.8632V110.8L49.4628 125.675L86.0166 145.843C106.105 156.936 123.229 166.264 124.085 166.579C125.402 167.02 134.623 162.167 187.445 132.986C221.43 114.141 249.488 98.5734 249.817 98.3213C250.08 98.0691 250.212 91.3253 250.146 83.321L249.949 68.7618L188.367 102.796Z"
fill="#BBBBBB"
/>
<path
d="M243.362 126.557C239.74 128.511 211.814 143.953 181.254 160.844C150.694 177.735 125.468 191.537 125.139 191.537C124.81 191.537 107.751 182.21 87.1363 170.865L49.7263 150.192L49.5288 164.688C49.397 175.781 49.5946 179.373 50.1874 179.941C51.4388 181.012 124.349 221.16 125.139 221.16C125.798 221.16 248.763 153.406 249.817 152.524C250.08 152.272 250.212 145.528 250.146 137.461L249.949 122.902L243.362 126.557Z"
fill="#BBBBBB"
/>
</svg>
);
function ProductNoThumbnail({ width, height }) {
return (
<svg
width={width || 100}
height={height || 100}
viewBox="0 0 251 276"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M62.2402 34.2864L0.329313 68.5728L0.131725 137.524L0 206.538L62.3061 240.95C96.5546 259.858 124.81 275.363 125.139 275.363C125.468 275.363 142.527 266.035 163.142 254.69C183.691 243.282 211.748 227.841 225.448 220.277L250.278 206.538V191.789V176.978L248.829 177.735C247.973 178.176 219.915 193.617 186.457 212.147C152.933 230.677 125.205 245.677 124.81 245.614C124.349 245.488 102.219 233.387 75.5444 218.639L27.0037 191.853V137.65V83.447L48.9359 71.346C60.9229 64.7282 82.9211 52.6271 97.7401 44.4337C112.493 36.2402 124.876 29.5594 125.139 29.5594C125.402 29.5594 142.593 38.9504 163.339 50.4212L223.801 83.447L233.337 78.0776L250.278 68.5728L223.801 54.1397C202.857 42.2908 125.6 -0.0629802 124.941 4.62725e-05C124.546 4.62725e-05 96.2912 15.4415 62.2402 34.2864Z"
fill="#BBBBBB"
/>
<path
d="M188.367 102.796C154.514 121.515 126.325 137.019 125.732 137.146C125.073 137.335 108.542 128.511 87.0045 116.662L49.397 95.8632V110.8L49.4628 125.675L86.0166 145.843C106.105 156.936 123.229 166.264 124.085 166.579C125.402 167.02 134.623 162.167 187.445 132.986C221.43 114.141 249.488 98.5734 249.817 98.3213C250.08 98.0691 250.212 91.3253 250.146 83.321L249.949 68.7618L188.367 102.796Z"
fill="#BBBBBB"
/>
<path
d="M243.362 126.557C239.74 128.511 211.814 143.953 181.254 160.844C150.694 177.735 125.468 191.537 125.139 191.537C124.81 191.537 107.751 182.21 87.1363 170.865L49.7263 150.192L49.5288 164.688C49.397 175.781 49.5946 179.373 50.1874 179.941C51.4388 181.012 124.349 221.16 125.139 221.16C125.798 221.16 248.763 153.406 249.817 152.524C250.08 152.272 250.212 145.528 250.146 137.461L249.949 122.902L243.362 126.557Z"
fill="#BBBBBB"
/>
</svg>
);
}

ProductNoThumbnail.propTypes = {
width: PropTypes.number,
height: PropTypes.number
};

ProductNoThumbnail.defaultProps = {
width: 100,
height: 100
};

export default ProductNoThumbnail;
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import React from 'react';
import { toast } from 'react-toastify';
import { useAppDispatch } from '@components/common/context/app';
import { _ } from '@evershop/evershop/src/lib/locale/translate';
import ProductNoThumbnail from '@components/common/ProductNoThumbnail';
import { ItemOptions } from './ItemOptions';
import { ItemVariantOptions } from './ItemVariantOptions';
import './Items.scss';
import ProductNoThumbnail from '@components/common/ProductNoThumbnail';

function Items({ items, setting: { displayCheckoutPriceIncludeTax } }) {
const AppContextDispatch = useAppDispatch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function Items({ items, displayCheckoutPriceIncludeTax }) {
<img src={item.thumbnail} alt={item.productName} />
)}
{!item.thumbnail && (
<ProductNoThumbnail width={100} height={100} />
<ProductNoThumbnail width={45} height={45} />
)}
</div>
<span className="qty">{item.qty}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Items({ items, displayCheckoutPriceIncludeTax }) {
<img src={item.thumbnail} alt={item.productName} />
)}
{!item.thumbnail && (
<ProductNoThumbnail width={100} height={100} />
<ProductNoThumbnail width={45} height={45} />
)}
</div>
<span className="qty">{item.qty}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const path = require('path');
const { select } = require('@evershop/postgres-query-builder');
const uniqid = require('uniqid');
const { CONSTANTS } = require('@evershop/evershop/src/lib/helpers');
const { getConfig } = require('@evershop/evershop/src/lib/util/getConfig');

function getUrls(image) {
const thumbVersion = image.replace(/.([^.]*)$/, '-thumb.$1');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ const {
} = require('@evershop/evershop/src/lib/util/httpStatus');
const { default: axios } = require('axios');
const { select } = require('@evershop/postgres-query-builder');
const {
translate
} = require('@evershop/evershop/src/lib/locale/translate/translate');
const { toPrice } = require('../../services/toPrice');

// eslint-disable-next-line no-unused-vars
Expand Down
9 changes: 2 additions & 7 deletions packages/evershop/src/modules/checkout/services/cart/Item.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const config = require('config');
const { select } = require('@evershop/postgres-query-builder');
const fs = require('fs');
const path = require('path');
Expand Down Expand Up @@ -123,13 +122,9 @@ module.exports.Item = class Item extends DataObject {
);
return fs.existsSync(path.join(CONSTANTS.MEDIAPATH, thumb))
? `/assets${thumb}`
: `/assets/theme/frontStore${config.get(
'catalog.product.image.placeHolder'
)}`;
: null;
} else {
return `/assets/theme/frontStore${config.get(
'catalog.product.image.placeHolder'
)}`;
return null;
}
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import { XAxis, YAxis, Tooltip, AreaChart, Area } from 'recharts';
import { XAxis, YAxis, Tooltip, ResponsiveContainer, AreaChart, Area } from 'recharts';
import React, { useState, useEffect } from 'react';
import { toast } from 'react-toastify';
import { Card } from '@components/admin/cms/Card';
Expand Down Expand Up @@ -58,36 +58,35 @@ export default function SaleStatistic({ api }) {
>
<Card.Session>
{data.length === 0 ? null : (
<AreaChart
width={580}
height={300}
data={data}
margin={{
top: 5,
right: 0,
left: -25,
bottom: 5
}}
id="asdasd"
>
<XAxis dataKey="time" />
<YAxis />
<Tooltip />
<Area
type="monotone"
dataKey="value"
stackId="1"
stroke="#8884d8"
fill="#8884d8"
/>
<Area
type="monotone"
dataKey="count"
stackId="1"
stroke="#82ca9d"
fill="#82ca9d"
/>
</AreaChart>
<ResponsiveContainer width="100%" height={300}>
<AreaChart
data={data}
margin={{
top: 5,
right: 0,
left: -25,
bottom: 5
}}
>
<XAxis dataKey="time" />
<YAxis />
<Tooltip />
<Area
type="monotone"
dataKey="value"
stackId="1"
stroke="#8884d8"
fill="#8884d8"
/>
<Area
type="monotone"
dataKey="count"
stackId="1"
stroke="#82ca9d"
fill="#82ca9d"
/>
</AreaChart>
</ResponsiveContainer>
)}
</Card.Session>
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ module.exports = async (request, response, stack, next) => {
address.admin_area_1 = shippingAddress.province.split('-').pop();
}
orderData.purchase_units[0].shipping = {
address: address
address
};
} else {
// This is digital order, no shipping address
Expand Down Expand Up @@ -141,7 +141,7 @@ module.exports = async (request, response, stack, next) => {
address.admin_area_1 = billingAddress.province.split('-').pop();
}
orderData.purchase_units[0].billing = {
address: address
address
};
}
// Call PayPal API to create order using axios
Expand Down
Loading