chore(shared): Linter issues
This commit is contained in:
parent
92150932ca
commit
0eeffaf89d
4 changed files with 19 additions and 25 deletions
|
@ -27,22 +27,23 @@ import { LogView, ns as logNs } from 'shared/components/workbench/views/logs/ind
|
||||||
import { InspectView, ns as inspectNs } from 'shared/components/workbench/views/inspect/index.mjs'
|
import { InspectView, ns as inspectNs } from 'shared/components/workbench/views/inspect/index.mjs'
|
||||||
import { MeasiesView, ns as measiesNs } from 'shared/components/workbench/views/measies/index.mjs'
|
import { MeasiesView, ns as measiesNs } from 'shared/components/workbench/views/measies/index.mjs'
|
||||||
|
|
||||||
export const ns = [
|
export const ns = nsMerge(
|
||||||
'account',
|
'account',
|
||||||
'workbench',
|
'workbench',
|
||||||
'flag',
|
'flag',
|
||||||
...draftNs,
|
|
||||||
...saveNs,
|
|
||||||
...printNs,
|
|
||||||
...cutNs,
|
|
||||||
...editNs,
|
|
||||||
...testNs,
|
|
||||||
...exportNs,
|
|
||||||
...logNs,
|
|
||||||
...inspectNs,
|
|
||||||
...measiesNs,
|
|
||||||
'plugin-annotations',
|
'plugin-annotations',
|
||||||
]
|
draftNs,
|
||||||
|
saveNs,
|
||||||
|
printNs,
|
||||||
|
cutNs,
|
||||||
|
editNs,
|
||||||
|
testNs,
|
||||||
|
exportNs,
|
||||||
|
logNs,
|
||||||
|
inspectNs,
|
||||||
|
measiesNs,
|
||||||
|
headerNs
|
||||||
|
)
|
||||||
|
|
||||||
const defaultUi = {
|
const defaultUi = {
|
||||||
renderer: 'react',
|
renderer: 'react',
|
||||||
|
|
|
@ -8,10 +8,9 @@ import {
|
||||||
ns as coreMenuNs,
|
ns as coreMenuNs,
|
||||||
} from 'shared/components/workbench/menus/core-settings/index.mjs'
|
} from 'shared/components/workbench/menus/core-settings/index.mjs'
|
||||||
import { UiSettings, ns as uiNs } from 'shared/components/workbench/menus/ui-settings/index.mjs'
|
import { UiSettings, ns as uiNs } from 'shared/components/workbench/menus/ui-settings/index.mjs'
|
||||||
import { UiConfig } from 'shared/components/workbench/menus/ui-settings/config.mjs'
|
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
import { nsMerge } from 'shared/utils.mjs'
|
import { nsMerge } from 'shared/utils.mjs'
|
||||||
import { SettingsIcon, OptionsIcon, DesktopIcon, FlagIcon } from 'shared/components/icons.mjs'
|
import { SettingsIcon, OptionsIcon, DesktopIcon } from 'shared/components/icons.mjs'
|
||||||
import { Accordion } from 'shared/components/accordion.mjs'
|
import { Accordion } from 'shared/components/accordion.mjs'
|
||||||
import {
|
import {
|
||||||
FlagsAccordionTitle,
|
FlagsAccordionTitle,
|
||||||
|
@ -72,8 +71,8 @@ export const DraftMenu = ({
|
||||||
const items = []
|
const items = []
|
||||||
if (control >= uiSettingsConfig.kiosk.control && flags)
|
if (control >= uiSettingsConfig.kiosk.control && flags)
|
||||||
items.push([
|
items.push([
|
||||||
<FlagsAccordionTitle flags={flags} />,
|
<FlagsAccordionTitle flags={flags} key={1} />,
|
||||||
<FlagsAccordionEntries {...{ update, control, flags }} />,
|
<FlagsAccordionEntries {...{ update, control, flags }} key={2} />,
|
||||||
])
|
])
|
||||||
items.push(
|
items.push(
|
||||||
...sections.map((section) => [
|
...sections.map((section) => [
|
||||||
|
|
|
@ -4,7 +4,6 @@ import mustache from 'mustache'
|
||||||
import { nsMerge } from 'shared/utils.mjs'
|
import { nsMerge } from 'shared/utils.mjs'
|
||||||
// Hooks
|
// Hooks
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
import { useState } from 'react'
|
|
||||||
// Components
|
// Components
|
||||||
import {
|
import {
|
||||||
ChatIcon,
|
ChatIcon,
|
||||||
|
@ -31,7 +30,6 @@ const flagIcons = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Flag = ({ type, data, t, handleUpdate }) => {
|
export const Flag = ({ type, data, t, handleUpdate }) => {
|
||||||
const Icon = flagIcons[type]
|
|
||||||
const BtnIcon = data.suggest?.icon ? flagIcons[data.suggest.icon] : false
|
const BtnIcon = data.suggest?.icon ? flagIcons[data.suggest.icon] : false
|
||||||
|
|
||||||
const button =
|
const button =
|
||||||
|
@ -52,7 +50,7 @@ export const Flag = ({ type, data, t, handleUpdate }) => {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2 items-start">
|
<div className="flex flex-col gap-2 items-start">
|
||||||
<div className="first:mt-0 grow md flag">
|
<div className="first:mt-0 grow md flag">
|
||||||
<Markdown children={desc} />
|
<Markdown>{desc}</Markdown>
|
||||||
</div>
|
</div>
|
||||||
{button ? <div className="mt-2 w-full flex flex-row justify-end">{button}</div> : null}
|
{button ? <div className="mt-2 w-full flex flex-row justify-end">{button}</div> : null}
|
||||||
</div>
|
</div>
|
||||||
|
@ -65,7 +63,7 @@ const flattenFlags = (flags) => {
|
||||||
for (const type of flagTypes) {
|
for (const type of flagTypes) {
|
||||||
let i = 0
|
let i = 0
|
||||||
if (flags[type]) {
|
if (flags[type]) {
|
||||||
for (const [key, flag] of Object.entries(flags[type])) {
|
for (const flag of Object.values(flags[type])) {
|
||||||
i++
|
i++
|
||||||
all[`${type}-${i}`] = { ...flag, type }
|
all[`${type}-${i}`] = { ...flag, type }
|
||||||
if (flag.ns) ns.push(flag.ns)
|
if (flag.ns) ns.push(flag.ns)
|
||||||
|
@ -102,7 +100,6 @@ export const FlagsAccordionTitle = ({ flags }) => {
|
||||||
export const FlagsAccordionEntries = ({ flags, update }) => {
|
export const FlagsAccordionEntries = ({ flags, update }) => {
|
||||||
const [flagList, ns] = flattenFlags(flags)
|
const [flagList, ns] = flattenFlags(flags)
|
||||||
const { t } = useTranslation(nsMerge(ns))
|
const { t } = useTranslation(nsMerge(ns))
|
||||||
const [all, setAll] = useState(flagList)
|
|
||||||
|
|
||||||
if (Object.keys(flagList).length < 1) return null
|
if (Object.keys(flagList).length < 1) return null
|
||||||
|
|
||||||
|
@ -113,7 +110,7 @@ export const FlagsAccordionEntries = ({ flags, update }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SubAccordion
|
<SubAccordion
|
||||||
items={Object.entries(all).map(([key, flag], i) => {
|
items={Object.entries(flagList).map(([key, flag], i) => {
|
||||||
const Icon = flagIcons[flag.type]
|
const Icon = flagIcons[flag.type]
|
||||||
const title = flag.replace ? mustache.render(t(flag.title), flag.replace) : t(flag.title)
|
const title = flag.replace ? mustache.render(t(flag.title), flag.replace) : t(flag.title)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { PanZoomContextProvider } from 'shared/components/workbench/pattern/pan-zoom-context.mjs'
|
import { PanZoomContextProvider } from 'shared/components/workbench/pattern/pan-zoom-context.mjs'
|
||||||
import { MenuWrapper } from 'shared/components/workbench/menus/shared/menu-wrapper.mjs'
|
import { MenuWrapper } from 'shared/components/workbench/menus/shared/menu-wrapper.mjs'
|
||||||
import { Flags } from './flags.mjs'
|
|
||||||
|
|
||||||
export const ns = ['common', 'core-settings', 'ui-settings']
|
export const ns = ['common', 'core-settings', 'ui-settings']
|
||||||
|
|
||||||
|
@ -17,7 +16,6 @@ export const PatternWithMenu = ({
|
||||||
menu,
|
menu,
|
||||||
setSettings,
|
setSettings,
|
||||||
Header = false,
|
Header = false,
|
||||||
flags = false,
|
|
||||||
}) => (
|
}) => (
|
||||||
<PanZoomContextProvider>
|
<PanZoomContextProvider>
|
||||||
<div className="flex flex-col h-full">
|
<div className="flex flex-col h-full">
|
||||||
|
@ -34,7 +32,6 @@ export const PatternWithMenu = ({
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{flags ? <Flags {...{ update, control, flags }} /> : null}
|
|
||||||
<div className="flex lg:flex-row grow lg:max-h-[90vh] max-h-[calc(100vh-3rem)] h-full py-4 lg:mt-6">
|
<div className="flex lg:flex-row grow lg:max-h-[90vh] max-h-[calc(100vh-3rem)] h-full py-4 lg:mt-6">
|
||||||
<div className="lg:w-2/3 flex flex-col h-full grow px-4">
|
<div className="lg:w-2/3 flex flex-col h-full grow px-4">
|
||||||
{title}
|
{title}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue