From efb2686d876a00070c16b8b484c8f6799ad4328a Mon Sep 17 00:00:00 2001 From: Robin Malik <8790561+robinmalik@users.noreply.github.com> Date: Fri, 7 Mar 2025 18:23:36 +0000 Subject: [PATCH] Add VSP to sidebar --- src/_nav.js | 54 ++++++++--- src/components/AppSidebar.js | 27 +++--- src/views/widgets/WidgetsDropdown.js | 130 ++++++++++++++------------- 3 files changed, 126 insertions(+), 85 deletions(-) diff --git a/src/_nav.js b/src/_nav.js index db78c49bd..8aa4aec9a 100644 --- a/src/_nav.js +++ b/src/_nav.js @@ -1,6 +1,7 @@ import React from 'react' import CIcon from '@coreui/icons-react' -import { +import +{ cilBell, cilCalculator, cilChartPie, @@ -20,7 +21,7 @@ const _nav = [ component: CNavItem, name: 'Dashboard', to: '/dashboard', - icon: , + icon: , badge: { color: 'info', text: 'NEW', @@ -34,13 +35,40 @@ const _nav = [ component: CNavItem, name: 'Colors', to: '/theme/colors', - icon: , + icon: , }, { component: CNavItem, name: 'Typography', to: '/theme/typography', - icon: , + icon: , + }, + { + component: CNavTitle, + name: 'Services', + }, + { + component: CNavGroup, + name: 'Virtual Server Platform', + to: '/services/virtual-server-platform', + icon: , + items: [ + { + component: CNavItem, + name: 'Admin Tasks', + to: '/services/virtual-server-platform/admin-tasks', + }, + { + component: CNavItem, + name: 'Reports', + to: '/services/virtual-server-platform/reports', + }, + { + component: CNavItem, + name: 'Snapshots', + to: '/services/virtual-server-platform/snapshots', + } + ], }, { component: CNavTitle, @@ -50,7 +78,7 @@ const _nav = [ component: CNavGroup, name: 'Base', to: '/base', - icon: , + icon: , items: [ { component: CNavItem, @@ -133,7 +161,7 @@ const _nav = [ component: CNavGroup, name: 'Buttons', to: '/buttons', - icon: , + icon: , items: [ { component: CNavItem, @@ -155,7 +183,7 @@ const _nav = [ { component: CNavGroup, name: 'Forms', - icon: , + icon: , items: [ { component: CNavItem, @@ -203,12 +231,12 @@ const _nav = [ component: CNavItem, name: 'Charts', to: '/charts', - icon: , + icon: , }, { component: CNavGroup, name: 'Icons', - icon: , + icon: , items: [ { component: CNavItem, @@ -234,7 +262,7 @@ const _nav = [ { component: CNavGroup, name: 'Notifications', - icon: , + icon: , items: [ { component: CNavItem, @@ -262,7 +290,7 @@ const _nav = [ component: CNavItem, name: 'Widgets', to: '/widgets', - icon: , + icon: , badge: { color: 'info', text: 'NEW', @@ -275,7 +303,7 @@ const _nav = [ { component: CNavGroup, name: 'Pages', - icon: , + icon: , items: [ { component: CNavItem, @@ -303,7 +331,7 @@ const _nav = [ component: CNavItem, name: 'Docs', href: 'https://coreui.io/react/docs/templates/installation/', - icon: , + icon: , }, ] diff --git a/src/components/AppSidebar.js b/src/components/AppSidebar.js index 021cb52c3..eef8b398e 100644 --- a/src/components/AppSidebar.js +++ b/src/components/AppSidebar.js @@ -1,7 +1,8 @@ import React from 'react' import { useSelector, useDispatch } from 'react-redux' -import { +import +{ CCloseButton, CSidebar, CSidebarBrand, @@ -19,7 +20,8 @@ import { sygnet } from 'src/assets/brand/sygnet' // sidebar nav config import navigation from '../_nav' -const AppSidebar = () => { +const AppSidebar = () => +{ const dispatch = useDispatch() const unfoldable = useSelector((state) => state.sidebarUnfoldable) const sidebarShow = useSelector((state) => state.sidebarShow) @@ -29,27 +31,30 @@ const AppSidebar = () => { className="border-end" colorScheme="dark" position="fixed" - unfoldable={unfoldable} - visible={sidebarShow} - onVisibleChange={(visible) => { + unfoldable={ unfoldable } + visible={ sidebarShow } + onVisibleChange={ (visible) => + { dispatch({ type: 'set', sidebarShow: visible }) - }} + } } > - - + + dispatch({ type: 'set', sidebarShow: false })} + onClick={ () => dispatch({ type: 'set', sidebarShow: false }) } /> - + + + dispatch({ type: 'set', sidebarUnfoldable: !unfoldable })} + onClick={ () => dispatch({ type: 'set', sidebarUnfoldable: !unfoldable }) } /> diff --git a/src/views/widgets/WidgetsDropdown.js b/src/views/widgets/WidgetsDropdown.js index 85e2fc969..c7cc15fca 100644 --- a/src/views/widgets/WidgetsDropdown.js +++ b/src/views/widgets/WidgetsDropdown.js @@ -1,7 +1,8 @@ import React, { useEffect, useRef } from 'react' import PropTypes from 'prop-types' -import { +import +{ CRow, CCol, CDropdown, @@ -15,46 +16,53 @@ import { CChartBar, CChartLine } from '@coreui/react-chartjs' import CIcon from '@coreui/icons-react' import { cilArrowBottom, cilArrowTop, cilOptions } from '@coreui/icons' -const WidgetsDropdown = (props) => { +const WidgetsDropdown = (props) => +{ const widgetChartRef1 = useRef(null) const widgetChartRef2 = useRef(null) - useEffect(() => { - document.documentElement.addEventListener('ColorSchemeChange', () => { - if (widgetChartRef1.current) { - setTimeout(() => { - widgetChartRef1.current.data.datasets[0].pointBackgroundColor = getStyle('--cui-primary') + useEffect(() => + { + document.documentElement.addEventListener('ColorSchemeChange', () => + { + if(widgetChartRef1.current) + { + setTimeout(() => + { + widgetChartRef1.current.data.datasets[ 0 ].pointBackgroundColor = getStyle('--cui-primary') widgetChartRef1.current.update() }) } - if (widgetChartRef2.current) { - setTimeout(() => { - widgetChartRef2.current.data.datasets[0].pointBackgroundColor = getStyle('--cui-info') + if(widgetChartRef2.current) + { + setTimeout(() => + { + widgetChartRef2.current.data.datasets[ 0 ].pointBackgroundColor = getStyle('--cui-info') widgetChartRef2.current.update() }) } }) - }, [widgetChartRef1, widgetChartRef2]) + }, [ widgetChartRef1, widgetChartRef2 ]) return ( - - + + - 26K{' '} + 26K{ ' ' } - (-12.4% ) + (-12.4% ) } title="Users" action={ - - + + Action @@ -66,22 +74,22 @@ const WidgetsDropdown = (props) => { } chart={ { hoverRadius: 4, }, }, - }} + } } /> } /> - + - $6.200{' '} + $6.200{ ' ' } - (40.9% ) + (40.9% ) } title="Income" action={ - - + + Action @@ -156,22 +164,22 @@ const WidgetsDropdown = (props) => { } chart={ { hoverRadius: 4, }, }, - }} + } } /> } /> - + - 2.49%{' '} + 2.49%{ ' ' } - (84.7% ) + (84.7% ) } title="Conversion Rate" action={ - - + + Action @@ -246,20 +254,20 @@ const WidgetsDropdown = (props) => { chart={ { hoverRadius: 4, }, }, - }} + } } /> } /> - + - 44K{' '} + 44K{ ' ' } - (-23.6% ) + (-23.6% ) } title="Sessions" action={ - - + + Action @@ -318,8 +326,8 @@ const WidgetsDropdown = (props) => { chart={ { label: 'My First dataset', backgroundColor: 'rgba(255,255,255,.2)', borderColor: 'rgba(255,255,255,.55)', - data: [78, 81, 80, 45, 34, 12, 40, 85, 65, 23, 12, 98, 34, 84, 67, 82], + data: [ 78, 81, 80, 45, 34, 12, 40, 85, 65, 23, 12, 98, 34, 84, 67, 82 ], barPercentage: 0.6, }, ], - }} - options={{ + } } + options={ { maintainAspectRatio: false, plugins: { legend: { @@ -379,7 +387,7 @@ const WidgetsDropdown = (props) => { }, }, }, - }} + } } /> } />