shop: add crateless items and options #143
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 13 KiB |
File diff suppressed because one or more lines are too long
|
@ -65,12 +65,13 @@ export function CratesToJSON(crates) {
|
|||
const crateOptions = useShopStore.getState().crate_options;
|
||||
const orderOptions = useShopStore.getState().order_options;
|
||||
const orderOptionsData = useShopStore.getState().order_options_data;
|
||||
const crateParams = useShopStore.getState().crateParams;
|
||||
return JSON.stringify({
|
||||
// additional fields can go here
|
||||
crates: Array.from(crates.map((crate, _i) => ({
|
||||
items: Array.from(crate.items.map((card, _) => ({
|
||||
pn: card.name_number,
|
||||
options: (card.options_data && card.options) ? FilterOptions(card.options, card.options_data) : null
|
||||
options: (card.options_data && card[crateParams(crate.crate_mode).options]) ? FilterOptions(card[crateParams(crate.crate_mode).options], card.options_data) : null
|
||||
}))),
|
||||
type: crate.crate_mode,
|
||||
options: FilterOptions(crateOptions, crate.options_data)
|
||||
|
|
|
@ -27,10 +27,9 @@ const hostname = (params) => {
|
|||
}
|
||||
const labels = text.split('.');
|
||||
for (const label of labels) {
|
||||
if (label.length < 1 || label.length > maxLabelLength) {
|
||||
return false;
|
||||
}
|
||||
if (!labelRegex.test(label)) {
|
||||
if (label.length < 1
|
||||
|| label.length > maxLabelLength
|
||||
|| !labelRegex.test(label)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ const shop_data = {
|
|||
},
|
||||
no_crate: {
|
||||
id: 'no_crate',
|
||||
name: 'Spare cards',
|
||||
name: 'Spare items',
|
||||
price: 0,
|
||||
hp: -1,
|
||||
warnings_disabled: true,
|
||||
|
@ -1443,6 +1443,26 @@ const shop_data = {
|
|||
hp: 8,
|
||||
},
|
||||
},
|
||||
'afws': {
|
||||
id: 'afws',
|
||||
name: 'Subscription',
|
||||
name_number: 'AFWS',
|
||||
name_codename: '',
|
||||
price: 800,
|
||||
image: '/images/shop/graphic-03_AFWS.svg',
|
||||
specs: [
|
||||
"Artiq Firmware Service for one variant for one year.",
|
||||
"Includes support at helpdesk.",
|
||||
"Included with purchase of any Carrier with no additional cost.",
|
||||
],
|
||||
crateless: true,
|
||||
crateless_options: [
|
||||
{type: "Line", args: {title: "Variant name", outvar: "variant_name", fallback: "",
|
||||
tip: "Variant name can be found on the sticker on top of the crate. If you don't have one, leave the preferred name here."}},
|
||||
],
|
||||
size: 'big',
|
||||
warnings: [],
|
||||
},
|
||||
},
|
||||
|
||||
columns: {
|
||||
|
@ -1500,6 +1520,7 @@ const shop_data = {
|
|||
'koster',
|
||||
'eem_pwr_mod',
|
||||
'kirdy',
|
||||
'afws',
|
||||
]}
|
||||
],
|
||||
},
|
||||
|
@ -1514,7 +1535,7 @@ const shop_data = {
|
|||
},
|
||||
{
|
||||
id: "spare",
|
||||
name: "Spare cards",
|
||||
name: "Spare items",
|
||||
crate_mode: "no_crate",
|
||||
items: [],
|
||||
warnings: [],
|
||||
|
|
Loading…
Reference in New Issue