feat: change rule page

This commit is contained in:
GyDi 2021-12-13 02:30:34 +08:00
parent b0dabbe55a
commit 03b3a0b8b3
2 changed files with 32 additions and 41 deletions

View File

@ -1,40 +0,0 @@
import { useState } from "react";
import { invoke } from "@tauri-apps/api";
import { Button, Grid, TextField } from "@mui/material";
const ProfilesPage = () => {
const [url, setUrl] = useState("");
const onClick = async () => {
if (!url) return;
const data = await invoke("get_config_data", { url });
console.log(data);
};
return (
<div>
<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>
</div>
);
};
export default ProfilesPage;

View File

@ -1,11 +1,42 @@
import { Box, Typography } from "@mui/material";
import { useState } from "react";
import { invoke } from "@tauri-apps/api";
import { Box, Button, Grid, TextField, Typography } from "@mui/material";
const RulesPage = () => {
const [url, setUrl] = useState("");
const onClick = async () => {
if (!url) return;
const data = await invoke("cmd_import_profile", { url });
console.log(data);
};
return (
<Box sx={{ width: 0.9, maxWidth: "850px", mx: "auto", mb: 2 }}>
<Typography variant="h4" component="h1" sx={{ py: 2 }}>
Rules
</Typography>
<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>
</Box>
);
};