1
0
Fork 0

chore(shared): Fix linter warnings in sites/shared

This commit is contained in:
joostdecock 2023-05-19 18:15:06 +02:00
parent fef2edd13d
commit c11a29e28a
16 changed files with 29 additions and 294 deletions

View file

@ -18,13 +18,11 @@ import { ModalContext } from 'shared/context/modal-context.mjs'
// Components
import { Collapse, useCollapseButton } from 'shared/components/collapse.mjs'
import { BackToAccountButton, Choice } from './shared.mjs'
import { WebLink } from 'shared/components/web-link.mjs'
import { PageLink } from 'shared/components/page-link.mjs'
import { ModalDesignPicker } from 'shared/components/modal/design-picker.mjs'
import {
FilterIcon,
ClearIcon,
CloseIcon,
PlusIcon,
OkIcon,
NoIcon,
@ -116,13 +114,6 @@ export const NewSet = ({
)
}
const Row = ({ title, children }) => (
<div className="flex flex-row flex-wrap items-center lg:gap-4 my-2 hover:bg-primary hover:bg-opacity-10 rounded-lg p-2">
<div className="w-24 text-left md:text-right block md:inline font-bold pr-4">{title}</div>
<div className="grow">{children}</div>
</div>
)
const EditField = (props) => {
if (props.field === 'name') return <EditName {...props} />
if (props.field === 'notes') return <EditNotes {...props} />
@ -194,7 +185,6 @@ export const MeasieRow = (props) => {
const MeasieInput = ({ m, mset, backend, toast, refresh }) => {
const { t } = useTranslation(['measurements'])
//const title = t(`measurements:${m}`)
const { startLoading, stopLoading } = useContext(LoadingContext)
const isDegree = isDegreeMeasurement(m)
const factor = isDegree ? 1 : mset.imperial ? 25.4 : 10
@ -377,7 +367,7 @@ const EditImg = ({ t, mset, account, backend, toast, refresh, curated = false })
}, [])
const { getRootProps, getInputProps } = useDropzone({ onDrop })
const { loading, startLoading, stopLoading } = useContext(LoadingContext)
const { startLoading, stopLoading } = useContext(LoadingContext)
const update = async (evt) => {
evt.preventDefault()
@ -386,18 +376,6 @@ const EditImg = ({ t, mset, account, backend, toast, refresh, curated = false })
}
}
const save = async () => {
startLoading()
const result = curated
? await backend.updateCuratedSet(mset.id, { img })
: await backend.updateSet(mset.id, { img })
if (result.success) {
refresh()
toast.for.settingsSaved()
} else toast.for.backendError()
stopLoading()
}
return (
<div>
<div>
@ -592,7 +570,7 @@ const EditUnits = ({ t, mset, account, backend, toast, refresh }) => {
const EditPublic = ({ t, mset, account, backend, toast, refresh }) => {
const [selection, setSelection] = useState(mset.public)
const { loading, startLoading, stopLoading } = useContext(LoadingContext)
const { startLoading, stopLoading } = useContext(LoadingContext)
const update = async (val) => {
setSelection(val)
@ -770,13 +748,6 @@ const MeasurementsSet = ({ mset, t, account, backend, refresh }) => {
// Hooks
const toast = useToast()
const fields = {
id: 'ID',
name: t('name'),
level: t('keyLevel'),
createdAt: t('created'),
}
const remove = async () => {
startLoading()
const result = await backend.removeSet(mset.id)