Skip to content

Commit 0a013c7

Browse files
Add stock analysis nodes, async aggregator, node input restrictions, and dialog window enhancements, bug fixes
1 parent 76fb5e0 commit 0a013c7

File tree

69 files changed

+2009
-335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2009
-335
lines changed

client/src/components/App/App.scss

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
::-webkit-scrollbar {
32
width: 12px;
43
height: 12px;
@@ -13,3 +12,16 @@
1312
box-shadow: inset 0 0 5px grey;
1413
border-radius: 10px;
1514
}
15+
16+
.version-tag {
17+
position: absolute !important;
18+
top: 10px !important;
19+
right: 10px !important;
20+
z-index: 1000 !important;
21+
background-color: rgba(255, 255, 255, 0.1) !important;
22+
color: rgba(255, 255, 255, 0.7) !important;
23+
font-size: 0.75rem !important;
24+
font-weight: 500 !important;
25+
backdrop-filter: blur(8px) !important;
26+
border: 1px solid rgba(255, 255, 255, 0.1) !important;
27+
}

client/src/components/App/App.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {nodeRegistry} from '../nodes/nodeRegistry.gen';
1919
import {NODE_TYPE as TOOL_NODE_TYPE} from '../nodes/ToolNode/constants';
2020
import {useFullscreen} from '../../hooks/useFullscreen';
2121
import {getDefaultUserConfigValues} from '../../types/ollama.types';
22+
import {Chip} from '@mui/material';
2223

2324

