clash-verge/src/pages/rules.tsx

45 lines
1.0 KiB
TypeScript
Raw Normal View History

2021-12-12 21:30:34 +03:00
import { useState } from "react";
import { invoke } from "@tauri-apps/api";
import { Box, Button, Grid, TextField, Typography } from "@mui/material";
2021-12-11 20:09:51 +03:00
const RulesPage = () => {
2021-12-12 21:30:34 +03:00
const [url, setUrl] = useState("");
const onClick = async () => {
if (!url) return;
const data = await invoke("cmd_import_profile", { url });
console.log(data);
};
2021-12-11 20:09:51 +03:00
return (
<Box sx={{ width: 0.9, maxWidth: "850px", mx: "auto", mb: 2 }}>
<Typography variant="h4" component="h1" sx={{ py: 2 }}>
Rules
</Typography>
2021-12-12 21:30:34 +03:00
<Grid
container
spacing={2}
justifyContent="space-between"
alignItems="center"
>
<Grid item xs={9}>
<TextField
label="Profile Url"
fullWidth
value={url}
onChange={(e) => setUrl(e.target.value)}
/>
</Grid>
<Grid item>
<Button size="large" variant="contained" onClick={onClick}>
View
</Button>
</Grid>
</Grid>
2021-12-11 20:09:51 +03:00
</Box>
);
};
export default RulesPage;