add controller

This commit is contained in:
VillanCh
2024-03-21 00:03:54 +08:00
parent 977f74dc19
commit acb8307c98
3 changed files with 31 additions and 11 deletions
+2 -1
View File
@@ -1,13 +1,14 @@
import React from 'react'; import React from 'react';
import './App.css'; import './App.css';
import {Layout, Row} from 'antd'; import {Layout, Row} from 'antd';
import {Controller} from "./components/Controller";
function App() { function App() {
return ( return (
<div className="App" style={{width: 300, backgroundColor: "#eee", padding: 8}}> <div className="App" style={{width: 300, backgroundColor: "#eee", padding: 8}}>
<Layout> <Layout>
<Row> <Row>
Hello WOrld First <Controller/>
</Row> </Row>
<Row> <Row>
PROXY PROXY
-10
View File
@@ -1,10 +0,0 @@
import React, {useState} from "react";
export const Controller = (props) => {
const [connected, setConnected] = useState(false);
return (
<div>
</div>
)
}
+29
View File
@@ -0,0 +1,29 @@
import React, {useEffect} from "react";
import {Card} from "antd";
export interface ControllerProp {
}
export const Controller: React.FC<ControllerProp> = (props) => {
const [connected, setConnected] = React.useState<boolean>(false)
const ref = React.useRef<HTMLAnchorElement>(null)
useEffect(() => {
if (!ref) {
return
}
// const update = () => {
// ref.current.click()
// }
// const id = setInterval(update, 10000)
// return () => {
// clearInterval(id)
// }
}, [ref])
return <Card size={"small"} title={"连接器"}>
<a href={"yakitctrl://start/"} ref={ref}>Yakit </a>
</Card>
};