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 { MeasiesView, ns as measiesNs } from 'shared/components/workbench/views/measies/index.mjs'
|
||||
|
||||
export const ns = [
|
||||
export const ns = nsMerge(
|
||||
'account',
|
||||
'workbench',
|
||||
'flag',
|
||||
...draftNs,
|
||||
...saveNs,
|
||||
...printNs,
|
||||
...cutNs,
|
||||
...editNs,
|
||||
...testNs,
|
||||
...exportNs,
|
||||
...logNs,
|
||||
...inspectNs,
|
||||
...measiesNs,
|
||||
'plugin-annotations',
|
||||
]
|
||||
draftNs,
|
||||
saveNs,
|
||||
printNs,
|
||||
cutNs,
|
||||
editNs,
|
||||
testNs,
|
||||
exportNs,
|
||||
logNs,
|
||||
inspectNs,
|
||||
measiesNs,
|
||||
headerNs
|
||||
)
|
||||
|
||||
const defaultUi = {
|
||||
renderer: 'react',
|
||||
|
|
|
@ -8,10 +8,9 @@ import {
|
|||
ns as coreMenuNs,
|
||||
} from 'shared/components/workbench/menus/core-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 { 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 {
|
||||
FlagsAccordionTitle,
|
||||
|
@ -72,8 +71,8 @@ export const DraftMenu = ({
|
|||
const items = []
|
||||
if (control >= uiSettingsConfig.kiosk.control && flags)
|
||||
items.push([
|
||||
<FlagsAccordionTitle flags={flags} />,
|
||||
<FlagsAccordionEntries {...{ update, control, flags }} />,
|
||||
<FlagsAccordionTitle flags={flags} key={1} />,
|
||||
<FlagsAccordionEntries {...{ update, control, flags }} key={2} />,
|
||||
])
|
||||
items.push(
|
||||
...sections.map((section) => [
|
||||
|
|
|
@ -4,7 +4,6 @@ import mustache from 'mustache'
|
|||
import { nsMerge } from 'shared/utils.mjs'
|
||||
// Hooks
|
||||
import { useTranslation } from 'next-i18next'
|
||||
import { useState } from 'react'
|
||||
// Components
|
||||
import {
|
||||
ChatIcon,
|
||||
|
@ -31,7 +30,6 @@ const flagIcons = {
|
|||
}
|
||||
|
||||
export const Flag = ({ type, data, t, handleUpdate }) => {
|
||||
const Icon = flagIcons[type]
|
||||
const BtnIcon = data.suggest?.icon ? flagIcons[data.suggest.icon] : false
|
||||
|
||||
const button =
|
||||
|
@ -52,7 +50,7 @@ export const Flag = ({ type, data, t, handleUpdate }) => {
|
|||
return (
|
||||
<div className="flex flex-col gap-2 items-start">
|
||||
<div className="first:mt-0 grow md flag">
|
||||
<Markdown children={desc} />
|
||||
<Markdown>{desc}</Markdown>
|
||||
</div>
|
||||
{button ? <div className="mt-2 w-full flex flex-row justify-end">{button}</div> : null}
|
||||
</div>
|
||||
|
@ -65,7 +63,7 @@ const flattenFlags = (flags) => {
|
|||
for (const type of flagTypes) {
|
||||
let i = 0
|
||||
if (flags[type]) {
|
||||
for (const [key, flag] of Object.entries(flags[type])) {
|
||||
for (const flag of Object.values(flags[type])) {
|
||||
i++
|
||||
all[`${type}-${i}`] = { ...flag, type }
|
||||
if (flag.ns) ns.push(flag.ns)
|
||||
|
@ -102,7 +100,6 @@ export const FlagsAccordionTitle = ({ flags }) => {
|
|||
export const FlagsAccordionEntries = ({ flags, update }) => {
|
||||
const [flagList, ns] = flattenFlags(flags)
|
||||
const { t } = useTranslation(nsMerge(ns))
|
||||
const [all, setAll] = useState(flagList)
|
||||
|
||||
if (Object.keys(flagList).length < 1) return null
|
||||
|
||||
|
@ -113,7 +110,7 @@ export const FlagsAccordionEntries = ({ flags, update }) => {
|
|||
|
||||
return (
|
||||
<SubAccordion
|
||||
items={Object.entries(all).map(([key, flag], i) => {
|
||||
items={Object.entries(flagList).map(([key, flag], i) => {
|
||||
const Icon = flagIcons[flag.type]
|
||||
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 { MenuWrapper } from 'shared/components/workbench/menus/shared/menu-wrapper.mjs'
|
||||
import { Flags } from './flags.mjs'
|
||||
|
||||
export const ns = ['common', 'core-settings', 'ui-settings']
|
||||
|
||||
|
@ -17,7 +16,6 @@ export const PatternWithMenu = ({
|
|||
menu,
|
||||
setSettings,
|
||||
Header = false,
|
||||
flags = false,
|
||||
}) => (
|
||||
<PanZoomContextProvider>
|
||||
<div className="flex flex-col h-full">
|
||||
|
@ -34,7 +32,6 @@ export const PatternWithMenu = ({
|
|||
}}
|
||||
/>
|
||||
) : 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="lg:w-2/3 flex flex-col h-full grow px-4">
|
||||
{title}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue