diff --git a/sites/backend/src/models/set.mjs b/sites/backend/src/models/set.mjs index 6423139ddd5..69ad4386008 100644 --- a/sites/backend/src/models/set.mjs +++ b/sites/backend/src/models/set.mjs @@ -206,6 +206,13 @@ SetModel.prototype.revealSet = function (mset) { //console.log(err) } } + for (const field of this.jsonFields) { + try { + clear[field] = JSON.parse(clear[field]) + } catch (err) { + //console.log(err) + } + } return { ...mset, ...clear } } diff --git a/sites/org/components/header/en.yaml b/sites/org/components/header/en.yaml index ba3e683d389..5a426d69f21 100644 --- a/sites/org/components/header/en.yaml +++ b/sites/org/components/header/en.yaml @@ -8,6 +8,5 @@ account: Account theme: Theme language: Language search: Search -sets: Measurements -patterns: Patterns -new: New +new: New... +support: Support diff --git a/sites/org/components/header/index.mjs b/sites/org/components/header/index.mjs index db983339605..87c15fc5c3c 100644 --- a/sites/org/components/header/index.mjs +++ b/sites/org/components/header/index.mjs @@ -14,8 +14,8 @@ import { UserIcon, ThemeIcon, I18nIcon, - MeasieIcon, - PageIcon, + HeartIcon, + PlusIcon, RssIcon, } from 'shared/components/icons.mjs' import { HeaderWrapper } from 'shared/components/wrappers/header.mjs' @@ -71,23 +71,23 @@ const NavIcons = ({ setModal, setSearch }) => { - + + + + - - - - + filter by design to only list those measurements that are required for this design. patternNew: Generate a new pattern patternNewInfo: Pick a design, add your measurements set, and we'll generate a made-to-measure sewing pattern for you. diff --git a/sites/shared/components/account/links.mjs b/sites/shared/components/account/links.mjs index 48f2b214d9d..47615f97e9d 100644 --- a/sites/shared/components/account/links.mjs +++ b/sites/shared/components/account/links.mjs @@ -3,7 +3,7 @@ import { useAccount } from 'shared/hooks/use-account.mjs' import { useBackend } from 'shared/hooks/use-backend.mjs' import { useTranslation } from 'next-i18next' import Link from 'next/link' -import { freeSewingConfig as conf } from 'shared/config/freesewing.config.mjs' +import { freeSewingConfig as conf, controlLevels } from 'shared/config/freesewing.config.mjs' import { DesignIcon, MeasieIcon, @@ -90,7 +90,7 @@ const YesNo = ({ check }) => ) export const AccountLinks = () => { - const { account, signOut } = useAccount() + const { account, signOut, control } = useAccount() const { t } = useTranslation(ns) const backend = useBackend() @@ -145,7 +145,6 @@ export const AccountLinks = () => { ), mfa: , } - for (const social of Object.keys(conf.account.fields.identities).filter((i) => i !== 'github')) itemPreviews[social] = account.data[social] || ( @@ -156,102 +155,128 @@ export const AccountLinks = () => {

{t('data')}

- {Object.keys(conf.account.fields.data).map((item) => ( - -
- {itemIcons[item]} - {t(`your${capitalize(item)}`)} -
-
{itemPreviews[item]}
-
- ))} + {Object.keys(conf.account.fields.data).map((item) => + controlLevels[item] > control ? null : ( + +
+ {itemIcons[item]} + {t(`your${capitalize(item)}`)} +
+
{itemPreviews[item]}
+
+ ) + )}
-
-

{t('info')}

- {Object.keys(conf.account.fields.info).map((item) => ( - + {control > 1 && ( +
+

{t('info')}

+ {Object.keys(conf.account.fields.info).map((item) => + controlLevels[item] > control ? null : ( + +
+ {itemIcons[item]} + {t(item)} +
+
{itemPreviews[item]}
+
+ ) + )} +
- {itemIcons[item]} - {t(item)} + + {t('userId')}
-
{itemPreviews[item]}
- - ))} -
-
- - {t('userId')} +
{account.id}
-
{account.id}
-
+ )}

{t('settings')}

- {Object.keys(conf.account.fields.settings).map((item) => ( - -
- {itemIcons[item]} - {t(item)} -
-
{itemPreviews[item]}
-
- ))} + {Object.keys(conf.account.fields.settings).map((item) => + controlLevels[item] > control ? null : ( + +
+ {itemIcons[item]} + {t(item)} +
+
{itemPreviews[item]}
+
+ ) + )}
-
-

{t('linkedIdentities')}

- {Object.keys(conf.account.fields.identities).map((item) => ( - -
- {itemIcons[item]} - {t(item)} -
-
{itemPreviews[item]}
-
- ))} -
+ {control > 2 && ( +
+

{t('linkedIdentities')}

+ {Object.keys(conf.account.fields.identities).map((item) => + controlLevels[item] > control ? null : ( + +
+ {itemIcons[item]} + {t(item)} +
+
{itemPreviews[item]}
+
+ ) + )} +
+ )} -
-

{t('security')}

- {Object.keys(conf.account.fields.security).map((item) => ( - -
- {itemIcons[item]} - {t(item)} -
-
{itemPreviews[item]}
-
- ))} -
+ {control > 1 && ( +
+

{t('security')}

+ {Object.keys(conf.account.fields.security).map((item) => + controlLevels[item] > control ? null : ( + +
+ {itemIcons[item]} + {t(item)} +
+
{itemPreviews[item]}
+
+ ) + )} +
+ )} -
-

{t('actions')}

- - - {t('reload')} - - - - {t('export')} - - - - {t('restrict')} - - - - {t('remove')} - -
+ {control > 1 && ( +
+

{t('actions')}

+ {control > 2 && ( + + + {t('reload')} + + )} + {control > 2 && ( + + + {t('export')} + + )} + {control > 3 && ( + + + {t('restrict')} + + )} + + + {t('remove')} + +
+ )}
- - - {t('yourProfile')} - + {control > 1 && ( + + + {t('yourProfile')} + + )} + ) : ( + + {inner} + + ) +} + export const Mset = ({ id, publicOnly = false }) => { // Hooks - const { account } = useAccount() + const { account, control } = useAccount() const { setLoadingStatus, LoadingStatus } = useLoadingStatus() const backend = useBackend() const { t } = useTranslation(ns) @@ -212,14 +279,9 @@ export const Mset = ({ id, publicOnly = false }) => { const heading = (
- + /> {account.control > 3 && mset.public ? ( ) @@ -337,37 +401,43 @@ export const Mset = ({ id, publicOnly = false }) => { ))}
    - {['name', 'image', 'public', 'units', 'notes'].map((id) => ( +
  • + +
  • + {account.control >= conf.account.sets.img ? (
  • - +
  • - ))} + ) : null} + {['public', 'units', 'notes'].map((id) => + account.control >= conf.account.sets[id] ? ( +
  • + +
  • + ) : null + )}

