File size: 1,865 Bytes
f46b416
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import React, { ReactNode, useState } from "react";
import { Layout, Menu } from "antd";
import './index.css';
import {
  PieChartOutlined,
  FundOutlined,
  RobotOutlined,
  BankOutlined
} from '@ant-design/icons';
import { pageUrlDemoBias, pageUrlDemoCompliance, pageUrlDemoHarmfulPrompt, pageUrlDemoPrivacy } from "../../router/pages";
import { Link } from "react-router-dom";

const { Content, Footer, Sider } = Layout;

interface Props {
  children: ReactNode;
}

const sideBarMenuItems= [
  {
    name: 'Harmful Prompt',
    url: pageUrlDemoHarmfulPrompt,
    icon: <PieChartOutlined />
  },
  {
    name: 'Privacy',
    url: pageUrlDemoPrivacy,
    icon: <FundOutlined />
  },
  {
    name: 'Bias',
    url: pageUrlDemoBias,
    icon: <RobotOutlined />
  },
  {
    name: 'Compliance',
    url: pageUrlDemoCompliance,
    icon: <BankOutlined />
  },
].map(entry => {
  return {
    label: <Link to={entry.url}>{entry.name}</Link>,
    key: entry.name,
    icon: entry.icon
  }
})
const defaultSelectedKey = 'Dashboard'


export function withDemoLayout(elem: ReactNode) {
    return <DemoLayout>
        {elem}
    </DemoLayout>
}

export const DemoLayout: React.FC<Props> = ({ children }) => {
  const [collapsed, setCollapsed] = useState(false);

  return (
    <Layout style={{ minHeight: '100vh' }}>
      <Sider collapsible collapsed={collapsed} onCollapse={setCollapsed}>
        <div className="logo" />
        <Menu theme="dark" defaultSelectedKeys={[defaultSelectedKey]} items={sideBarMenuItems} mode="inline">
        </Menu>
      </Sider>
      <Layout className="site-layout">
        <Content style={{ padding: '16px' }}>
          <div className="site-layout-content">{children}</div>
        </Content>
        <Footer style={{ textAlign: 'center' }}>
          Guard AI - Demo use only!
        </Footer>
      </Layout>
    </Layout>
  );
}