Skip to content

Commit

Permalink
Merge pull request #603 from evershopcommerce/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
treoden authored Aug 25, 2024
2 parents 6bd5d1b + 33629b2 commit 684d16d
Show file tree
Hide file tree
Showing 10 changed files with 192 additions and 62 deletions.
4 changes: 2 additions & 2 deletions packages/evershop/bin/lib/addDefaultMiddlewareFuncs.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ exports.addDefaultMiddlewareFuncs = function addDefaultMiddlewareFuncs(
}),
secret: cookieSecret,
cookie: {
maxAge: 24 * 60 * 60 * 1000
maxAge: getConfig('system.session.maxAge', 24 * 60 * 60 * 1000)
},
resave: getConfig('system.session.resave', false),
saveUninitialized: true
saveUninitialized: getConfig('system.session.saveUninitialized', true)
};

if (isProductionMode()) {
Expand Down
1 change: 1 addition & 0 deletions packages/evershop/src/components/common/Notification.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
width: 320px;
box-sizing: border-box;
color: #fff;
background-color: transparent;
}
.Toastify__toast-container--top-left {
top: 1em;
Expand Down

Large diffs are not rendered by default.

Empty file.
3 changes: 3 additions & 0 deletions packages/evershop/src/modules/base/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ module.exports = async () => {
cookieName: {
type: 'string'
},
maxAge: {
type: 'number'
},
reSave: {
type: 'boolean'
},
Expand Down
36 changes: 36 additions & 0 deletions packages/evershop/src/modules/cms/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,42 @@ module.exports = () => {
enum: ['local']
}
}
},
widgets: {
type: 'object',
patternProperties: {
'^[a-zA-Z_]+$': {
type: 'object',
properties: {
setting_component: {
type: 'string'
},
component: {
type: 'string'
},
name: {
type: 'string'
},
description: {
type: 'string'
},
default_settings: {
type: 'object'
},
enabled: {
type: 'boolean'
}
},
required: [
'setting_component',
'component',
'name',
'description',
'enabled'
],
additionalProperties: false
}
}
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-webkit-transform: translate3d(0, 0, 9999px);
position: fixed;
width: 380px;
background-color: #fff;
background-color: transparent;
}
.Toastify__toast-container--top-left {
top: 1em;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ export default function NewWidgetButton({ widgetTypes }) {
title: 'Cancel',
onAction: closeAlert,
variant: 'primary'
},
secondaryAction: {
title: 'Disable',
onAction: async () => {},
variant: 'critical',
isLoading: false
}
});
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
transform: translate3d(0, 0, 9999px);
position: fixed;
width: 380px;
background-color: #fff;
background-color: transparent;
}
.Toastify__toast-container--top-left {
top: 1em;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Field } from '@components/common/form/Field';
import { Form } from '@components/common/form/Form';
import { Card } from '@components/admin/cms/Card';
import SettingMenu from '@components/admin/setting/SettingMenu';
import Area from '@components/common/Area';

const ProvincesQuery = `
query Province($countries: [String]) {
Expand Down Expand Up @@ -182,6 +183,46 @@ Currency.defaultProps = {
fieldName: 'storeCurrency'
};

function StorePhoneNumber({ storePhoneNumber }) {
return <div>
<Field
name="storePhoneNumber"
label="Store Phone Number"
placeholder="Store Phone Number"
value={storePhoneNumber}
type="text"
/>
</div>
}

StorePhoneNumber.propTypes = {
storePhoneNumber: PropTypes.string
};

StorePhoneNumber.defaultProps = {
storePhoneNumber: ''
};

function StoreEmail({ storeEmail }) {
return <div>
<Field
name="storeEmail"
label="Store Email"
placeholder="Store Email"
value={storeEmail}
type="text"
/>
</div>
}

StoreEmail.propTypes = {
storeEmail: PropTypes.string
};

StoreEmail.defaultProps = {
storeEmail: ''
};

export default function StoreSetting({
saveSettingApi,
setting: {
Expand Down Expand Up @@ -226,42 +267,64 @@ export default function StoreSetting({
>
<Card>
<Card.Session title="Store Information">
<Field
name="storeName"
label="Store Name"
placeholder="Store Name"
value={storeName}
type="text"
/>
<Field
name="storeDescription"
label="Store Description"
placeholder="Store Description"
value={storeDescription}
type="textarea"
<Area
id="storeInfoSetting"
coreComponents={[
{
component: {
default: Field
},
props: {
name: 'storeName',
label: 'Store Name',
placeholder: 'Store Name',
value: storeName,
type: 'text'
},
sortOrder: 10
},
{
component: {
default: Field
},
props: {
name: 'storeDescription',
label: 'Store Description',
placeholder: 'Store Description',
value: storeDescription,
type: 'textarea'
},
sortOrder: 20
}
]}
noOuter
/>
</Card.Session>
<Card.Session title="Contact Information">
<div className="grid grid-cols-2 gap-8 mt-8">
<div>
<Field
name="storePhoneNumber"
label="Store Phone Number"
value={storePhoneNumber}
placeholder="Store Phone Number"
type="text"
/>
</div>
<div>
<Field
name="storeEmail"
label="Store Email"
value={storeEmail}
placeholder="Store Email"
type="text"
/>
</div>
</div>
<Area
id="storeContactSetting"
coreComponents={[
{
component: {
default: StorePhoneNumber
},
props: {
storePhoneNumber
},
sortOrder: 10
},
{
component: {
default: StoreEmail
},
props: {
storeEmail
},
sortOrder: 20
}
]}
className="grid grid-cols-2 gap-8 mt-8"
/>
</Card.Session>
<Card.Session title="Address">
<Country
Expand Down

0 comments on commit 684d16d

Please sign in to comment.