Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
fix: downgrad stylelint
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanfrede committed May 24, 2020
1 parent 4de5862 commit 9efd78b
Show file tree
Hide file tree
Showing 9 changed files with 1,265 additions and 1,189 deletions.
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,31 @@
"format:eslint": "eslint --ext .js,.html packages/ --fix",
"format:prettier": "prettier \"packages/**/*.js\" --write",
"format:stylelint": "stylelint packages/**/*.js packages/**/*.html --fix",
"start": "nodemon --watch webpack.config.js --exec \"webpack-dev-server --host 0.0.0.0 --env development\"",
"start": "nodemon --watch webpack.config.js --exec \"webpack-dev-server --env development\"",
"start:build": "serve --no-clipboard --listen 8080 dist",
"validate": "yarn run lint",
"setup": "yarn install && yarn run validate"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/core": "^7.9.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.8.3",
"@babel/plugin-transform-template-literals": "^7.8.3",
"@babel/preset-env": "^7.9.5",
"@babel/preset-env": "^7.9.6",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-bundled-import-meta": "^0.3.2",
"babel-plugin-template-html-minifier": "^4.1.0",
"browserslist": "^4.11.1",
"browserslist": "^4.12.0",
"case-sensitive-paths-webpack-plugin": "^2.3.0",
"clean-webpack-plugin": "^3.0.0",
"css-loader": "^3.5.2",
"css-loader": "^3.5.3",
"cssnano": "^4.1.10",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-html": "^6.0.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-lit": "^1.2.0",
Expand All @@ -72,31 +72,31 @@
"fbjs-scripts": "^1.2.0",
"friendly-errors-webpack-plugin": "^1.7.0",
"git-revision-webpack-plugin": "^3.0.6",
"html-webpack-plugin": "^4.2.0",
"html-webpack-plugin": "^4.3.0",
"husky": "^4.2.5",
"lint-staged": "^10.1.5",
"node-sass": "^4.13.1",
"nodemon": "^2.0.3",
"lint-staged": "^10.2.6",
"node-sass": "^4.14.1",
"nodemon": "^2.0.4",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"postcss-loader": "^3.0.0",
"postcss-normalize": "^9.0.0",
"postcss-preset-env": "^6.7.0",
"prettier": "^2.0.4",
"prettier": "^2.0.5",
"sass-loader": "^8.0.2",
"serve": "^11.3.0",
"style-loader": "^1.1.4",
"stylelint": "^13.3.2",
"serve": "^11.3.1",
"style-loader": "^1.2.1",
"stylelint": "13.3.0",
"stylelint-config-prettier": "^8.0.1",
"stylelint-config-recommended": "^3.0.0",
"stylelint-order": "^4.0.0",
"svg-inline-loader": "^0.8.2",
"terser-webpack-plugin": "^2.3.5",
"terser-webpack-plugin": "^3.0.1",
"url-loader": "^4.1.0",
"webpack": "^4.42.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^4.2.2",
"workbox-webpack-plugin": "^5.1.2"
"workbox-webpack-plugin": "^5.1.3"
},
"dependencies": {
"dotenv": "^8.2.0"
Expand Down
110 changes: 93 additions & 17 deletions packages/hws-lsa/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,36 +420,118 @@ export const fetchInnerLengths = ({ build, id, rewrite = true }) => {
const lengths = {};

items.forEach((item) => {
const [{ value: model }] = item.specifications.filter(
(specification) => specification.name === 'Serie',
const buildArr = item.specifications.filter(
(specification) => specification.name === 'Bauart',
);

const [{ value: build }] = item.specifications.filter(
(specification) => specification.name === 'Bauart',
const [{ value: build }] = buildArr.length
? buildArr
: [{ value: '' }];

const designArr = item.specifications.filter(
(specification) => specification.name === 'Ausführung',
);

const [{ value: design }] = designArr.length
? designArr
: [{ value: '' }];

const keyArr = item.specifications.filter(
(specification) => specification.name === 'Schlüssel',
);

const [{ value: key }] = keyArr.length ? keyArr : [{ value: '' }];

const lengthCArr = item.specifications.filter(
(specification) => specification.name === 'Länge C',
);

const [{ value: lengthC }] = lengthCArr.length
? lengthCArr
: [{ value: 0 }];

const lengthDArr = item.specifications.filter(
(specification) => specification.name === 'Länge D',
);

const [{ value: lengthD }] = lengthDArr.length
? lengthDArr
: [{ value: 0 }];

const materialArr = item.specifications.filter(
(specification) => specification.name === 'Material',
);

const [{ value: length }] = item.specifications.filter(
const [{ value: material }] = materialArr.length
? materialArr
: [{ value: '' }];

const modelArr = item.specifications.filter(
(specification) => specification.name === 'Serie',
);

const [{ value: model }] = modelArr.length
? modelArr
: [{ value: '' }];

const partialLengthArr = item.specifications.filter(
(specification) => specification.name === 'Teillänge (C+D)',
);

const [inner, outer] = length
.split('+')
.map((str) => Number(str.trim().replace('mm', '')));
const [{ value: partialLength }] = partialLengthArr.length
? partialLengthArr
: [{ value: '' }];

const safetyArr = item.specifications.filter(
(specification) => specification.name === 'Sicherheit',
);

const [{ value: safety }] = safetyArr.length
? safetyArr
: [{ value: '' }];

const totalLengthArr = item.specifications.filter(
(specification) => specification.name === 'Gesamtlänge (L)',
);

const [{ value: totalLength }] = totalLengthArr.length
? totalLengthArr
: [{ value: '' }];

const inner = Number(lengthC);
const outer = Number(lengthD);

if (lengths[inner]) {
lengths[inner].push(outer);
} else {
lengths[inner] = [outer];
}

details[slugify(`${model}-${build}-${inner}-${outer}`)] = {
let price = void 0;

if (item.price) {
price = new Intl.NumberFormat('de-DE', {
style: 'currency',
currency: item.price.currency,
}).format(item.price.sales_price_4 * (1 - item.price.discount));
}

const specs = {
design,
key,
material,
name: item.name,
price: item.price ?? undefined,
partialLength,
price,
reference: item.reference,
safety,
subject: item.subject,
text: item.text,
totalLength,
};

details[slugify(`${model}-${build}-${inner}-${outer}`)] = specs;

if (
build === 'Doppelzylinder' ||
build === 'Doppelzylinder mit Not- und Gefahrenfunktion'
Expand All @@ -462,13 +544,7 @@ export const fetchInnerLengths = ({ build, id, rewrite = true }) => {
lengths[outer] = [inner];
}

details[slugify(`${model}-${build}-${outer}-${inner}`)] = {
name: item.name,
price: item.price ?? undefined,
reference: item.reference,
subject: item.subject,
text: item.text,
};
details[slugify(`${model}-${build}-${outer}-${inner}`)] = specs;
}
});

Expand Down
37 changes: 34 additions & 3 deletions packages/hws-lsa/lib/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,41 @@ export const getBuilds = (model) =>
selector: 'Bauart',
});

const authenticate = async ({
username = HWS_USERNAME, // eslint-disable-line no-undef
password = HWS_PASSWORD, // eslint-disable-line no-undef
} = {}) => {
// eslint-disable-next-line no-undef
return await fetchWithTimeout(AUTH_API_URL, {
credentials: 'include',
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({
username,
password,
}),
}).then((r) => r.json());
};

export const getDetails = async (reference) => {
return await fetchWithTimeout(
`${productsUrl}${reference}/?verbose=3`,
).then((r) => r.json());
// Switch to turn on authentification for testing purposes
if (sessionStorage.getItem('hws-authenticate')) {
await authenticate();
}

return await fetchWithTimeout(`${productsUrl}${reference}/?verbose=4`, {
credentials: 'include',
method: 'GET',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
}).then((r) => r.json());
};

export const getModels = () =>
Expand Down
50 changes: 47 additions & 3 deletions packages/hws-table/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { LitElement, html } from 'lit-element';
import { repeat } from 'lit-html/directives/repeat';

import Cookies from 'js-cookie';

import { stylesheet } from './styles/index.js';

class HwsTable extends LitElement {
Expand Down Expand Up @@ -571,10 +573,40 @@ class HwsTable extends LitElement {
${items[row].details.name}
</dd>
<dt>
Beschreibung:
Schlüssel:
</dt>
<dd>
${items[row].details.key}
</dd>
<dt>
Ausführung:
</dt>
<dd>
${items[row].details.design}
</dd>
<dt>
Sicherheit:
</dt>
<dd>
${items[row].details.safety}
</dd>
<dt>
Material:
</dt>
<dd>
${items[row].details.material}
</dd>
<dt>
Teillänge (C+D):
</dt>
<dd>
${items[row].details.text}
${items[row].details.partialLength}
</dd>
<dt>
Gesamtlänge (L):
</dt>
<dd>
${items[row].details.totalLength}
</dd>
<dt>
Preis:
Expand All @@ -583,7 +615,10 @@ class HwsTable extends LitElement {
${items[row].details.price
? items[row].details.price
: html`
<a href="https://www.schweisthal.de/de/login">
<a
class="btn btn-info btn-sm"
href="https://www.schweisthal.de/de/login"
>
Bitte anmelden
</a>
`}
Expand Down Expand Up @@ -742,6 +777,8 @@ class HwsTable extends LitElement {
}

render() {
const cookie = Cookies.get('brolive_session');

return html`
<form @submit="${this.submitForm}" class="table-responsive">
<table>
Expand All @@ -760,6 +797,13 @@ class HwsTable extends LitElement {
<button @click="${this.print}" class="btn btn-success">
Schließplan ausdrucken
</button>
${cookie
? html`
<button type="submit" class="btn btn-success">
In den Warenkorb legen
</button>
`
: ''}
</form>
`;
}
Expand Down
1 change: 1 addition & 0 deletions packages/hws-table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"npm": "6.x.x"
},
"dependencies": {
"js-cookie": "^3.0.0-rc.0",
"lit-element": "^2.1.0"
}
}

0 comments on commit 9efd78b

Please sign in to comment.