2425
const getId = () => uuidv4();
@@ -247,6 +248,11 @@ function AppFlow () {
247248
export function App () {
248249
return (
249250
<div style={{width: '100vw', height: '100vh', position: 'relative'}}>
251+
<Chip
252+
label={`v${__APP_VERSION__}`}
253+
size="small"
254+
className="version-tag"
255+
/>
250256
<ReactFlowProvider>
251257
<AppFlow />
252258
</ReactFlowProvider>

client/src/components/BaseDialog/BaseDialog.tsx

Lines changed: 95 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
* See the LICENSE file in the project root for license details. *
55
************************************************************************/
66

7-
import {Button, Dialog, DialogActions, DialogContent, DialogTitle, ThemeProvider} from "@mui/material";
7+
import {Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, ThemeProvider, Tooltip} from "@mui/material";
8+
import {Xmark, Expand, Compress} from "iconoir-react";
89
import {darkTheme} from "../../utils";
910
import {PaperComponent} from "../PaperComponent";
10-
import {ReactNode} from "react";
11+
import {ReactNode, useEffect, useState} from "react";
12+
13+
const BASE_Z = 1000;
14+
const FOCUSED_Z = 1001;
15+
const dialogSetters = new Set<(z: number) => void>();
1116

1217
export interface BaseDialogProps {
1318
open: boolean;
@@ -28,29 +33,101 @@ export function BaseDialog ({
2833
maxWidth = "md",
2934
fullWidth = true
3035
}: BaseDialogProps) {
36+
const [maximized, setMaximized] = useState(false);
37+
const [zIndex, setZIndex] = useState(BASE_Z);
38+
const isFocused = zIndex === FOCUSED_Z;
39+
40+
useEffect(() => {
41+
dialogSetters.add(setZIndex);
42+
43+
return () => { dialogSetters.delete(setZIndex); };
44+
}, []);
45+
46+
useEffect(() => {
47+
if (!open) return;
48+
49+
dialogSetters.forEach(setter => setter(BASE_Z));
50+
51+
setZIndex(FOCUSED_Z);
52+
}, [open]);
53+
54+
const handleFocus = () => {
55+
dialogSetters.forEach(setter => setter(BASE_Z));
56+
57+
setZIndex(FOCUSED_Z);
58+
};
59+
3160
return (
3261
<ThemeProvider theme={darkTheme}>
3362
<Dialog
3463
open={open}
35-
onClose={onClose}
64+
onClose={(_event, reason) => {
65+
if (reason === "backdropClick" || reason === "escapeKeyDown") return;
66+
67+
onClose();
68+
}}
3669
PaperComponent={PaperComponent}
70+
slotProps={{
71+
root: {style: {zIndex, pointerEvents: "none"}},
72+
paper: {
73+
enableDragging: !maximized,
74+
// eslint-disable-next-line max-len
75+
cancel: "input, textarea, select, button, label, .MuiInputBase-root, .MuiSelect-root, .MuiButton-root, .MuiIconButton-root, [role='combobox'], .markdown-renderer, .ace_editor, .ace_text-input"
76+
} as any
77+
}}
3778
aria-labelledby="draggable-dialog-title"
38-
maxWidth={maxWidth}
39-
fullWidth={fullWidth}
79+
maxWidth={maximized ? false : maxWidth}
80+
fullWidth={maximized ? false : fullWidth}
81+
fullScreen={maximized}
82+
hideBackdrop
83+
disableEscapeKeyDown
84+
sx={{
85+
"& .MuiPaper-root": {
86+
pointerEvents: "auto",
87+
backgroundColor: isFocused ? "#121212" : "#080808",
88+
transition: "background-color 0.15s ease",
89+
display: 'flex',
90+
flexDirection: 'column',
91+
height: maximized ? '100vh' : undefined,
92+
minHeight: 0
93+
}
94+
}}
4095
>
41-
<DialogTitle style={{cursor: 'move'}} id="draggable-dialog-title">
42-
{title}
43-
</DialogTitle>
44-
<DialogContent sx={{pt: '16px !important', pb: 0, pl: 0, pr: 0, m: 2}}>
45-
{children}
46-
</DialogContent>
47-
<DialogActions>
48-
{actions || (
49-
<Button autoFocus onClick={onClose}>
50-
Close
51-
</Button>
52-
)}
53-
</DialogActions>
96+
<div onMouseDown={handleFocus} style={{display: "contents", height: '100%'}}>
97+
<DialogTitle
98+
style={{cursor: maximized ? 'default' : 'move', display: 'flex', alignItems: 'center'}}
99+
id="draggable-dialog-title"
100+
>
101+
<span style={{flex: 1}}>{title}</span>
102+
<Tooltip title={maximized ? "Restore" : "Maximize"}>
103+
<IconButton size="medium" onClick={() => setMaximized(m => !m)} sx={{mr: 0.5}}>
104+
{maximized ? <Compress width={24} height={24} /> : <Expand width={24} height={24} />}
105+
</IconButton>
106+
</Tooltip>
107+
<Tooltip title="Close">
108+
<IconButton size="medium" onClick={onClose}>
109+
<Xmark width={24} height={24} />
110+
</IconButton>
111+
</Tooltip>
112+
</DialogTitle>
113+
<DialogContent sx={{
114+
pt: '16px !important', pb: 0, pl: 0, pr: 0, m: 2,
115+
flex: 1,
116+
minHeight: 0,
117+
display: 'flex',
118+
flexDirection: 'column',
119+
height: '100%'
120+
}}>
121+
{children}
122+
</DialogContent>
123+
<DialogActions>
124+
{actions || (
125+
<Button autoFocus onClick={onClose}>
126+
Close
127+
</Button>
128+
)}
129+
</DialogActions>
130+
</div>
54131
</Dialog>
55132
</ThemeProvider>
56133
);

client/src/components/Dock/components/ActionsDock/components/Settings/style.scss renamed to client/src/components/CodeEditor/CodeEditor.scss

File renamed without changes.

client/src/components/CodeEditor/CodeEditor.tsx

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import "ace-builds/src-noconflict/mode-c_cpp";
2525
import "ace-builds/src-noconflict/mode-batchfile";
2626
import "ace-builds/src-noconflict/theme-terminal";
2727
import {AceEditorMode} from "./types";
28+
import './CodeEditor.scss';
29+
2830

2931
type CodeEditorProps = {
3032
value?: string;
@@ -34,6 +36,7 @@ type CodeEditorProps = {
3436
mode?: AceEditorMode;
3537
height?: string;
3638
width?: string;
39+
minHeight?: string;
3740
showLineNumbers?: boolean;
3841
};
3942

@@ -43,34 +46,39 @@ export function CodeEditor ({
4346
placeholder = "",
4447
readOnly = false,
4548
mode = "json",
46-
height = "500px",
49+
height = "100%",
4750
width = "100%",
51+
minHeight = "400px",
4852
showLineNumbers = false
4953
}: CodeEditorProps) {
5054
return (
51-
<AceEditor
52-
placeholder={placeholder}
53-
mode={mode}
54-
theme="terminal"
55-
fontSize={14}
56-
lineHeight={19}
57-
showPrintMargin={true}
58-
showGutter={true}
59-
highlightActiveLine={true}
60-
value={value}
61-
onChange={onChange}
62-
readOnly={readOnly}
63-
width={width}
64-
height={height}
65-
setOptions={{
66-
enableBasicAutocompletion: false,
67-
enableLiveAutocompletion: false,
68-
enableSnippets: false,
69-
enableMobileMenu: true,
70-
showLineNumbers,
71-
tabSize: 4,
72-
useWorker: false,
73-
}}
74-
/>
55+
<div style={{flex: 1, display: 'flex', flexDirection: 'column', height: '50vh', minHeight: 200}}>
56+
57+
<AceEditor
58+
placeholder={placeholder}
59+
mode={mode}
60+
theme="terminal"
61+
fontSize={14}
62+
lineHeight={19}
63+
showPrintMargin={true}
64+
showGutter={true}
65+
highlightActiveLine={true}
66+
value={value}
67+
onChange={onChange}
68+
readOnly={readOnly}
69+
width={width}
70+
height={height}
71+
style={{minHeight}}
72+
setOptions={{
73+
enableBasicAutocompletion: false,
74+
enableLiveAutocompletion: false,
75+
enableSnippets: false,
76+
enableMobileMenu: true,
77+
showLineNumbers,
78+
tabSize: 4,
79+
useWorker: false,
80+
}}
81+
/>
82+
</div>
7583
);
7684
}

client/src/components/Dock/components/ActionsDock/components/Settings/Settings.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
************************************************************************/
66

77
import {useState, useEffect} from 'react';
8-
import './style.scss';
98
import {useSettings} from '../../../../../../hooks/useSettings';
109
import {IconButton, InputAdornment, Box, LinearProgress, List, ListItem, ListItemText, TextField} from '@mui/material';
1110
import {Plus, Trash} from 'iconoir-react';

client/src/components/MarkdownRenderer/MarkdownRenderer.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
// Make the markdown renderer fill available space
12
.markdown-renderer {
23
border-radius: 4px;
34
min-height: 50px;
45
padding: 30px;
56
background: #000000;
7+
flex: 1 1 auto;
8+
height: 100%;
9+
display: flex;
10+
flex-direction: column;
611

712
table {
813
border-collapse: collapse;
@@ -38,6 +43,10 @@
3843
tbody tr:hover {
3944
background: rgba(255, 255, 255, 0.03);
4045
}
46+
47+
ul {
48+
margin: 0 0 0 40px;
49+
}
4150
}
4251

4352
.code-wrapper {

client/src/components/MarkdownRenderer/MarkdownRenderer.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import "./MarkdownRenderer.scss";
1414

1515
interface MarkdownRendererProps {
1616
content: string;
17+
style?: React.CSSProperties;
1718
}
1819

1920
const LoadingSpinner = () => (
@@ -23,7 +24,7 @@ const LoadingSpinner = () => (
2324
alignItems="center"
2425
className="markdown-renderer"
2526
>
26-
<CircularProgress size={40} />
27+
<CircularProgress size={25} />
2728
</Box>
2829
);
2930

@@ -91,11 +92,12 @@ const LinkRenderer: FC<any> = React.memo(({href, children, ...props}) => {
9192

9293
const PreBlock: FC<any> = React.memo(({children, ...props}) => <div {...props}>{children}</div>);
9394

94-
export const MarkdownRenderer = React.memo(({content}: MarkdownRendererProps) => {
95-
95+
export const MarkdownRenderer = React.memo(({content, style}: MarkdownRendererProps) => {
9696
return (
97-
<Suspense fallback={<LoadingSpinner />}>
98-
<LazyMarkdownContent content={content} />
99-
</Suspense>
97+
<div style={{flex: 1, minHeight: 0, height: '100%', display: 'flex', flexDirection: 'column', ...style}}>
98+
<Suspense fallback={<LoadingSpinner />}>
99+
<LazyMarkdownContent content={content} />
100+
</Suspense>
101+
</div>
100102
);
101103
});

client/src/components/PaperComponent.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,25 @@ import {useRef} from "react";
99
import Draggable from "react-draggable";
1010

1111

12-
export function PaperComponent (props: PaperProps) {
12+
export interface PaperComponentProps extends PaperProps {
13+
enableDragging?: boolean;
14+
cancel?: string;
15+
}
16+
17+
export function PaperComponent (props: PaperComponentProps) {
18+
const {enableDragging = true, cancel, ...paperProps} = props;
1319
const nodeRef = useRef<HTMLDivElement>(null);
1420

21+
if (!enableDragging) {
22+
return <Paper {...paperProps} ref={nodeRef} />;
23+
}
24+
1525
return (
1626
<Draggable
1727
nodeRef={nodeRef as React.RefObject<HTMLDivElement>}
18-
handle="#draggable-dialog-title"
19-
cancel={'[class*="MuiDialogContent-root"]'}
28+
cancel={cancel}
2029
>
21-
<Paper {...props} ref={nodeRef} />
30+
<Paper {...paperProps} ref={nodeRef} />
2231
</Draggable>
2332
);
2433
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.basic-tabs-container {
2+
display: flex;
3+
flex-direction: column;
4+
flex: 1;
5+
min-height: 0;
6+
7+
.tabs-titles {
8+
border-bottom: .5px solid;
9+
border-color: rgba(255, 255, 255, 0.12);
10+
}
11+
12+
.tabs-content {
13+
flex: 1;
14+
min-height: 0;
15+
display: flex;
16+
flex-direction: column;
17+
padding: 20px 0 0;
18+
}
19+
}

0 commit comments

Comments
 (0)