-
{t('logs')}
+
+
{t('logs')}
+
+
{Object.entries(logs).map(([type, lines], key) => (
))}
diff --git a/sites/shared/components/workbench/views/measies/editor.mjs b/sites/shared/components/workbench/views/measies/editor.mjs
index ea502fc0f5c..ff55ac1fe7d 100644
--- a/sites/shared/components/workbench/views/measies/editor.mjs
+++ b/sites/shared/components/workbench/views/measies/editor.mjs
@@ -1,7 +1,7 @@
import { MeasieInput, ns as inputNs } from 'shared/components/sets/measie-input.mjs'
import { useTranslation } from 'next-i18next'
-export const ns = ['wbmeasies', ...inputNs]
+export const ns = ['workbench', ...inputNs]
export const MeasiesEditor = ({ Design, settings, update }) => {
const { t } = useTranslation(ns)
@@ -13,6 +13,8 @@ export const MeasiesEditor = ({ Design, settings, update }) => {
return (
+
{t('editCurrentMeasiesHeader')}
+
{t('editCurrentMeasiesDesc')}
{Design.patternConfig.measurements.map((m) => (
{t(m)}
diff --git a/sites/shared/components/workbench/views/measies/index.mjs b/sites/shared/components/workbench/views/measies/index.mjs
index 46e96de5ae5..35e21f32ce2 100644
--- a/sites/shared/components/workbench/views/measies/index.mjs
+++ b/sites/shared/components/workbench/views/measies/index.mjs
@@ -8,11 +8,11 @@ import { designMeasurements } from 'shared/utils.mjs'
import { useTranslation } from 'next-i18next'
import { useToast } from 'shared/hooks/use-toast.mjs'
-export const ns = ['wbmeasies', ...authNs, setsNs]
+export const ns = [...authNs, setsNs]
-const tabNames = ['chooseNew', 'editCurrent']
+const tabNames = ['chooseNewSet', 'editCurrentMeasies']
export const MeasiesView = ({ design, Design, settings, update, missingMeasurements, setView }) => {
- const { t } = useTranslation(['wbmeasies'])
+ const { t } = useTranslation(['workbench'])
const toast = useToast()
const tabs = tabNames.map((n) => t(n)).join(',')
@@ -23,7 +23,7 @@ export const MeasiesView = ({ design, Design, settings, update, missingMeasureme
[['units'], set.imperial ? 'imperial' : 'metric'],
])
setView('draft')
- toast.success(t('updatedMeasurements'))
+ toast.success(t('appliedMeasies'))
}
return (
diff --git a/sites/shared/components/wrappers/auth/de.yaml b/sites/shared/components/wrappers/auth/de.yaml
index 2cf579d4676..aa574a75a37 100644
--- a/sites/shared/components/wrappers/auth/de.yaml
+++ b/sites/shared/components/wrappers/auth/de.yaml
@@ -1,5 +1,5 @@
authRequired: Authentifizierung erforderlich
-membersOnly: Dieser Inhalt ist nur für FreeSewing-Mitglieder zugänglich.
+membersOnly: This functionality requires a FreeSewing account.
signUp: Anmelden
signIn: Eintragen
statusUnknown: Warnung zum Kontostatus
diff --git a/sites/shared/components/wrappers/auth/es.yaml b/sites/shared/components/wrappers/auth/es.yaml
index f0343cabc47..cf314083be4 100644
--- a/sites/shared/components/wrappers/auth/es.yaml
+++ b/sites/shared/components/wrappers/auth/es.yaml
@@ -1,5 +1,5 @@
authRequired: Autenticación necesaria
-membersOnly: Este contenido sólo es accesible para los miembros de FreeSewing.
+membersOnly: This functionality requires a FreeSewing account.
signUp: Inscríbete
signIn: Regístrate
statusUnknown: Advertencia sobre el estado de la cuenta
diff --git a/sites/shared/components/wrappers/auth/fr.yaml b/sites/shared/components/wrappers/auth/fr.yaml
index 71d5058ec47..e345162b722 100644
--- a/sites/shared/components/wrappers/auth/fr.yaml
+++ b/sites/shared/components/wrappers/auth/fr.yaml
@@ -1,5 +1,5 @@
authRequired: Authentification requise
-membersOnly: Ce contenu n'est accessible qu'aux membres de FreeSewing.
+membersOnly: This functionality requires a FreeSewing account.
signUp: S'inscrire
signIn: S'inscrire
statusUnknown: Avertissement sur l'état du compte
diff --git a/sites/shared/components/wrappers/auth/uk.yaml b/sites/shared/components/wrappers/auth/uk.yaml
index 65caa8e4fad..8a2b7b2f5b1 100644
--- a/sites/shared/components/wrappers/auth/uk.yaml
+++ b/sites/shared/components/wrappers/auth/uk.yaml
@@ -1,5 +1,5 @@
authRequired: Потрібна автентифікація
-membersOnly: Цей вміст доступний лише для учасників FreeSewing.
+membersOnly: This functionality requires a FreeSewing account.
signUp: Зареєструватися
signIn: Увійдіть
statusUnknown: Попередження про стан облікового запису
diff --git a/sites/shared/components/wrappers/layout.mjs b/sites/shared/components/wrappers/layout.mjs
index 4a3cc83b602..404fcfd281f 100644
--- a/sites/shared/components/wrappers/layout.mjs
+++ b/sites/shared/components/wrappers/layout.mjs
@@ -1,4 +1,4 @@
-import { useState, useEffect } from 'react'
+import { useState, useEffect, useRef } from 'react'
import Head from 'next/head'
import { Header, ns as headerNs } from 'site/components/header/index.mjs'
import { Footer, ns as footerNs } from 'shared/components/footer/index.mjs'
@@ -16,23 +16,25 @@ export const LayoutWrapper = ({
slug,
}) => {
const ChosenHeader = header ? header : Header
-
- const [prevScrollPos, setPrevScrollPos] = useState(0)
+ const prevScrollPos = useRef(0)
const [showHeader, setShowHeader] = useState(true)
useEffect(() => {
if (typeof window !== 'undefined') {
const handleScroll = () => {
const curScrollPos = typeof window !== 'undefined' ? window.pageYOffset : 0
- if (curScrollPos >= prevScrollPos) {
- if (showHeader && curScrollPos > 20) setShowHeader(false)
+
+ if (curScrollPos >= prevScrollPos.current) {
+ if (curScrollPos > 20) setShowHeader(false)
} else setShowHeader(true)
- setPrevScrollPos(curScrollPos)
+
+ prevScrollPos.current = curScrollPos
}
+
window.addEventListener('scroll', handleScroll)
return () => window.removeEventListener('scroll', handleScroll)
}
- }, [prevScrollPos, showHeader])
+ }, [prevScrollPos, setShowHeader])
return (
{
/** convert a millimeter value to a Number value in the given units */
export const measurementAsUnits = (mmValue, units = 'metric') =>
- mmValue / (units === 'imperial' ? 25.4 : 10)
+ round(mmValue / (units === 'imperial' ? 25.4 : 10), 3)
+
+/** convert a value that may contain a fraction to a decimal */
+export const fractionToDecimal = (value) => {
+ // if it's just a number, return it
+ if (!isNaN(value)) return value
+
+ // keep a running total
+ let total = 0
+
+ // split by spaces
+ let chunks = String(value).split(' ')
+ if (chunks.length > 2) return Number.NaN // too many spaces to parse
+
+ // a whole number with a fraction
+ if (chunks.length === 2) {
+ // shift the whole number from the array
+ const whole = Number(chunks.shift())
+ // if it's not a number, return NaN
+ if (isNaN(whole)) return Number.NaN
+ // otherwise add it to the total
+ total += whole
+ }
+
+ // now we have only one chunk to parse
+ let fraction = chunks[0]
+
+ // split it to get numerator and denominator
+ let fChunks = fraction.trim().split('/')
+ // not really a fraction. return NaN
+ if (fChunks.length !== 2 || fChunks[1] === '') return Number.NaN
+
+ // do the division
+ let num = Number(fChunks[0])
+ let denom = Number(fChunks[1])
+ if (isNaN(num) || isNaN(denom)) return NaN
+ return total + num / denom
+}
export const measurementAsMm = (value, units = 'metric') => {
if (typeof value === 'number') return value * (units === 'imperial' ? 25.4 : 10)
- if (value.endsWith('.')) return false
+ if (String(value).endsWith('.')) return false
if (units === 'metric') {
value = Number(value)
if (isNaN(value)) return false
return value * 10
} else {
- const imperialFractionToMm = (value) => {
- let chunks = value.trim().split('/')
- if (chunks.length !== 2 || chunks[1] === '') return false
- let num = Number(chunks[0])
- let denom = Number(chunks[1])
- if (isNaN(num) || isNaN(denom)) return false
- else return (num * 25.4) / denom
- }
- let chunks = value.split(' ')
- if (chunks.length === 1) {
- let val = chunks[0]
- if (!isNaN(Number(val))) return Number(val) * 25.4
- else return imperialFractionToMm(val)
- } else if (chunks.length === 2) {
- let inches = Number(chunks[0])
- if (isNaN(inches)) return false
- let fraction = imperialFractionToMm(chunks[1])
- if (fraction === false) return false
- return inches * 25.4 + fraction
- }
+ const decimal = fractionToDecimal(value)
+ if (isNaN(decimal)) return false
+ return decimal * 24.5
}
- return false
}
export const optionsMenuStructure = (options) => {