chore(shared): Linter issues
This commit is contained in:
parent
8da064398e
commit
a2c5522a8e
10 changed files with 34 additions and 57 deletions
|
@ -142,7 +142,7 @@ const ShowKey = ({ apikey, t, clear }) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const NewKey = ({ account, setGenerate, backend, title = true }) => {
|
const NewKey = ({ account, setGenerate, backend }) => {
|
||||||
const [name, setName] = useState('')
|
const [name, setName] = useState('')
|
||||||
const [level, setLevel] = useState(1)
|
const [level, setLevel] = useState(1)
|
||||||
const [expires, setExpires] = useState(Date.now())
|
const [expires, setExpires] = useState(Date.now())
|
||||||
|
@ -303,7 +303,7 @@ export const Apikeys = () => {
|
||||||
await backend.removeApikey(key)
|
await backend.removeApikey(key)
|
||||||
setLoadingStatus([
|
setLoadingStatus([
|
||||||
true,
|
true,
|
||||||
<LoadingProgress val={i} max={selCount} msg={t('removingApikeys')} />,
|
<LoadingProgress val={i} max={selCount} msg={t('removingApikeys')} key="linter" />,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
setSelected({})
|
setSelected({})
|
||||||
|
|
|
@ -146,7 +146,7 @@ export const Bookmarks = () => {
|
||||||
await backend.removeBookmark(id)
|
await backend.removeBookmark(id)
|
||||||
setLoadingStatus([
|
setLoadingStatus([
|
||||||
true,
|
true,
|
||||||
<LoadingProgress val={i} max={selCount} msg={t('removingBookmarks')} />,
|
<LoadingProgress val={i} max={selCount} msg={t('removingBookmarks')} key="linter" />,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
setSelected({})
|
setSelected({})
|
||||||
|
|
|
@ -7,11 +7,9 @@ import { freeSewingConfig as conf, controlLevels } from 'shared/config/freesewin
|
||||||
// Hooks
|
// Hooks
|
||||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||||
import { useBackend } from 'shared/hooks/use-backend.mjs'
|
import { useBackend } from 'shared/hooks/use-backend.mjs'
|
||||||
import { useToast } from 'shared/hooks/use-toast.mjs'
|
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { useLoadingStatus } from 'shared/hooks/use-loading-status.mjs'
|
import { useLoadingStatus } from 'shared/hooks/use-loading-status.mjs'
|
||||||
// Context
|
// Context
|
||||||
import { LoadingContext } from 'shared/context/loading-context.mjs'
|
|
||||||
import { ModalContext } from 'shared/context/modal-context.mjs'
|
import { ModalContext } from 'shared/context/modal-context.mjs'
|
||||||
// Components
|
// Components
|
||||||
import { BackToAccountButton } from './shared.mjs'
|
import { BackToAccountButton } from './shared.mjs'
|
||||||
|
@ -56,10 +54,6 @@ export const NewSet = () => {
|
||||||
const { t } = useTranslation(ns)
|
const { t } = useTranslation(ns)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
// State
|
|
||||||
const [generate, setGenerate] = useState(false)
|
|
||||||
const [added, setAdded] = useState(0)
|
|
||||||
|
|
||||||
// State
|
// State
|
||||||
const [name, setName] = useState('')
|
const [name, setName] = useState('')
|
||||||
|
|
||||||
|
@ -103,29 +97,29 @@ export const MeasieVal = ({ val, m, imperial }) =>
|
||||||
isDegreeMeasurement(m) ? <span>{val}°</span> : <span>{formatMm(val, imperial)}</span>
|
isDegreeMeasurement(m) ? <span>{val}°</span> : <span>{formatMm(val, imperial)}</span>
|
||||||
|
|
||||||
export const MsetBanner = ({ set, control, onClick = false, href = false }) => {
|
export const MsetBanner = ({ set, control, onClick = false, href = false }) => {
|
||||||
const { t } = useTranslation(ns)
|
const { t, i18n } = useTranslation(ns)
|
||||||
const info = []
|
const info = []
|
||||||
if (control > 1)
|
if (control > 1)
|
||||||
info.push([
|
info.push([
|
||||||
<CalendarIcon />,
|
<CalendarIcon key="a" />,
|
||||||
<b>
|
<b key="b">
|
||||||
<TextOnBg txt={shortDate(i18n.language, set.createdAt, false)} />
|
<TextOnBg txt={shortDate(i18n.language, set.createdAt, false)} />
|
||||||
</b>,
|
</b>,
|
||||||
])
|
])
|
||||||
info.push([
|
info.push([
|
||||||
<MeasieIcon />,
|
<MeasieIcon key="c" />,
|
||||||
<b>
|
<b key="d">
|
||||||
<TextOnBg txt={(set.measies ? Object.keys(set.measies).length : 0) + ' ' + t('measies')} />
|
<TextOnBg txt={(set.measies ? Object.keys(set.measies).length : 0) + ' ' + t('measies')} />
|
||||||
</b>,
|
</b>,
|
||||||
])
|
])
|
||||||
if (control > 2)
|
if (control > 2)
|
||||||
info.push([
|
info.push([
|
||||||
set.public ? (
|
set.public ? (
|
||||||
<OkIcon className="w-6 h-6 text-success" stroke={4} />
|
<OkIcon className="w-6 h-6 text-success" stroke={4} key="e" />
|
||||||
) : (
|
) : (
|
||||||
<NoIcon className="w-6 h-6 text-error" stroke={3} />
|
<NoIcon className="w-6 h-6 text-error" stroke={3} key="e" />
|
||||||
),
|
),
|
||||||
<b>
|
<b key="f">
|
||||||
<TextOnBg txt={t(set.public ? 'publicSet' : 'privateSet')} />
|
<TextOnBg txt={t(set.public ? 'publicSet' : 'privateSet')} />
|
||||||
</b>,
|
</b>,
|
||||||
])
|
])
|
||||||
|
@ -172,9 +166,9 @@ export const Mset = ({ id, publicOnly = false }) => {
|
||||||
const { account, control } = useAccount()
|
const { account, control } = useAccount()
|
||||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||||
const backend = useBackend()
|
const backend = useBackend()
|
||||||
const { t } = useTranslation(ns)
|
const { t, i18n } = useTranslation(ns)
|
||||||
const docs = useSetDocs(locale)
|
const docs = useSetDocs(i18n.language)
|
||||||
const measieDocs = useMeasurementDocs(locale)
|
const measieDocs = useMeasurementDocs(i18n.language)
|
||||||
|
|
||||||
// Context
|
// Context
|
||||||
const { setModal } = useContext(ModalContext)
|
const { setModal } = useContext(ModalContext)
|
||||||
|
@ -370,14 +364,14 @@ export const Mset = ({ id, publicOnly = false }) => {
|
||||||
<DisplayRow title={t('created')}>
|
<DisplayRow title={t('created')}>
|
||||||
<Timeago date={mset.createdAt} />
|
<Timeago date={mset.createdAt} />
|
||||||
<span className="px-2 opacity-50">|</span>
|
<span className="px-2 opacity-50">|</span>
|
||||||
{shortDate(locale, mset.createdAt, false)}
|
{shortDate(i18n.language, mset.createdAt, false)}
|
||||||
</DisplayRow>
|
</DisplayRow>
|
||||||
)}
|
)}
|
||||||
{control >= controlLevels.sets.createdAt && (
|
{control >= controlLevels.sets.createdAt && (
|
||||||
<DisplayRow title={t('updated')}>
|
<DisplayRow title={t('updated')}>
|
||||||
<Timeago date={mset.updatedAt} />
|
<Timeago date={mset.updatedAt} />
|
||||||
<span className="px-2 opacity-50">|</span>
|
<span className="px-2 opacity-50">|</span>
|
||||||
{shortDate(locale, mset.createdAt, false)}
|
{shortDate(i18n.language, mset.createdAt, false)}
|
||||||
</DisplayRow>
|
</DisplayRow>
|
||||||
)}
|
)}
|
||||||
{control >= controlLevels.sets.id && <DisplayRow title={t('id')}>{mset.id}</DisplayRow>}
|
{control >= controlLevels.sets.id && <DisplayRow title={t('id')}>{mset.id}</DisplayRow>}
|
||||||
|
@ -571,7 +565,7 @@ export const Sets = ({ title = true }) => {
|
||||||
// Hooks
|
// Hooks
|
||||||
const { control } = useAccount()
|
const { control } = useAccount()
|
||||||
const backend = useBackend()
|
const backend = useBackend()
|
||||||
const { t, i18n } = useTranslation(ns)
|
const { t } = useTranslation(ns)
|
||||||
const { setLoadingStatus, LoadingStatus, LoadingProgress } = useLoadingStatus()
|
const { setLoadingStatus, LoadingStatus, LoadingProgress } = useLoadingStatus()
|
||||||
|
|
||||||
// State
|
// State
|
||||||
|
|
|
@ -14,7 +14,7 @@ import Markdown from 'react-markdown'
|
||||||
import { ResetIcon, DocsIcon, UploadIcon } from 'shared/components/icons.mjs'
|
import { ResetIcon, DocsIcon, UploadIcon } from 'shared/components/icons.mjs'
|
||||||
import { ModalWrapper } from 'shared/components/wrappers/modal.mjs'
|
import { ModalWrapper } from 'shared/components/wrappers/modal.mjs'
|
||||||
import { isDegreeMeasurement } from 'config/measurements.mjs'
|
import { isDegreeMeasurement } from 'config/measurements.mjs'
|
||||||
import { measurementAsMm, formatMm, measurementAsUnits, parseDistanceInput } from 'shared/utils.mjs'
|
import { measurementAsMm, measurementAsUnits, parseDistanceInput } from 'shared/utils.mjs'
|
||||||
|
|
||||||
//import { Collapse } from 'shared/components/collapse.mjs'
|
//import { Collapse } from 'shared/components/collapse.mjs'
|
||||||
//import { PlusIcon, EditIcon } from 'shared/components/icons.mjs'
|
//import { PlusIcon, EditIcon } from 'shared/components/icons.mjs'
|
||||||
|
@ -143,13 +143,13 @@ export const DesignDropdown = ({
|
||||||
firstOption = null, // Any first option to add in addition to designs
|
firstOption = null, // Any first option to add in addition to designs
|
||||||
}) => {
|
}) => {
|
||||||
const { t, i18n } = useTranslation(['designs'])
|
const { t, i18n } = useTranslation(['designs'])
|
||||||
console.log(i18n)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormControl label={label} docs={docs}>
|
<FormControl label={label} docs={docs}>
|
||||||
<select
|
<select
|
||||||
className="select select-bordered w-full"
|
className="select select-bordered w-full"
|
||||||
onChange={(evt) => update(evt.target.value)}
|
onChange={(evt) => update(evt.target.value)}
|
||||||
|
value={current}
|
||||||
>
|
>
|
||||||
{firstOption}
|
{firstOption}
|
||||||
{collection.map((design) => (
|
{collection.map((design) => (
|
||||||
|
@ -172,7 +172,6 @@ export const ImageInput = ({
|
||||||
original, // The original value
|
original, // The original value
|
||||||
docs = false, // Docs to load, if any
|
docs = false, // Docs to load, if any
|
||||||
active = false, // Whether or not to upload images
|
active = false, // Whether or not to upload images
|
||||||
makeId = () => `ephemeral-${Date.now()}`, // Method to generate image IDs
|
|
||||||
imgType = 'showcase', // The image type
|
imgType = 'showcase', // The image type
|
||||||
imgSubid, // The image sub-id
|
imgSubid, // The image sub-id
|
||||||
imgSlug, // The image slug or other unique identifier to use in the image ID
|
imgSlug, // The image slug or other unique identifier to use in the image ID
|
||||||
|
@ -295,7 +294,6 @@ export const ListInput = ({
|
||||||
label, // The label
|
label, // The label
|
||||||
list, // The list of items to present { val, label, desc }
|
list, // The list of items to present { val, label, desc }
|
||||||
current, // The (value of the) current item
|
current, // The (value of the) current item
|
||||||
original, // The original value
|
|
||||||
docs = false, // Docs to load, if any
|
docs = false, // Docs to load, if any
|
||||||
}) => (
|
}) => (
|
||||||
<FormControl label={label} docs={docs}>
|
<FormControl label={label} docs={docs}>
|
||||||
|
@ -318,7 +316,6 @@ export const ListInput = ({
|
||||||
export const MarkdownInput = ({
|
export const MarkdownInput = ({
|
||||||
label, // The label
|
label, // The label
|
||||||
current, // The current value (markdown)
|
current, // The current value (markdown)
|
||||||
original, // The original value
|
|
||||||
update, // The onChange handler
|
update, // The onChange handler
|
||||||
placeholder, // The placeholder content
|
placeholder, // The placeholder content
|
||||||
docs = false, // Docs to load, if any
|
docs = false, // Docs to load, if any
|
||||||
|
@ -369,12 +366,12 @@ export const MeasieInput = ({
|
||||||
)
|
)
|
||||||
const [validatedVal, setValidatedVal] = useState(measurementAsUnits(original, units))
|
const [validatedVal, setValidatedVal] = useState(measurementAsUnits(original, units))
|
||||||
|
|
||||||
const [val, setVal] = useState(() => {
|
//const [val, setVal] = useState(() => {
|
||||||
const measie = current
|
// const measie = current
|
||||||
if (!measie) return ''
|
// if (!measie) return ''
|
||||||
if (isDegree) return measie
|
// if (isDegree) return measie
|
||||||
return measurementAsUnits(measie, units)
|
// return measurementAsUnits(measie, units)
|
||||||
})
|
//})
|
||||||
const [valid, setValid] = useState(null)
|
const [valid, setValid] = useState(null)
|
||||||
|
|
||||||
// Update onChange
|
// Update onChange
|
||||||
|
@ -393,7 +390,6 @@ export const MeasieInput = ({
|
||||||
// Various visual indicators for validating the input
|
// Various visual indicators for validating the input
|
||||||
let inputClasses = 'input-secondary'
|
let inputClasses = 'input-secondary'
|
||||||
let bottomLeftLabel = null
|
let bottomLeftLabel = null
|
||||||
let bottomRightLabel = null
|
|
||||||
if (valid === true) {
|
if (valid === true) {
|
||||||
inputClasses = 'input-success'
|
inputClasses = 'input-success'
|
||||||
const val = `${validatedVal}${isDegree ? '°' : imperial ? '"' : 'cm'}`
|
const val = `${validatedVal}${isDegree ? '°' : imperial ? '"' : 'cm'}`
|
||||||
|
|
|
@ -240,7 +240,7 @@ export const NavLinks = () => {
|
||||||
*/
|
*/
|
||||||
export const MainSections = () => {
|
export const MainSections = () => {
|
||||||
// Grab siteNav and slug from the navigation context
|
// Grab siteNav and slug from the navigation context
|
||||||
const { siteNav, slug, locale } = useContext(NavigationContext)
|
const { siteNav, slug } = useContext(NavigationContext)
|
||||||
const output = []
|
const output = []
|
||||||
for (const page of onlyMainSections(siteNav)) {
|
for (const page of onlyMainSections(siteNav)) {
|
||||||
const act = isSlugPart(page.s, slug)
|
const act = isSlugPart(page.s, slug)
|
||||||
|
|
|
@ -116,7 +116,7 @@ const SupportType = ({ type, active, t, update }) => (
|
||||||
</ButtonFrame>
|
</ButtonFrame>
|
||||||
)
|
)
|
||||||
|
|
||||||
export const SupportForm = ({ preload }) => {
|
export const SupportForm = () => {
|
||||||
const { t } = useTranslation(ns)
|
const { t } = useTranslation(ns)
|
||||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||||
const { account } = useAccount()
|
const { account } = useAccount()
|
||||||
|
|
|
@ -6,12 +6,8 @@ import { MdxWrapper } from 'shared/components/wrappers/mdx.mjs'
|
||||||
|
|
||||||
export const useApikeyDocs = (locale) => {
|
export const useApikeyDocs = (locale) => {
|
||||||
const loader = (option) =>
|
const loader = (option) =>
|
||||||
useCallback(
|
|
||||||
() =>
|
|
||||||
import(
|
import(
|
||||||
/* webpackInclude: /docs\/site\/apikeys\/[a-z]+\/[a-z][a-z]\.md$/ */ `orgmarkdown/docs/site/apikeys//${option}/${locale}.md`
|
/* webpackInclude: /docs\/site\/apikeys\/[a-z]+\/[a-z][a-z]\.md$/ */ `orgmarkdown/docs/site/apikeys//${option}/${locale}.md`
|
||||||
),
|
|
||||||
[locale]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const docs = {}
|
const docs = {}
|
||||||
|
|
|
@ -6,12 +6,8 @@ import { MdxWrapper } from 'shared/components/wrappers/mdx.mjs'
|
||||||
|
|
||||||
export const useBookmarkDocs = (locale) => {
|
export const useBookmarkDocs = (locale) => {
|
||||||
const loader = (option) =>
|
const loader = (option) =>
|
||||||
useCallback(
|
|
||||||
() =>
|
|
||||||
import(
|
import(
|
||||||
/* webpackInclude: /docs\/site\/bookmarks\/[a-z]+\/[a-z][a-z]\.md$/ */ `orgmarkdown/docs/site/bookmarks/${option}/${locale}.md`
|
/* webpackInclude: /docs\/site\/bookmarks\/[a-z]+\/[a-z][a-z]\.md$/ */ `orgmarkdown/docs/site/bookmarks/${option}/${locale}.md`
|
||||||
),
|
|
||||||
[locale]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const docs = {}
|
const docs = {}
|
||||||
|
|
|
@ -56,7 +56,7 @@ const LoadingStatus = ({ loadingStatus }) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const LoadingProgress = ({ val = 0, max = 1, color = 'secondary', msg }) => (
|
const LoadingProgress = ({ val = 0, max = 1, msg }) => (
|
||||||
<div className="flex flex-col gap-2 w-full grow-0">
|
<div className="flex flex-col gap-2 w-full grow-0">
|
||||||
{msg}
|
{msg}
|
||||||
<progress className="progress progress-white" value={val} max={max}></progress>
|
<progress className="progress progress-white" value={val} max={max}></progress>
|
||||||
|
|
|
@ -7,13 +7,8 @@ import { measurements } from 'config/measurements.mjs'
|
||||||
|
|
||||||
export const useMeasurementDocs = (locale) => {
|
export const useMeasurementDocs = (locale) => {
|
||||||
const loader = (m) =>
|
const loader = (m) =>
|
||||||
useCallback(
|
|
||||||
() =>
|
|
||||||
import(
|
import(
|
||||||
/* webpackInclude: /docs\/measurements\/[a-z]+\/[a-z][a-z]\.md$/ */ `markdown/docs/measurements/${m}/${locale}.md`
|
/* webpackInclude: /docs\/measurements\/[a-z]+\/[a-z][a-z]\.md$/ */ `orgmarkdown/docs/measurements/${m}/${locale}.md`
|
||||||
),
|
|
||||||
|
|
||||||
[locale]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const docs = {}
|
const docs = {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue