1
- import { MexIcon } from '@style/Layouts'
2
- import React , { useEffect , useMemo , useState } from 'react'
3
- import { tinykeys } from '@workduck-io/tinykeys'
1
+ import Tabs , { TabType } from '@components/layouts/Tabs'
2
+ import Graph from '@components/mex/Graph/Graph'
3
+ import RemindersInfobar from '@components/mex/Reminders/Reminders'
4
+ import DataInfoBar from '@components/mex/Sidebar/DataInfoBar'
4
5
import { useGraphData } from '@hooks/useGraphData'
5
6
import useLayout from '@hooks/useLayout'
6
7
import { useKeyListener } from '@hooks/useShortcutListener'
7
8
import useToggleElements from '@hooks/useToggleElements'
9
+ import bubbleChartLine from '@iconify/icons-ri/bubble-chart-line'
10
+ import quillPenLine from '@iconify/icons-ri/quill-pen-line'
11
+ import timerFlashLine from '@iconify/icons-ri/timer-flash-line'
8
12
import { useHelpStore } from '@store/useHelpStore'
9
13
import { InfobarMode , useLayoutStore } from '@store/useLayoutStore'
10
14
import useSuggestionStore from '@store/useSuggestionStore'
11
15
import { InfoBarWrapper } from '@style/infobar'
12
- import Graph from '@components/mex/Graph/Graph'
13
- import RemindersInfobar from '@components/mex/Reminders/Reminders'
14
- import DataInfoBar from '@components/mex/Sidebar/DataInfoBar'
15
- import SuggestionInfoBar from '@components/mex/Suggestions'
16
- import Tabs , { TabType } from '@components/layouts/Tabs'
17
- import bubbleChartLine from '@iconify/icons-ri/bubble-chart-line'
18
- import lightbulbFlashLine from '@iconify/icons-ri/lightbulb-flash-line'
19
- import timerFlashLine from '@iconify/icons-ri/timer-flash-line'
20
- import { useShortcutStore } from '@store/useShortcutStore'
16
+ import { MexIcon } from '@style/Layouts'
17
+ import { mog } from '@workduck-io/mex-utils'
18
+ import { tinykeys } from '@workduck-io/tinykeys'
19
+ import React , { useEffect , useMemo } from 'react'
20
+ import SnippetSidebar from '../Sidebar/SnippetSidebar'
21
21
22
22
const InfoBarItems = ( ) => {
23
23
const graphData = useGraphData ( )
24
24
const infobar = useLayoutStore ( ( s ) => s . infobar )
25
25
const shortcuts = useHelpStore ( ( store ) => store . shortcuts )
26
26
const setInfobarMode = useLayoutStore ( ( s ) => s . setInfobarMode )
27
+ const wrapperRef = React . useRef < HTMLDivElement > ( null )
27
28
29
+ mog ( 'infobar' , { shortcuts } )
28
30
// Ensure the tabs have InfobarType in type
29
31
const tabs : Array < TabType > = useMemo (
30
32
( ) => [
31
33
{
32
34
label : < MexIcon noHover icon = "fluent:content-view-gallery-24-regular" width = { 24 } height = { 24 } /> ,
33
35
type : 'default' ,
34
- component : < DataInfoBar /> ,
36
+ component : < DataInfoBar wrapRef = { wrapperRef } /> ,
35
37
tooltip : 'Context'
36
38
} ,
37
39
{
38
- label : < MexIcon noHover icon = { lightbulbFlashLine } width = { 24 } height = { 24 } /> ,
39
- type : 'suggestions ' ,
40
- component : < SuggestionInfoBar /> ,
41
- tooltip : 'Suggestions ' ,
42
- shortcut : shortcuts . showSuggestedNodes . keystrokes
40
+ label : < MexIcon noHover icon = { quillPenLine } width = { 24 } height = { 24 } /> ,
41
+ type : 'snippets ' ,
42
+ component : < SnippetSidebar /> ,
43
+ tooltip : 'Snippets ' ,
44
+ shortcut : shortcuts . showSnippetSidebar . keystrokes
43
45
} ,
44
46
{
45
47
label : < MexIcon noHover icon = { timerFlashLine } width = { 24 } height = { 24 } /> ,
@@ -62,6 +64,7 @@ const InfoBarItems = () => {
62
64
< Tabs
63
65
visible = { true }
64
66
openedTab = { infobar . mode }
67
+ wrapperRef = { wrapperRef }
65
68
onChange = { ( tab ) => {
66
69
setInfobarMode ( tab as InfobarMode )
67
70
} }
@@ -77,7 +80,7 @@ const InfoBar = () => {
77
80
78
81
const infobar = useLayoutStore ( ( s ) => s . infobar )
79
82
const pinnedSuggestions = useSuggestionStore ( ( s ) => s . pinnedSuggestions )
80
- const { toggleGraph, toggleSuggestedNodes , toggleReminder } = useToggleElements ( )
83
+ const { toggleGraph, toggleSnippets , toggleReminder } = useToggleElements ( )
81
84
const { shortcutHandler } = useKeyListener ( )
82
85
83
86
useEffect ( ( ) => {
@@ -94,10 +97,10 @@ const InfoBar = () => {
94
97
// toggleSyncBlocks()
95
98
// })
96
99
// },
97
- [ shortcuts . showSuggestedNodes . keystrokes ] : ( event ) => {
100
+ [ shortcuts . showSnippetSidebar . keystrokes ] : ( event ) => {
98
101
event . preventDefault ( )
99
- shortcutHandler ( shortcuts . showSuggestedNodes , ( ) => {
100
- toggleSuggestedNodes ( )
102
+ shortcutHandler ( shortcuts . showSnippetSidebar , ( ) => {
103
+ toggleSnippets ( )
101
104
} )
102
105
} ,
103
106
[ shortcuts . showReminder . keystrokes ] : ( event ) => {
0 commit comments