Skip to content

Commit 3499421

Browse files
committed
feat: add Terminal component and styles
- Introduced a new Terminal component for embedding a terminal interface within the application. - Added corresponding styles in Terminal.scss to ensure proper layout and appearance. - Updated index.ts to export the Terminal component for accessibility within the module.
1 parent bb7a3be commit 3499421

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.terminal-container {
2+
width: 100%;
3+
height: 100%;
4+
display: flex;
5+
flex-direction: column;
6+
overflow: hidden;
7+
}
8+
9+
.terminal-iframe {
10+
flex: 1;
11+
background-color: #1e1e1e;
12+
height: 100%;
13+
width: 100%;
14+
border: 0px !important;
15+
overflow: hidden;
16+
border-bottom-left-radius: var(--embeddable-radius);
17+
border-bottom-right-radius: var(--embeddable-radius);
18+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from 'react';
2+
import { useWorkspaceState } from '../../api/hooks';
3+
import type { NonDeleted, ExcalidrawEmbeddableElement } from '@atyrode/excalidraw/element/types';
4+
import type { AppState } from '@atyrode/excalidraw/types';
5+
import './Terminal.scss';
6+
7+
interface TerminalProps {
8+
element: NonDeleted<ExcalidrawEmbeddableElement>;
9+
appState: AppState;
10+
excalidrawAPI?: any;
11+
}
12+
13+
export const Terminal: React.FC<TerminalProps> = ({
14+
element,
15+
appState,
16+
excalidrawAPI
17+
}) => {
18+
const { data: workspaceState } = useWorkspaceState();
19+
20+
const getTerminalUrl = () => {
21+
if (!workspaceState) {
22+
return 'https://terminal.example.dev';
23+
}
24+
25+
return `${workspaceState.base_url}/@${workspaceState.username}/${workspaceState.workspace_id}.${workspaceState.agent}/terminal`;
26+
};
27+
28+
const terminalUrl = getTerminalUrl();
29+
30+
return (
31+
<div className="terminal-container">
32+
<iframe
33+
className="terminal-iframe"
34+
src={terminalUrl}
35+
title="Terminal"
36+
/>
37+
</div>
38+
);
39+
};
40+
41+
export default Terminal;

src/frontend/src/pad/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
export * from './controls/ControlButton';
33
export * from './controls/StateIndicator';
44
export * from './containers/Dashboard';
5+
export * from './containers/Terminal';
56
export * from './buttons';
67
export * from './editors';
78

89
// Default exports
910
export { default as ControlButton } from './controls/ControlButton';
1011
export { default as StateIndicator } from './controls/StateIndicator';
1112
export { default as Dashboard } from './containers/Dashboard';
13+
export { default as Terminal } from './containers/Terminal';

0 commit comments

Comments
 (0)