Compare commits
No commits in common. "24a3a03c653c2bb9ff4d3758f530d1ecab2d89a4" and "999c960339f74bafebca268cf2538206f367a357" have entirely different histories.
24a3a03c65
...
999c960339
@ -4027,13 +4027,13 @@ body.objectKanbanColumnResizing * {
|
||||
|
||||
.dashboard-tab-pane {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
// DashboardLayout.js
|
||||
import PropTypes from 'prop-types'
|
||||
import { Layout, Flex } from 'antd'
|
||||
import { useContext } from 'react'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
import ProductionSidebar from './Production/ProductionSidebar'
|
||||
import InventorySidebar from './Inventory/InventorySidebar'
|
||||
@ -17,14 +16,12 @@ import { useThemeContext } from './context/ThemeContext'
|
||||
import { MessageProvider } from './context/MessageContext'
|
||||
import { useDashboardObjectToolsContext } from './context/DashboardObjectToolsContext'
|
||||
import { useMediaQuery } from 'react-responsive'
|
||||
import { ElectronContext } from './context/ElectronContext'
|
||||
|
||||
const { Content } = Layout
|
||||
|
||||
const DashboardLayout = ({ children }) => {
|
||||
const location = useLocation()
|
||||
const isMobile = useMediaQuery({ maxWidth: 768 })
|
||||
const { isElectron } = useContext(ElectronContext)
|
||||
const isProduction = location.pathname.startsWith('/dashboard/production')
|
||||
const isInventory = location.pathname.startsWith('/dashboard/inventory')
|
||||
const isFinance = location.pathname.startsWith('/dashboard/finance')
|
||||
@ -64,11 +61,7 @@ const DashboardLayout = ({ children }) => {
|
||||
className='main-content-layout'
|
||||
>
|
||||
<Content>
|
||||
<Flex
|
||||
vertical
|
||||
style={{ height: '100%' }}
|
||||
gap={isElectron ? '10px' : '20px'}
|
||||
>
|
||||
<Flex vertical style={{ height: '100%' }} gap='20px'>
|
||||
<Flex justify='space-between' align='center'>
|
||||
<DashboardBreadcrumb style={{ margin: '16px 0' }} />
|
||||
{currentObjectTools}
|
||||
|
||||
@ -26,7 +26,7 @@ import { useNavigationTabPage } from '../context/NavigationTabsContext'
|
||||
const { Title, Text } = Typography
|
||||
|
||||
const About = () => {
|
||||
useNavigationTabPage({ title: 'About', iconKey: 'infoCircle' })
|
||||
useNavigationTabPage({ title: 'About' })
|
||||
const [collapseState, updateCollapseState] = useCollapseState('About', {
|
||||
updater: true
|
||||
})
|
||||
|
||||
@ -36,7 +36,7 @@ const LEGACY_ELECTRON_USER_KEYS = [
|
||||
]
|
||||
|
||||
const Settings = () => {
|
||||
useNavigationTabPage({ title: 'Settings', iconKey: 'settings' })
|
||||
useNavigationTabPage({ title: 'Settings' })
|
||||
const {
|
||||
isDarkMode,
|
||||
isCompact,
|
||||
|
||||
@ -125,16 +125,10 @@ const DashboardOverviewPage = ({
|
||||
onOpenActionsModal,
|
||||
sections = []
|
||||
}) => {
|
||||
const overviewSection = pageName.endsWith('Overview')
|
||||
? pageName.slice(0, -'Overview'.length)
|
||||
: ''
|
||||
const overviewTitle = overviewSection
|
||||
? `Overview - ${overviewSection}`
|
||||
const overviewTitle = pageName.endsWith('Overview')
|
||||
? `Overview - ${pageName.slice(0, -'Overview'.length)}`
|
||||
: pageName
|
||||
const overviewIconKey = overviewSection
|
||||
? `${overviewSection.charAt(0).toLowerCase()}${overviewSection.slice(1)}`
|
||||
: undefined
|
||||
useNavigationTabPage({ title: overviewTitle, iconKey: overviewIconKey })
|
||||
useNavigationTabPage({ title: overviewTitle })
|
||||
const [savedCollapseState, updateCollapseState] = useCollapseState(
|
||||
pageName,
|
||||
collapseDefaults
|
||||
|
||||
@ -8,7 +8,6 @@ import PlusIcon from '../../Icons/PlusIcon'
|
||||
import XMarkIcon from '../../Icons/XMarkIcon'
|
||||
import HomeIcon from '../../Icons/HomeIcon'
|
||||
import { getModelByName } from '../../../database/ObjectModels'
|
||||
import { getSidebarIconComponent } from '../../Icons/sidebarIconMap'
|
||||
import { useNavigationTabs, useTabPreview } from '../context/NavigationTabsContext'
|
||||
import { getDesktopWindowId } from '../../../electrobun-bridge.js'
|
||||
import { hasExternalTabDrag, writeTabDragData } from './tabDrag'
|
||||
@ -89,8 +88,7 @@ const DashboardTabItem = ({
|
||||
const [previewOpen, setPreviewOpen] = useState(false)
|
||||
const previewTargetRef = useRef(null)
|
||||
const model = tab.modelName ? getModelByName(tab.modelName) : null
|
||||
const SidebarIcon = getSidebarIconComponent(tab.iconKey)
|
||||
const Icon = model?.icon || SidebarIcon || HomeIcon
|
||||
const Icon = model?.icon || HomeIcon
|
||||
|
||||
const handlePreviewOpenChange = useCallback(
|
||||
(nextOpen) => {
|
||||
@ -156,7 +154,7 @@ const DashboardTabItem = ({
|
||||
trigger='hover'
|
||||
placement='bottom'
|
||||
arrow={false}
|
||||
mouseEnterDelay={1}
|
||||
mouseEnterDelay={0}
|
||||
mouseLeaveDelay={0}
|
||||
destroyOnHidden
|
||||
open={isDragging ? false : previewOpen}
|
||||
@ -180,8 +178,7 @@ DashboardTabItem.propTypes = {
|
||||
tab: PropTypes.shape({
|
||||
id: PropTypes.string.isRequired,
|
||||
title: PropTypes.string,
|
||||
modelName: PropTypes.string,
|
||||
iconKey: PropTypes.string
|
||||
modelName: PropTypes.string
|
||||
}).isRequired,
|
||||
tabIndex: PropTypes.number.isRequired,
|
||||
isSelected: PropTypes.bool,
|
||||
|
||||
@ -72,7 +72,6 @@ const createTabFromLocation = (location, extras = {}) => ({
|
||||
id: createTabId(),
|
||||
title: extras.title || 'Farm Control',
|
||||
modelName: extras.modelName || null,
|
||||
iconKey: extras.iconKey || null,
|
||||
history: [locationToEntry(location)],
|
||||
historyIndex: 0
|
||||
})
|
||||
@ -81,7 +80,6 @@ const cloneCurrentPageTab = (tab, location) => ({
|
||||
id: createTabId(),
|
||||
title: tab?.title || 'Farm Control',
|
||||
modelName: tab?.modelName || null,
|
||||
iconKey: tab?.iconKey || null,
|
||||
history: [locationToEntry(location)],
|
||||
historyIndex: 0
|
||||
})
|
||||
@ -89,73 +87,6 @@ const cloneCurrentPageTab = (tab, location) => ({
|
||||
const getTabCurrentEntry = (tab) =>
|
||||
tab?.history?.[tab.historyIndex] || tab?.history?.[tab.history.length - 1]
|
||||
|
||||
const normalizeHistory = (history, fallbackEntry) => {
|
||||
if (Array.isArray(history) && history.length > 0) {
|
||||
return history.map((item) => locationToEntry(item))
|
||||
}
|
||||
return [fallbackEntry || { pathname: '/', search: '', hash: '' }]
|
||||
}
|
||||
|
||||
const normalizeTab = (tab, fallbackLocation) => {
|
||||
const fallbackEntry = locationToEntry(fallbackLocation)
|
||||
const history = normalizeHistory(tab?.history, fallbackEntry)
|
||||
const rawIndex = Number.isInteger(tab?.historyIndex)
|
||||
? tab.historyIndex
|
||||
: history.length - 1
|
||||
return {
|
||||
id: tab?.id || createTabId(),
|
||||
title: tab?.title || 'Farm Control',
|
||||
modelName: tab?.modelName || null,
|
||||
iconKey: tab?.iconKey || null,
|
||||
history,
|
||||
historyIndex: Math.min(Math.max(rawIndex, 0), history.length - 1)
|
||||
}
|
||||
}
|
||||
|
||||
const applyLocationToTab = (tab, entry) => {
|
||||
if (!tab || !entry) return tab
|
||||
const currentEntry = getTabCurrentEntry(tab)
|
||||
if (entriesEqual(currentEntry, entry)) return tab
|
||||
if (!tab.history?.length) {
|
||||
return { ...tab, history: [entry], historyIndex: 0 }
|
||||
}
|
||||
const truncated = tab.history.slice(0, tab.historyIndex + 1)
|
||||
return {
|
||||
...tab,
|
||||
history: [...truncated, entry],
|
||||
historyIndex: truncated.length
|
||||
}
|
||||
}
|
||||
|
||||
const applyPageMetaToTab = (tab, { title, modelName, iconKey } = {}) => {
|
||||
const nextModelName =
|
||||
modelName === undefined
|
||||
? iconKey !== undefined
|
||||
? null
|
||||
: tab.modelName
|
||||
: modelName || null
|
||||
const nextIconKey =
|
||||
iconKey === undefined
|
||||
? modelName !== undefined
|
||||
? null
|
||||
: tab.iconKey
|
||||
: iconKey || null
|
||||
const nextTitle = title || tab.title
|
||||
if (
|
||||
nextTitle === tab.title &&
|
||||
nextModelName === tab.modelName &&
|
||||
nextIconKey === tab.iconKey
|
||||
) {
|
||||
return tab
|
||||
}
|
||||
return {
|
||||
...tab,
|
||||
title: nextTitle,
|
||||
modelName: nextModelName,
|
||||
iconKey: nextIconKey
|
||||
}
|
||||
}
|
||||
|
||||
export const NavigationTabsProvider = ({ children }) => {
|
||||
const navigate = useNavigate()
|
||||
const location = useLocation()
|
||||
@ -182,53 +113,20 @@ export const NavigationTabsProvider = ({ children }) => {
|
||||
const [tabPreviewCapturing, setTabPreviewCapturing] = useState({})
|
||||
const tabsRef = useRef(tabs)
|
||||
const activeTabIdRef = useRef(activeTabId)
|
||||
const locationRef = useRef(location)
|
||||
const previousActiveTabIdRef = useRef(null)
|
||||
const isRestoringRef = useRef(null)
|
||||
const isRestoringRef = useRef(false)
|
||||
const tabPaneElsRef = useRef(new Map())
|
||||
const captureQueueRef = useRef(Promise.resolve())
|
||||
const captureInFlightRef = useRef(new Map())
|
||||
const previewThemeRef = useRef(isDarkMode ? 'dark' : 'light')
|
||||
tabsRef.current = tabs
|
||||
activeTabIdRef.current = activeTabId
|
||||
locationRef.current = location
|
||||
previewThemeRef.current = isDarkMode ? 'dark' : 'light'
|
||||
|
||||
const isRestoreLocation = useCallback((entry) => {
|
||||
const restoring = isRestoringRef.current
|
||||
if (!restoring) return false
|
||||
if (restoring === true) return true
|
||||
return (
|
||||
entriesEqual(restoring.target, entry) ||
|
||||
entriesEqual(restoring.from, entry)
|
||||
)
|
||||
}, [])
|
||||
|
||||
const shouldIgnoreRestoredLocation = useCallback((entry) => {
|
||||
const restoring = isRestoringRef.current
|
||||
if (!restoring) return false
|
||||
if (restoring === true) {
|
||||
isRestoringRef.current = null
|
||||
return true
|
||||
}
|
||||
if (entriesEqual(restoring.target, entry)) {
|
||||
isRestoringRef.current = null
|
||||
return true
|
||||
}
|
||||
if (entriesEqual(restoring.from, entry)) {
|
||||
return true
|
||||
}
|
||||
isRestoringRef.current = null
|
||||
return false
|
||||
}, [])
|
||||
|
||||
const restoreToEntry = useCallback(
|
||||
(entry) => {
|
||||
if (!entry) return
|
||||
isRestoringRef.current = {
|
||||
target: locationToEntry(entry),
|
||||
from: locationToEntry(locationRef.current)
|
||||
}
|
||||
isRestoringRef.current = true
|
||||
navigate(entryToPath(entry), { replace: true })
|
||||
},
|
||||
[navigate]
|
||||
@ -243,13 +141,13 @@ export const NavigationTabsProvider = ({ children }) => {
|
||||
const nextEntry = getTabCurrentEntry(nextTab)
|
||||
setActiveTabId(tabId)
|
||||
|
||||
if (entriesEqual(nextEntry, locationRef.current)) {
|
||||
if (entriesEqual(nextEntry, location)) {
|
||||
return
|
||||
}
|
||||
|
||||
restoreToEntry(nextEntry)
|
||||
},
|
||||
[restoreToEntry]
|
||||
[location, restoreToEntry]
|
||||
)
|
||||
|
||||
const addTab = useCallback(() => {
|
||||
@ -296,13 +194,13 @@ export const NavigationTabsProvider = ({ children }) => {
|
||||
if (nextActive) {
|
||||
setActiveTabId(nextActive.id)
|
||||
const nextEntry = getTabCurrentEntry(nextActive)
|
||||
if (!entriesEqual(nextEntry, locationRef.current)) {
|
||||
if (!entriesEqual(nextEntry, location)) {
|
||||
restoreToEntry(nextEntry)
|
||||
}
|
||||
}
|
||||
return true
|
||||
},
|
||||
[handleWindowControl, restoreToEntry]
|
||||
[handleWindowControl, location, restoreToEntry]
|
||||
)
|
||||
|
||||
const closeTab = useCallback(
|
||||
@ -315,30 +213,29 @@ export const NavigationTabsProvider = ({ children }) => {
|
||||
const acceptIncomingTab = useCallback(
|
||||
(incomingTab, targetId, insertBefore = false) => {
|
||||
if (!incomingTab?.id) return
|
||||
const tab = normalizeTab(incomingTab, locationRef.current)
|
||||
|
||||
setTabs((current) => {
|
||||
if (current.some((item) => item.id === tab.id)) {
|
||||
if (current.some((tab) => tab.id === incomingTab.id)) {
|
||||
return current
|
||||
}
|
||||
|
||||
const next = [...current]
|
||||
const targetIndex = next.findIndex((item) => item.id === targetId)
|
||||
const targetIndex = next.findIndex((tab) => tab.id === targetId)
|
||||
if (targetIndex === -1) {
|
||||
next.push(tab)
|
||||
next.push(incomingTab)
|
||||
return next
|
||||
}
|
||||
|
||||
next.splice(insertBefore ? targetIndex : targetIndex + 1, 0, tab)
|
||||
next.splice(insertBefore ? targetIndex : targetIndex + 1, 0, incomingTab)
|
||||
return next
|
||||
})
|
||||
setActiveTabId(tab.id)
|
||||
const nextEntry = getTabCurrentEntry(tab)
|
||||
if (!entriesEqual(nextEntry, locationRef.current)) {
|
||||
setActiveTabId(incomingTab.id)
|
||||
const nextEntry = getTabCurrentEntry(incomingTab)
|
||||
if (!entriesEqual(nextEntry, location)) {
|
||||
restoreToEntry(nextEntry)
|
||||
}
|
||||
},
|
||||
[restoreToEntry]
|
||||
[location, restoreToEntry]
|
||||
)
|
||||
|
||||
const handleTabDragStart = useCallback(
|
||||
@ -481,31 +378,22 @@ export const NavigationTabsProvider = ({ children }) => {
|
||||
void captureTabPreview(previousId)
|
||||
}, [activeTabId, captureTabPreview, hydrated])
|
||||
|
||||
const setTabPage = useCallback(
|
||||
({ title, modelName, iconKey, location: pageLocation } = {}) => {
|
||||
const activeId = activeTabIdRef.current
|
||||
if (!activeId) return
|
||||
const setTabPage = useCallback(({ title, modelName } = {}) => {
|
||||
const activeId = activeTabIdRef.current
|
||||
if (!activeId) return
|
||||
|
||||
const pageEntry = pageLocation ? locationToEntry(pageLocation) : null
|
||||
|
||||
setTabs((current) => {
|
||||
if (current.length === 0) return current
|
||||
|
||||
let changed = false
|
||||
const next = current.map((tab) => {
|
||||
if (tab.id !== activeId) return tab
|
||||
let updated = applyPageMetaToTab(tab, { title, modelName, iconKey })
|
||||
if (pageEntry && !isRestoreLocation(pageEntry)) {
|
||||
updated = applyLocationToTab(updated, pageEntry)
|
||||
}
|
||||
if (updated !== tab) changed = true
|
||||
return updated
|
||||
})
|
||||
return changed ? next : current
|
||||
setTabs((current) =>
|
||||
current.map((tab) => {
|
||||
if (tab.id !== activeId) return tab
|
||||
return {
|
||||
...tab,
|
||||
title: title || tab.title,
|
||||
modelName:
|
||||
modelName === undefined ? tab.modelName : modelName || null
|
||||
}
|
||||
})
|
||||
},
|
||||
[isRestoreLocation]
|
||||
)
|
||||
)
|
||||
}, [])
|
||||
|
||||
const goBack = useCallback(() => {
|
||||
const currentTab = tabsRef.current.find(
|
||||
@ -569,24 +457,22 @@ export const NavigationTabsProvider = ({ children }) => {
|
||||
if (cancelled) return
|
||||
|
||||
if (session?.tabs?.length) {
|
||||
const restoredTabs = session.tabs.map((tab) =>
|
||||
normalizeTab(tab, location)
|
||||
)
|
||||
setTabs(restoredTabs)
|
||||
isRestoringRef.current = true
|
||||
setTabs(session.tabs)
|
||||
const nextActiveId =
|
||||
session.activeTabId &&
|
||||
restoredTabs.some((tab) => tab.id === session.activeTabId)
|
||||
session.tabs.some((tab) => tab.id === session.activeTabId)
|
||||
? session.activeTabId
|
||||
: restoredTabs[0].id
|
||||
: session.tabs[0].id
|
||||
setActiveTabId(nextActiveId)
|
||||
const activeTab =
|
||||
restoredTabs.find((tab) => tab.id === nextActiveId) ||
|
||||
restoredTabs[0]
|
||||
session.tabs.find((tab) => tab.id === nextActiveId) ||
|
||||
session.tabs[0]
|
||||
const entry = getTabCurrentEntry(activeTab)
|
||||
if (!entriesEqual(entry, location)) {
|
||||
restoreToEntry(entry)
|
||||
} else {
|
||||
isRestoringRef.current = null
|
||||
isRestoringRef.current = false
|
||||
}
|
||||
} else {
|
||||
const initialTab = createTabFromLocation(location)
|
||||
@ -607,10 +493,12 @@ export const NavigationTabsProvider = ({ children }) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (!isElectron || !hydrated) return
|
||||
if (isRestoringRef.current) {
|
||||
isRestoringRef.current = false
|
||||
return
|
||||
}
|
||||
|
||||
const entry = locationToEntry(location)
|
||||
if (shouldIgnoreRestoredLocation(entry)) return
|
||||
|
||||
setTabs((current) => {
|
||||
if (current.length === 0) {
|
||||
const initialTab = createTabFromLocation(location)
|
||||
@ -618,16 +506,20 @@ export const NavigationTabsProvider = ({ children }) => {
|
||||
return [initialTab]
|
||||
}
|
||||
|
||||
let changed = false
|
||||
const next = current.map((tab) => {
|
||||
return current.map((tab) => {
|
||||
if (tab.id !== activeTabIdRef.current) return tab
|
||||
const updated = applyLocationToTab(tab, entry)
|
||||
if (updated !== tab) changed = true
|
||||
return updated
|
||||
const currentEntry = getTabCurrentEntry(tab)
|
||||
if (entriesEqual(currentEntry, entry)) return tab
|
||||
|
||||
const truncated = tab.history.slice(0, tab.historyIndex + 1)
|
||||
return {
|
||||
...tab,
|
||||
history: [...truncated, entry],
|
||||
historyIndex: truncated.length
|
||||
}
|
||||
})
|
||||
return changed ? next : current
|
||||
})
|
||||
}, [hydrated, isElectron, location, shouldIgnoreRestoredLocation])
|
||||
}, [hydrated, isElectron, location])
|
||||
|
||||
useEffect(() => {
|
||||
if (!isElectron || !hydrated || !syncWindowTabs) return undefined
|
||||
@ -778,22 +670,21 @@ export const useTabPreview = (tabId) => {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components
|
||||
export const useNavigationTabPage = ({ title, modelName, iconKey } = {}) => {
|
||||
export const useNavigationTabPage = ({ title, modelName } = {}) => {
|
||||
const { setTabPage, isElectron } = useContext(NavigationTabMetaContext)
|
||||
const store = useContext(NavigationTabActiveContext)
|
||||
const pageLocation = useLocation()
|
||||
|
||||
useEffect(() => {
|
||||
if (!isElectron || !title) return undefined
|
||||
|
||||
const sync = () => {
|
||||
if (!store.getSnapshot()) return
|
||||
setTabPage({ title, modelName, iconKey, location: pageLocation })
|
||||
setTabPage({ title, modelName })
|
||||
}
|
||||
|
||||
sync()
|
||||
return store.subscribe(sync)
|
||||
}, [iconKey, isElectron, modelName, pageLocation, setTabPage, store, title])
|
||||
}, [isElectron, modelName, setTabPage, store, title])
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components
|
||||
|
||||
@ -62,91 +62,79 @@ import MailIcon from './MailIcon'
|
||||
import EmailAccountIcon from './EmailAccountIcon'
|
||||
import EmailTemplateIcon from './EmailTemplateIcon'
|
||||
|
||||
const makeEmojiIcon = (emoji) => {
|
||||
const EmojiIcon = (props) => (
|
||||
<span aria-hidden {...props}>
|
||||
{emoji}
|
||||
</span>
|
||||
)
|
||||
return EmojiIcon
|
||||
}
|
||||
const toEmoji = (emoji) => <span aria-hidden>{emoji}</span>
|
||||
|
||||
const sidebarIconComponents = {
|
||||
production: ProductionIcon,
|
||||
printer: PrinterIcon,
|
||||
printerProfile: PrinterProfileIcon,
|
||||
filamentProfile: FilamentProfileIcon,
|
||||
job: JobIcon,
|
||||
subJob: SubJobIcon,
|
||||
gcodeFile: GCodeFileIcon,
|
||||
inventory: InventoryIcon,
|
||||
filamentStock: FilamentStockIcon,
|
||||
partStock: PartStockIcon,
|
||||
productStock: ProductStockIcon,
|
||||
stockEvent: StockEventIcon,
|
||||
stockAudit: StockAuditIcon,
|
||||
stockAuditLevel: StockAuditLevelIcon,
|
||||
purchaseOrder: PurchaseOrderIcon,
|
||||
orderItem: OrderItemIcon,
|
||||
shipment: ShipmentIcon,
|
||||
stockLocation: StockLocationIcon,
|
||||
stockTransfer: StockTransferIcon,
|
||||
sales: SalesIcon,
|
||||
client: ClientIcon,
|
||||
salesOrder: SalesOrderIcon,
|
||||
marketplace: MarketplaceIcon,
|
||||
listing: ListingIcon,
|
||||
listingVarient: ListingVarientIcon,
|
||||
fulfillmentPolicy: FulfillmentPolicyIcon,
|
||||
returnPolicy: ReturnPolicyIcon,
|
||||
paymentPolicy: PaymentPolicyIcon,
|
||||
finance: FinanceIcon,
|
||||
invoice: InvoiceIcon,
|
||||
payment: PaymentIcon,
|
||||
filament: FilamentIcon,
|
||||
filamentSku: FilamentSkuIcon,
|
||||
part: PartIcon,
|
||||
partSku: PartSkuIcon,
|
||||
product: ProductIcon,
|
||||
productCategory: ProductCategoryIcon,
|
||||
productSku: ProductSkuIcon,
|
||||
vendor: VendorIcon,
|
||||
material: MaterialIcon,
|
||||
noteType: NoteTypeIcon,
|
||||
settings: SettingsIcon,
|
||||
auditLog: AuditLogIcon,
|
||||
developer: DeveloperIcon,
|
||||
person: PersonIcon,
|
||||
userGroup: PersonGroupIcon,
|
||||
permissionSetting: PermissionSettingIcon,
|
||||
host: HostIcon,
|
||||
documentPrinter: DocumentPrinterIcon,
|
||||
documentTemplate: DocumentTemplateIcon,
|
||||
document: DocumentIcon,
|
||||
documentSize: DocumentSizeIcon,
|
||||
documentJob: DocumentJobIcon,
|
||||
file: FileIcon,
|
||||
courier: CourierIcon,
|
||||
courierService: CourierServiceIcon,
|
||||
taxRate: TaxRateIcon,
|
||||
taxRecord: TaxRecordIcon,
|
||||
appPassword: AppPasswordIcon,
|
||||
email: MailIcon,
|
||||
emailAccount: EmailAccountIcon,
|
||||
emailTemplate: EmailTemplateIcon,
|
||||
emailMessage: MailIcon,
|
||||
infoCircle: InfoCircleIcon,
|
||||
sessionStorage: makeEmojiIcon('🗃️'),
|
||||
authDebug: makeEmojiIcon('🔐'),
|
||||
apiDebug: makeEmojiIcon('🌐')
|
||||
}
|
||||
|
||||
export const getSidebarIconComponent = (iconKey) => {
|
||||
if (!iconKey) return null
|
||||
return sidebarIconComponents[iconKey] || null
|
||||
const sidebarIconMap = {
|
||||
production: <ProductionIcon />,
|
||||
printer: <PrinterIcon />,
|
||||
printerProfile: <PrinterProfileIcon />,
|
||||
filamentProfile: <FilamentProfileIcon />,
|
||||
job: <JobIcon />,
|
||||
subJob: <SubJobIcon />,
|
||||
gcodeFile: <GCodeFileIcon />,
|
||||
inventory: <InventoryIcon />,
|
||||
filamentStock: <FilamentStockIcon />,
|
||||
partStock: <PartStockIcon />,
|
||||
productStock: <ProductStockIcon />,
|
||||
stockEvent: <StockEventIcon />,
|
||||
stockAudit: <StockAuditIcon />,
|
||||
stockAuditLevel: <StockAuditLevelIcon />,
|
||||
purchaseOrder: <PurchaseOrderIcon />,
|
||||
orderItem: <OrderItemIcon />,
|
||||
shipment: <ShipmentIcon />,
|
||||
stockLocation: <StockLocationIcon />,
|
||||
stockTransfer: <StockTransferIcon />,
|
||||
sales: <SalesIcon />,
|
||||
client: <ClientIcon />,
|
||||
salesOrder: <SalesOrderIcon />,
|
||||
marketplace: <MarketplaceIcon />,
|
||||
listing: <ListingIcon />,
|
||||
listingVarient: <ListingVarientIcon />,
|
||||
fulfillmentPolicy: <FulfillmentPolicyIcon />,
|
||||
returnPolicy: <ReturnPolicyIcon />,
|
||||
paymentPolicy: <PaymentPolicyIcon />,
|
||||
finance: <FinanceIcon />,
|
||||
invoice: <InvoiceIcon />,
|
||||
payment: <PaymentIcon />,
|
||||
filament: <FilamentIcon />,
|
||||
filamentSku: <FilamentSkuIcon />,
|
||||
part: <PartIcon />,
|
||||
partSku: <PartSkuIcon />,
|
||||
product: <ProductIcon />,
|
||||
productCategory: <ProductCategoryIcon />,
|
||||
productSku: <ProductSkuIcon />,
|
||||
vendor: <VendorIcon />,
|
||||
material: <MaterialIcon />,
|
||||
noteType: <NoteTypeIcon />,
|
||||
settings: <SettingsIcon />,
|
||||
auditLog: <AuditLogIcon />,
|
||||
developer: <DeveloperIcon />,
|
||||
person: <PersonIcon />,
|
||||
userGroup: <PersonGroupIcon />,
|
||||
permissionSetting: <PermissionSettingIcon />,
|
||||
host: <HostIcon />,
|
||||
documentPrinter: <DocumentPrinterIcon />,
|
||||
documentTemplate: <DocumentTemplateIcon />,
|
||||
document: <DocumentIcon />,
|
||||
documentSize: <DocumentSizeIcon />,
|
||||
documentJob: <DocumentJobIcon />,
|
||||
file: <FileIcon />,
|
||||
courier: <CourierIcon />,
|
||||
courierService: <CourierServiceIcon />,
|
||||
taxRate: <TaxRateIcon />,
|
||||
taxRecord: <TaxRecordIcon />,
|
||||
appPassword: <AppPasswordIcon />,
|
||||
email: <MailIcon />,
|
||||
emailAccount: <EmailAccountIcon />,
|
||||
emailTemplate: <EmailTemplateIcon />,
|
||||
emailMessage: <MailIcon />,
|
||||
infoCircle: <InfoCircleIcon />,
|
||||
sessionStorage: toEmoji('🗃️'),
|
||||
authDebug: toEmoji('🔐'),
|
||||
apiDebug: toEmoji('🌐')
|
||||
}
|
||||
|
||||
export const getSidebarIconNode = (iconKey) => {
|
||||
const Icon = getSidebarIconComponent(iconKey)
|
||||
return Icon ? <Icon /> : null
|
||||
if (!iconKey) return null
|
||||
return sidebarIconMap[iconKey] || null
|
||||
}
|
||||
|
||||
@ -471,7 +471,6 @@ function createDefaultTab() {
|
||||
id,
|
||||
title: 'Overview - Production',
|
||||
modelName: null,
|
||||
iconKey: 'production',
|
||||
history: [
|
||||
{
|
||||
pathname: DEFAULT_DASHBOARD_PATH,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user