@motiadev/workbench 0.8.2-beta.140-364012 → 0.8.2-beta.140-930160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/App.js CHANGED
@@ -1,36 +1,31 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useMemo } from 'react';
2
+ import { useMemo } from 'react';
3
3
  import { FlowPage } from './components/flow/flow-page';
4
4
  import { FlowTabMenuItem } from './components/flow/flow-tab-menu-item';
5
5
  import { registerPluginTabs } from './lib/plugins';
6
6
  import { getViewModeFromURL } from './lib/utils';
7
7
  import { ProjectViewMode } from './project-view-mode';
8
- import { TabLocation, useAppTabsStore } from './stores/use-app-tabs-store';
8
+ import { setAppTabs, TabLocation } from './stores/use-app-tabs-store';
9
9
  import { SystemViewMode } from './system-view-mode';
10
10
  const TAB_IDS = {
11
11
  FLOW: 'flow',
12
12
  LOGS: 'logs',
13
13
  };
14
- const topTabs = [
15
- {
16
- id: TAB_IDS.FLOW,
17
- tabLabel: FlowTabMenuItem,
18
- content: FlowPage,
19
- },
20
- ];
14
+ const registerDefaultTabs = () => {
15
+ const topTabs = [
16
+ {
17
+ id: TAB_IDS.FLOW,
18
+ tabLabel: FlowTabMenuItem,
19
+ content: FlowPage,
20
+ },
21
+ ];
22
+ const bottomTabs = [];
23
+ setAppTabs(TabLocation.TOP, topTabs);
24
+ setAppTabs(TabLocation.BOTTOM, bottomTabs);
25
+ };
26
+ registerDefaultTabs();
27
+ registerPluginTabs();
21
28
  export const App = () => {
22
- const setTabs = useAppTabsStore((state) => state.setTabs);
23
- const addTab = useAppTabsStore((state) => state.addTab);
24
- useEffect(() => {
25
- const timeout = setTimeout(() => {
26
- console.log('registering default tabs');
27
- setTabs(TabLocation.TOP, topTabs);
28
- console.log('registering plugin tabs');
29
- registerPluginTabs(addTab);
30
- console.log('registered tabs');
31
- }, 10);
32
- return () => clearTimeout(timeout);
33
- }, [setTabs, addTab]);
34
29
  const viewMode = useMemo(getViewModeFromURL, []);
35
30
  const ViewComponent = viewMode === 'project' ? ProjectViewMode : SystemViewMode;
36
31
  return _jsx(ViewComponent, {});
@@ -1,2 +1 @@
1
- import { type AppTab, TabLocation } from '@/stores/use-app-tabs-store';
2
- export declare const registerPluginTabs: (addTab: (position: TabLocation, tab: AppTab) => void) => void;
1
+ export declare const registerPluginTabs: () => void;
@@ -2,14 +2,13 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { plugins } from 'virtual:motia-plugins';
3
3
  import { DynamicIcon, dynamicIconImports } from 'lucide-react/dynamic';
4
4
  import { memo } from 'react';
5
- import { TabLocation } from '@/stores/use-app-tabs-store';
5
+ import { addAppTab, TabLocation } from '@/stores/use-app-tabs-store';
6
6
  import { isValidTabLocation } from './utils';
7
- export const registerPluginTabs = (addTab) => {
7
+ export const registerPluginTabs = () => {
8
8
  if (!Array.isArray(plugins)) {
9
9
  console.warn('[Motia] Invalid plugins configuration: expected array');
10
10
  return;
11
11
  }
12
- console.log('[Motia] Registering plugins:', plugins);
13
12
  plugins.forEach((plugin, index) => {
14
13
  try {
15
14
  if (!plugin.label) {
@@ -43,7 +42,7 @@ export const registerPluginTabs = (addTab) => {
43
42
  return _jsx(Component, { ...props });
44
43
  });
45
44
  PluginContent.displayName = `${plugin.label}Content`;
46
- addTab(tabLocation, {
45
+ addAppTab(tabLocation, {
47
46
  id: plugin.label.toLowerCase(),
48
47
  tabLabel: PluginTabLabel,
49
48
  content: PluginContent,
@@ -30,10 +30,8 @@ export const useAppTabsStore = create((set) => ({
30
30
  })),
31
31
  }));
32
32
  export const setAppTabs = (position, tabs) => {
33
- console.log('[Motia] Setting tabs:', position, tabs);
34
33
  useAppTabsStore.getState().setTabs(position, tabs);
35
34
  };
36
35
  export const addAppTab = (position, tab) => {
37
- console.log('[Motia] Adding tab:', position, tab);
38
36
  useAppTabsStore.getState().addTab(position, tab);
39
37
  };