Skip to content

Commit

Permalink
Merge branch 'master' into change-signup-box-#175
Browse files Browse the repository at this point in the history
  • Loading branch information
nomasi authored Mar 14, 2021
2 parents d5d37c5 + cb4821c commit bf8e1df
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
paths:
- src
31 changes: 7 additions & 24 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,28 @@ jobs:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['javascript', 'python']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
languages: javascript
config-file: './.github/codeql/codeql-config.yml'

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following
# three lines and modify them (or add more) to build your code if your
# project uses a compiled language

#- run: |
# make bootstrap
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ Application expects to find an object named `sizeme_options` (TODO: rename to `S
```
* [serviceStatus] (_String_): is SizeMe enabled? Default: "on"; other values: "off", "ab".

* [pluginVersion] (_String_): version of the webstore-plugin. Optional.
* [pluginVersion] (_String_): version of the webstore plugin. Optional.

* [contextAddress] (_String_): URL to the SizeMe backend service.

* [shopType] (_String_): webstore provider (magento|printmotor|pupeshop|woocommerce)
* [shopType] (_String_): webstore provider (magento|printmotor|pupeshop|woocommerce|shopify)

* [debugState] (_Boolean_): write debugging info to console. Default: false

Expand All @@ -48,6 +48,7 @@ Application expects to find an object named `sizeme_options` (TODO: rename to `S
- [maxRecommendationDistance] (_Integer_): maximum difference between optimal fit and total fit for SizeMe to consider the size for pre-selection. Default not set, meaning all sizes that are not too small are considered.
- [skinClasses] (_String_): contents will be appended to the class attribute of SizeMe container element. Empty by default.
- [toggler] (_Boolean_): enable/disable functionality that can be used to toggle the visibility of SizeMe content
- [flatMeasurements] (_Boolean_): show product circumference measurements (chest, waist etc) as measured on a flat surface in the size guide. Default: true

* [additionalTranslations] (_Object_): Optionally override translations defined under ['i18n'](src/i18n). Example of how to
override the Swedish translation for chest:
Expand Down
3 changes: 2 additions & 1 deletion index1.html
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,8 @@ <h2>Product Tags</h2>
shopType: "magento",
debugState: true,
uiOptions: {
toggler: true
toggler: true,
flatMeasurements: false
}
};
</script>
Expand Down
2 changes: 2 additions & 0 deletions src/api/ProductModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,7 @@ export default class ProductModel {
this.arrows = arrows;
this.itemDrawing = itemDrawing;
this.essentialMeasurements = getEssentialMeasurements(itemTypeArr);
this.pinchedFits = pinchedFits;

this.getItemTypeComponent = index => itemTypeArr[index];
}
Expand Down Expand Up @@ -1263,6 +1264,7 @@ export {
DEFAULT_OPTIMAL_FIT,
DEFAULT_OPTIMAL_STRETCH,
fitLabelsAndColors,
pinchedFits
};


3 changes: 2 additions & 1 deletion src/api/uiOptions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const general = {
disableSizeGuide: false,
toggler: false,
firstRecommendation: true
firstRecommendation: true,
flatMeasurements: true
};

const shops = {
Expand Down
12 changes: 6 additions & 6 deletions src/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@
},
"humanMeasurements": {
"chest": "Rinnan ympärys",
"shirtWaist": "Vyötärö",
"shirtWaist": "Vyötärön ympärys",
"sleeve": "Käden pituus",
"shoulderFull": "Hartia",
"neckCircumference": "Kaulan ympärys",
"frontHeight": "Etupituus",
"underbust": "Rinnan alta",
"pantWaist": "Housun vyötärö",
"hips": "Pakarat",
"pantWaist": "Vyötärön ympärys",
"hips": "Lantion ympärys",
"inSeam": "Sisäsauma",
"outSeam": "Ulkosauma",
"thighCircumference": "Reiden ympärys",
Expand All @@ -92,7 +92,7 @@
"shoulder_width": "Hartia",
"front_height": "Etupituus",
"pant_waist": "Housun vyötärö",
"hips": "Pakarat",
"hips": "Lantio",
"inseam": "Sisäsauma",
"outseam": "Ulkosauma",
"thigh_width": "Reisi",
Expand All @@ -117,7 +117,7 @@
"shoe_inside_length": "Aseta mittanauha lattialle seinän viereen ja astu nauhan päälle paljain jaloin kantapää seinässä kiinni.",
"calf_width": "Mittaa pohkeiden ympärysmitta leveimmästä kohdasta.",
"hat_width": "Mittaa pään ympärysmitta korvien yläpuolelta.",
"hips": "Mittaa pakaroiden ympärysmitta leveimmästä kohdasta."
"hips": "Mittaa lantion ympärysmitta leveimmästä kohdasta."
},
"measurementTooltips": {
"linkToGuide": {
Expand Down Expand Up @@ -145,7 +145,7 @@
"Vedä vatsaa vähän sisään"
],
"hips": [
"Mittaa pakaroiden ympärysmitta leveimmästä kohdasta"
"Mittaa lantion ympärysmitta leveimmästä kohdasta"
],
"outseam": [
"Mittaa ulkosauman pituus housujen yläsaumasta aloittaen",
Expand Down
5 changes: 3 additions & 2 deletions src/sizeguide/SizeGuideItem.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import PropTypes from "prop-types";
import SizeGuideModel from "../api/ProductModel";
import uiOptions from "../api/uiOptions";
import Optional from "optional-js";

const realCanvasWidth = 350;
Expand Down Expand Up @@ -313,7 +314,7 @@ function writeItemCanvas (canvas, options) {
const { model, highlight, matchMap, measurements, selectedSize, isGuide } = options;
const measurementArrows = model.arrows;
const itemDrawing = model.itemDrawing;

const c = canvas.getContext("2d");

// Store the current transformation matrix
Expand Down Expand Up @@ -351,7 +352,7 @@ function writeItemCanvas (canvas, options) {
const plotArrows = (selectedMeasurements) => {
for (const [measurement, value] of Object.entries(selectedMeasurements)) {
const arrow = Object.assign({
style: isGuide ? "line" : "arc",
style: (isGuide && uiOptions.flatMeasurements) ? "line" : "arc",
color: isGuide ? arrowColorInfo :
Optional.ofNullable(SizeGuideModel.getFit(matchMap.get(measurement)))
.map(fit => fit.arrowColor)
Expand Down
11 changes: 7 additions & 4 deletions src/sizeguide/SizeGuideProductInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { withTranslation } from "react-i18next";
import HoverContainer from "./HoverContainer.jsx";
import CookieHideWrapper, { hideSizeMe } from "../common/CookieHideWrapper.jsx";
import { openLoginFrame } from "../common/LoginFrame";
import uiOptions from "../api/uiOptions";

class SizeGuideProductInfo extends React.Component {

Expand All @@ -20,11 +21,11 @@ class SizeGuideProductInfo extends React.Component {

render () {
const { t, measurements, onHover, productModel } = this.props;
const { measurementOrder, measurementName } = productModel;
const { measurementOrder, measurementName, pinchedFits } = productModel;

const measurementCell = (size, measurement) => (
<HoverContainer measurement={measurement} key={measurement} onHover={onHover}>
<td>{(measurements[size][measurement] / 10.0).toFixed(1)} cm</td>
<td>{(measurements[size][measurement] / ((!pinchedFits.includes(measurement) || uiOptions.flatMeasurements) ? 10.0 : 5.0)).toFixed(1)} cm</td>
</HoverContainer>
);

Expand Down Expand Up @@ -56,10 +57,12 @@ class SizeGuideProductInfo extends React.Component {
))}
</tbody>
</table>
{this.isInside() ?
{this.isInside() &&
<div className="sizeme-explanation">
<div dangerouslySetInnerHTML={{ __html: t("sizeGuide.measurementDisclaimerInside") }}/>
</div> :
</div>
}
{uiOptions.flatMeasurements && !this.isInside() &&
<div className="sizeme-explanation">
<div dangerouslySetInnerHTML={{ __html: t("sizeGuide.measurementDisclaimer") }}/>
{this.hasNeckOpening() &&
Expand Down

0 comments on commit bf8e1df

Please sign in to comment.