feat: update front layout

This commit is contained in:
Maël Gangloff
2024-07-26 18:31:47 +02:00
parent a15c1b2c2f
commit 467d0efa1c
13 changed files with 272 additions and 177 deletions

8
assets/pages/FAQPage.tsx Normal file
View File

@@ -0,0 +1,8 @@
import React from "react";
export default function FAQPage() {
return <p>
FAQ Page
</p>
}

View File

@@ -1,7 +1,74 @@
import React from "react";
import React, {createContext, useContext, useEffect, useState} from "react";
import {Alert, Button, Card, Flex, Form, Input} from "antd";
import {login} from "../utils/api";
import {useNavigate} from "react-router-dom";
type FieldType = {
username: string;
password: string;
};
export const AuthenticatedContext = createContext<any>(null)
export default function Page() {
return <p>
Login Page
</p>
const [error, setError] = useState()
const navigate = useNavigate()
const {isAuthenticated, setIsAuthenticated} = useContext(AuthenticatedContext)
const onFinish = (data: FieldType) => {
login(data.username, data.password).then(() => {
setIsAuthenticated(true)
navigate('/search/domain')
}).catch((e) => {
setIsAuthenticated(false)
setError(e.response.data.message)
})
}
return <Flex gap="middle" align="center" justify="center" vertical><Card
title="Log in"
style={{width: 500}}
>
{error &&
<Alert
type='error'
message='Error'
banner={true}
role='role'
description={error}
style={{marginBottom: '1em'}}
/>}
<Form
name="basic"
labelCol={{span: 8}}
wrapperCol={{span: 16}}
style={{maxWidth: 600}}
onFinish={onFinish}
autoComplete="off"
>
<Form.Item
label="Username"
name="username"
rules={[{required: true, message: 'Required'}]}
>
<Input/>
</Form.Item>
<Form.Item<FieldType>
label="Password"
name="password"
rules={[{required: true, message: 'Required'}]}
>
<Input.Password/>
</Form.Item>
<Form.Item wrapperCol={{offset: 8, span: 16}}>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item>
</Form>
</Card>
</Flex>
}

View File

@@ -1,4 +1,4 @@
import {Button, Result} from "antd";
import {Result} from "antd";
import React from "react";
@@ -7,6 +7,5 @@ export default function NotFoundPage() {
status="404"
title="404"
subTitle="Sorry, the page you visited does not exist."
extra={<Button type="primary">Back Home</Button>}
/>
}

View File

@@ -2,6 +2,6 @@ import React from "react";
export default function StatisticsPage() {
return <p>
Tld
Statistics Page
</p>
}

View File

@@ -2,6 +2,6 @@ import React from "react";
export default function TldPage() {
return <p>
Tld
Tld Page
</p>
}

View File

@@ -2,6 +2,6 @@ import React from "react";
export default function DomainSearchPage() {
return <p>
Domain Search Page
</p>
}

View File

@@ -2,6 +2,6 @@ import React from "react";
export default function EntitySearchPage() {
return <p>
Entity Search Page
</p>
}

View File

@@ -2,6 +2,6 @@ import React from "react";
export default function NameserverSearchPage() {
return <p>
NS Finder
NS Search Page
</p>
}

View File

@@ -2,6 +2,6 @@ import React from "react";
export default function ConnectorsPage() {
return <p>
Connectors Page
</p>
}

View File

@@ -2,6 +2,6 @@ import React from "react";
export default function WatchlistsPage() {
return <p>
Watchlists Page
</p>
}