Skip to content

Commit 5d17136

Browse files
committed
update styles
1 parent 4cc2336 commit 5d17136

File tree

9 files changed

+186
-75
lines changed

9 files changed

+186
-75
lines changed

src/components/variableInspectorSidebar.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class VariableInspectorSidebarWidget extends ReactWidget {
2323
this.commands = commands
2424
this.id = 'my-plugin::empty-sidebar'
2525
this.title.icon = pluginIcon
26-
this.title.caption = 'My Plugin'
26+
this.title.caption = 'Variable Inspector'
2727
this.addClass('mljar-plugin-sidebar-widget')
2828
}
2929

@@ -47,17 +47,15 @@ export class VariableInspectorSidebarWidget extends ReactWidget {
4747
this.update()
4848
}
4949
}
50+
51+
console.log(this.commands)
5052
return (
5153
<PluginVisibilityContext.Provider value={contextValue}>
5254
<NotebookPanelContextProvider notebookWatcher={this.notebookWatcher}>
5355
<NotebookKernelContextProvider notebookWatcher={this.notebookWatcher}>
5456
<VariableContextProvider>
5557
<KernelIdleWatcherContextProvider>
5658
<VariableListComponent />
57-
58-
<button onClick={() => this.commands.execute('custom:open-variable-inspector')}>
59-
Hello
60-
</button>
6159
</KernelIdleWatcherContextProvider>
6260
</VariableContextProvider>
6361
</NotebookKernelContextProvider>

src/components/variableItem.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
import React from 'react';
1+
import React from 'react'
2+
import { detailIcon } from '../icons/detailIcon'
23

34
interface VariableInfo {
4-
name: string;
5-
type: string;
6-
shape: string;
5+
name: string
6+
type: string
7+
shape: string
78
}
89

910
interface VariableItemProps {
10-
vrb: VariableInfo;
11+
vrb: VariableInfo
1112
}
1213

13-
export const VariableItem: React.FC<VariableItemProps> = ({ vrb }) => {
14+
const handleButtonClick = () => {
15+
console.log("Click")
16+
}
1417

18+
export const VariableItem: React.FC<VariableItemProps> = ({ vrb }) => {
1519
return (
1620
<li className='mljar-variable-item'>
1721
<span className='mljar-variable-name'>{vrb.name}</span>
1822
<span className='mljar-variable-type'>{vrb.type}</span>
1923
<span className='mljar-variable-shape'>{vrb.shape}</span>
20-
{
21-
/* <button
24+
<button
2225
className='mljar-show-variable-button'
2326
onClick={handleButtonClick}
2427
aria-label={`Show details for ${vrb.name}`}
2528
>
26-
Show
27-
</button> */
28-
}
29+
<detailIcon.react className='mljar-variable-detail-button-icon' />
30+
</button>
2931
</li>
30-
);
31-
};
32+
)
33+
}
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import React from 'react';
22
import { VariableList } from './variableList';
33
import { SearchBar } from './searchBar';
4-
4+
import { RefreshButton } from './variableRefreshButton';
55

66
export const VariableListComponent: React.FC = () => {
7-
8-
97
return (
10-
<div className="mljar-variable-container">
11-
<div className="mljar-variable-header-container">
12-
<h3 className="mljar-variable-header">Variable Inspector</h3>
8+
<div className="mljar-variable-container">
9+
<div className="mljar-variable-header-container">
10+
<h3 className="mljar-variable-header">Variable Inspector</h3>
11+
</div>
12+
<div>
13+
<div className="mljar-actions-container">
14+
<RefreshButton />
1315
</div>
14-
<div>
15-
<SearchBar />
16-
<VariableList/>
17-
</div>
16+
<SearchBar />
17+
<VariableList />
1818
</div>
19+
</div>
1920
);
2021
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { refreshIcon } from "../icons/refreshIcon"
2+
import React from 'react';
3+
import { useVariableContext } from '../context/notebookVariableContext'
4+
5+
6+
7+
export const RefreshButton: React.FC = () => {
8+
const { refreshVariables } = useVariableContext();
9+
10+
return (
11+
<button
12+
className="mljar-refresh-button"
13+
onClick={refreshVariables}
14+
title="Refresh Packages"
15+
>
16+
<refreshIcon.react className="mljar-refresh-icon" />
17+
{'Refresh'}
18+
</button>
19+
);
20+
};
21+

src/context/kernelStatusContext.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ export const KernelIdleWatcherContextProvider: React.FC<{ children: React.ReactN
1212
const [hasRefreshed, setHasRefreshed] = useState(false)
1313
const { refreshVariables, isRefreshing } = useVariableContext()
1414

15-
16-
17-
1815
useEffect(() => {
1916
if (!notebookPanel || !notebookPanel.sessionContext) return
2017
const kernel = notebookPanel.sessionContext?.session?.kernel
@@ -28,8 +25,6 @@ export const KernelIdleWatcherContextProvider: React.FC<{ children: React.ReactN
2825
}
2926
}, [notebookPanel?.sessionContext?.session?.kernel])
3027

31-
32-
3328
// first idea to solve the problem, code might be unstable
3429
useEffect(() => {
3530
//clearing timeout
@@ -69,7 +64,7 @@ export const KernelIdleWatcherContextProvider: React.FC<{ children: React.ReactN
6964
timerRef.current = null
7065
}
7166
}
72-
}, [kernelStatus,notebookPanel,refreshVariables, hasRefreshed])
67+
}, [kernelStatus,notebookPanel, refreshVariables, hasRefreshed])
7368

7469
return (
7570
<KernelIdleWatcherContext.Provider value={{ kernelStatus }}>

src/icons/detailIcon.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { LabIcon } from '@jupyterlab/ui-components';
2+
3+
const svgStr = `
4+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-matrix"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M8 16h.013" /><path d="M12.01 16h.005" /><path d="M16.015 16h.005" /><path d="M16.015 12h.005" /><path d="M8.01 12h.005" /><path d="M12.01 12h.005" /><path d="M16.02 8h.005" /><path d="M8.015 8h.005" /><path d="M12.015 8h.005" /><path d="M7 4h-1a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h1" /><path d="M17 4h1a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-1" /></svg>
5+
`;
6+
7+
export const detailIcon = new LabIcon({
8+
name: 'detail-plugin-icon',
9+
svgstr: svgStr,
10+
});
11+

src/icons/refreshIcon.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { LabIcon } from '@jupyterlab/ui-components';
2+
3+
const svgStr = `
4+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-refresh"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4" /><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4" /></svg>
5+
`;
6+
7+
export const refreshIcon = new LabIcon({
8+
name: 'my-variable-refresh-icon',
9+
svgstr: svgStr
10+
});

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { NotebookWatcher } from './watchers/notebookWatcher';
1111

1212

1313
const leftTab: JupyterFrontEndPlugin<void> = {
14-
id: 'package-manager:plugin',
14+
id: 'variable-manager:plugin',
1515
description: 'A JupyterLab extension to list, remove and install python packages from pip.',
1616
autoStart: true,
1717
activate: async (app: JupyterFrontEnd) => {

0 commit comments

Comments
 (0)