Skip to content

Commit e37f506

Browse files
authored
Merge pull request #20 from Open-STEM/kq-vite
Added Dashboard tab
2 parents 82dff1a + 81e085d commit e37f506

5 files changed

Lines changed: 33 additions & 0 deletions

File tree

src/assets/images/dashboard.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default function XRPDashboard() {
2+
return (
3+
<h1 className='text-xl'>XRP Dashboard</h1>
4+
)
5+
}

src/components/navbar.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import userguide from '@assets/images/developer_guide.svg';
1010
import apilink from '@assets/images/api.svg';
1111
import python from '@assets/images/python.svg';
1212
import convert from '@assets/images/convert.svg';
13+
import dashboard from '@assets/images/dashboard.svg';
1314
import forum from '@assets/images/forum.svg';
1415
import cirriculum from '@assets/images/cirriculum.svg';
1516
import changelog from '@assets/images/changelog.svg';
@@ -54,6 +55,7 @@ import UpdateDlg from './dialogs/updatedlg';
5455
import React from 'react';
5556
import { CreateEditorTab } from '@/utils/editorUtils';
5657
import ChangeLogDlg from './dialogs/changelog';
58+
import { IJsonTabNode } from 'flexlayout-react';
5759

5860
type NavBarProps = {
5961
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -466,6 +468,21 @@ function NavBar({ layoutref }: NavBarProps) {
466468
AppMgr.getInstance().emit(EventType.EVENT_FONTCHANGE, FontSize.DESCREASE);
467469
}
468470

471+
/**
472+
* viewDashboard - view the dashboard
473+
*/
474+
function viewDashboard() {
475+
console.log(i18n.t('dashboard'));
476+
const tabInfo: IJsonTabNode = {
477+
component: 'dashboard',
478+
name: 'Dashboard',
479+
id: 'DashboardId',
480+
helpText: 'Dashboard',
481+
};
482+
layoutref!.current?.addTabToTabSet(Constants.EDITOR_TABSET_ID, tabInfo);
483+
setActiveTab('Dashboard');
484+
}
485+
469486
/**
470487
* onConnectionSelected - process seected connection
471488
* @param connType
@@ -638,6 +655,12 @@ function NavBar({ layoutref }: NavBarProps) {
638655
clicked: ConvertToPython,
639656
isView: true,
640657
},
658+
{
659+
label: i18n.t('dashboard'),
660+
iconImage: dashboard,
661+
clicked: viewDashboard,
662+
isView: true,
663+
}
641664
],
642665
childrenExt: [
643666
{

src/components/xrplayout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { useLocalStorage } from 'usehooks-ts';
1414
import { StorageKeys } from '@/utils/localstorage';
1515
import EditorMgr, { EditorStore } from '@/managers/editormgr';
1616
import { CreateEditorTab } from '@/utils/editorUtils';
17+
import XRPDashboard from '@/components/dashboard/xrp-dashboard';
1718

1819
/**
1920
* Layout-React's layout JSON to specify the XRPWeb's single page application's layout
@@ -100,6 +101,8 @@ const factory = (node: TabNode) => {
100101
return <FolderTree treeData={null} theme="rct-dark" isHeader={true} />;
101102
} else if (component == 'blockly') {
102103
return <BlocklyEditor name={node.getName()} />;
104+
} else if (component == 'dashboard') {
105+
return <XRPDashboard />;
103106
}
104107
};
105108

src/utils/i18n/locales/en/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"update-lib-instructions": "The update process will take a few minutes. Please do not disconnect the USB cable during this time.",
8787
"update-lib-error": "The XRP library update process has failed. Please try again. The error message is: {{ error }}",
8888
"update-lib-complete": "The XRP library update process has completed successfully.",
89+
"dashboard": "Dashboard",
8990
"_commentBlockly": "This does not need to be translated - blockly specific translation add below",
9091
"individualMotors": "Individual Motors"
9192
}

0 commit comments

Comments
 (0)