{t('measies')}

-
- - + />
{filterMeasurements().map((mplus) => { const [translated, m] = mplus.split('|') @@ -506,9 +576,12 @@ export const Mset = ({ id, publicOnly = false }) => { // Component for the account/sets page export const Sets = ({ title = true }) => { // Hooks + const { control } = useAccount() const backend = useBackend() - const { t } = useTranslation(ns) + const { t, i18n } = useTranslation(ns) const { setLoadingStatus, LoadingStatus, LoadingProgress } = useLoadingStatus() + const router = useRouter() + const { locale } = router // State const [sets, setSets] = useState([]) @@ -561,8 +634,13 @@ export const Sets = ({ title = true }) => { return (
-

- +

+ {t('newSet')}

@@ -574,7 +652,7 @@ export const Sets = ({ title = true }) => { - - - - - + {sets.map((set, i) => ( - - - - - ))} diff --git a/sites/shared/components/icons.mjs b/sites/shared/components/icons.mjs index 4ddcb131d8e..10f6bd9924d 100644 --- a/sites/shared/components/icons.mjs +++ b/sites/shared/components/icons.mjs @@ -60,12 +60,16 @@ export const BulletIcon = (props) => ( ) -export const Camera = (props) => ( +export const CalendarIcon = (props) => ( - <> - - - + + +) + +export const CameraIcon = (props) => ( + + + ) diff --git a/sites/shared/components/inputs.mjs b/sites/shared/components/inputs.mjs index ce930e2490c..76177bcf334 100644 --- a/sites/shared/components/inputs.mjs +++ b/sites/shared/components/inputs.mjs @@ -1,5 +1,6 @@ // Dependencies import { cloudflareImageUrl } from 'shared/utils.mjs' +import { collection } from 'shared/hooks/use-design.mjs' // Context import { ModalContext } from 'shared/context/modal-context.mjs' // Hooks @@ -19,7 +20,7 @@ import { measurementAsMm, formatMm, measurementAsUnits, parseDistanceInput } fro //import { NumberInput } from 'shared/components/workbench/menus/shared/inputs.mjs' //import { useState, useCallback } from 'react' -export const ns = ['account', 'measurements'] +export const ns = ['account', 'measurements', 'designs'] /* * Helper component to display a tab heading @@ -53,12 +54,12 @@ export const FormControl = ({ return (
-
+ { checked={sets.length === selCount} /> {t('keyName')} - {t('keyLevel')} - - 🔐 - - {t('keyExpires')}{t('apiCalls')}{t('set')}
+ { onClick={() => toggleSelect(set.id)} /> - + +