feat(menu): add new menu web control
This commit is contained in:
@@ -36,6 +36,7 @@ import IndexNotification from './pages/notification/IndexNotification';
|
|||||||
import IndexRole from './pages/role/IndexRole';
|
import IndexRole from './pages/role/IndexRole';
|
||||||
import IndexUser from './pages/user/IndexUser';
|
import IndexUser from './pages/user/IndexUser';
|
||||||
import IndexContact from './pages/contact/IndexContact';
|
import IndexContact from './pages/contact/IndexContact';
|
||||||
|
import IndexWebControl from './pages/webControl/IndexWebControl';
|
||||||
import DetailNotificationTab from './pages/notificationDetail/IndexNotificationDetail';
|
import DetailNotificationTab from './pages/notificationDetail/IndexNotificationDetail';
|
||||||
import IndexVerificationSparepart from './pages/verificationSparepart/IndexVerificationSparepart';
|
import IndexVerificationSparepart from './pages/verificationSparepart/IndexVerificationSparepart';
|
||||||
|
|
||||||
@@ -144,6 +145,10 @@ const App = () => {
|
|||||||
<Route index element={<IndexUser />} />
|
<Route index element={<IndexUser />} />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
<Route path="/web-control" element={<ProtectedRoute />}>
|
||||||
|
<Route index element={<IndexWebControl />} />
|
||||||
|
</Route>
|
||||||
|
|
||||||
<Route path="/contact" element={<ProtectedRoute />}>
|
<Route path="/contact" element={<ProtectedRoute />}>
|
||||||
<Route index element={<IndexContact />} />
|
<Route index element={<IndexContact />} />
|
||||||
</Route>
|
</Route>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
DatabaseOutlined,
|
DatabaseOutlined,
|
||||||
SettingOutlined,
|
SettingOutlined,
|
||||||
UserOutlined,
|
UserOutlined,
|
||||||
|
GlobalOutlined,
|
||||||
AntDesignOutlined,
|
AntDesignOutlined,
|
||||||
ShoppingCartOutlined,
|
ShoppingCartOutlined,
|
||||||
ShoppingOutlined,
|
ShoppingOutlined,
|
||||||
@@ -225,6 +226,15 @@ const allItems = [
|
|||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'web-control',
|
||||||
|
icon: <GlobalOutlined style={{ fontSize: '19px' }} />,
|
||||||
|
label: (
|
||||||
|
<Link to="/web-control" className="fontMenus">
|
||||||
|
Web Control
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// key: 'jadwal-shift',
|
// key: 'jadwal-shift',
|
||||||
// icon: <CalendarOutlined style={{ fontSize: '19px' }} />,
|
// icon: <CalendarOutlined style={{ fontSize: '19px' }} />,
|
||||||
@@ -250,6 +260,7 @@ const LayoutMenu = () => {
|
|||||||
if (pathname === '/dashboard/home') return 'home';
|
if (pathname === '/dashboard/home') return 'home';
|
||||||
if (pathname === '/user') return 'user';
|
if (pathname === '/user') return 'user';
|
||||||
if (pathname === '/role') return 'role';
|
if (pathname === '/role') return 'role';
|
||||||
|
if (pathname === '/web-control') return 'web-control';
|
||||||
if (pathname === '/notification') return 'notification';
|
if (pathname === '/notification') return 'notification';
|
||||||
if (pathname === '/jadwal-shift') return 'jadwal-shift';
|
if (pathname === '/jadwal-shift') return 'jadwal-shift';
|
||||||
if (pathname === '/contact') return 'contact';
|
if (pathname === '/contact') return 'contact';
|
||||||
|
|||||||
90
src/pages/webControl/IndexWebControl.jsx
Normal file
90
src/pages/webControl/IndexWebControl.jsx
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
import React, { useState, useEffect, memo } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { Button, Typography } from 'antd';
|
||||||
|
import { useBreadcrumb } from '../../layout/LayoutBreadcrumb';
|
||||||
|
|
||||||
|
const { Text } = Typography;
|
||||||
|
|
||||||
|
const IndexWebControl = memo(function IndexWebControl() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const { setBreadcrumbItems } = useBreadcrumb();
|
||||||
|
|
||||||
|
const [isPlaying, setIsPlaying] = useState(false);
|
||||||
|
|
||||||
|
const url = "https://117.102.231.130:9529";
|
||||||
|
|
||||||
|
const handlePlay = () => {
|
||||||
|
setIsPlaying(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleReset = () => {
|
||||||
|
setIsPlaying(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const token = localStorage.getItem('token');
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
setBreadcrumbItems([
|
||||||
|
{
|
||||||
|
title: (
|
||||||
|
<Text strong style={{ fontSize: '14px' }}>
|
||||||
|
• Web Control Panel
|
||||||
|
</Text>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
navigate('/signin');
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ padding: '20px' }}>
|
||||||
|
|
||||||
|
<div style={{ marginBottom: 20 }}>
|
||||||
|
<Button type="primary" onClick={handlePlay} style={{ marginRight: 10 }}>
|
||||||
|
▶ Play
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button danger onClick={handleReset}>
|
||||||
|
🔄 Reset
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
height: '500px',
|
||||||
|
background: '#fafafa',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isPlaying ? (
|
||||||
|
<iframe
|
||||||
|
src={url}
|
||||||
|
title="Web Preview"
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
border: 'none',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: '100%',
|
||||||
|
color: '#888',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Klik Play untuk menjalankan web
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default IndexWebControl;
|
||||||
Reference in New Issue
Block a user