Skip to content

Commit 4e39b5b

Browse files
[WebUI] Homepage to master (#240)
1 parent 299bfb1 commit 4e39b5b

File tree

3 files changed

+114
-1
lines changed

3 files changed

+114
-1
lines changed

src/pages/Homepage.jsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React, { useState, useEffect } from 'react';
2+
import { useNavigate } from 'react-router-dom';
3+
import LinearProgress from '@mui/material/LinearProgress';
4+
import { useClient } from '../context/client-context';
5+
6+
const Homepage = () => {
7+
const { client } = useClient();
8+
const navigate = useNavigate();
9+
const [loading, setLoading] = useState(false);
10+
11+
useEffect(() => {
12+
setLoading(true);
13+
client
14+
.getCollections()
15+
.then((data) => {
16+
setLoading(false);
17+
if (data.collections.length > 0) {
18+
navigate('/collections');
19+
} else {
20+
navigate('/welcome');
21+
}
22+
})
23+
.catch((error) => {
24+
console.error(error);
25+
});
26+
}, [client]);
27+
28+
return <>{loading ? <LinearProgress /> : null}</>;
29+
};
30+
31+
export default Homepage;

src/pages/Welcome.jsx

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import React from 'react';
2+
import { Link } from 'react-router-dom';
3+
import { Box, Button, Typography } from '@mui/material';
4+
import { styled } from '@mui/material/styles';
5+
6+
const ButtonsContainer = styled(Box)`
7+
display: flex;
8+
justify-content: flex-start;
9+
gap: 1rem;
10+
margin: 2rem 0;
11+
`;
12+
13+
const StyledButton = styled((props) => <Button variant="contained" {...props} />)`
14+
background-color: #333;
15+
color: white;
16+
font-size: 1rem;
17+
text-transform: capitalize;
18+
&:hover {
19+
background-color: #555;
20+
}
21+
`;
22+
23+
const StyledAbstract = styled(Typography)`
24+
max-width: 600px;
25+
margin-bottom: 2rem;
26+
`;
27+
28+
const Welcome = () => {
29+
return (
30+
<Box component="main" px={4}>
31+
<Box component="header">
32+
<Typography component="h1" variant="h4" mt={4} mb={6}>
33+
Welcome to Qdrant!
34+
</Typography>
35+
</Box>
36+
37+
<Box component="section">
38+
<Typography component="h2" variant="h5" mb="1rem">
39+
Begin by setting up your collection
40+
</Typography>
41+
<StyledAbstract>
42+
Start building your app by creating a collection and inserting your vectors. Interactive tutorials will show
43+
you how to organize data and perform searches.
44+
</StyledAbstract>
45+
<ButtonsContainer>
46+
<StyledButton variant="contained" component={Link} to="/tutorial/quickstart">
47+
Quickstart
48+
</StyledButton>
49+
<StyledButton variant="contained" component={Link} to="/tutorial/loadcontent">
50+
Load Sample Data
51+
</StyledButton>
52+
</ButtonsContainer>
53+
</Box>
54+
55+
<Box component="section">
56+
<Typography component="h2" variant="h5" mb="1rem">
57+
Connect to your new project
58+
</Typography>
59+
<StyledAbstract>
60+
Easily interact with your database using Qdrant SDKs and our REST API. Use these libraries to connect, query,
61+
and manage your vector data from the app.
62+
</StyledAbstract>
63+
<ButtonsContainer>
64+
<StyledButton
65+
className="btn"
66+
component={'a'}
67+
href="https://api.qdrant.tech/api-reference"
68+
target="_blank"
69+
rel="noopener noreferrer"
70+
>
71+
API Reference
72+
</StyledButton>
73+
</ButtonsContainer>
74+
</Box>
75+
</Box>
76+
);
77+
};
78+
79+
export default Welcome;

src/routes.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ import Tutorial from './pages/Tutorial';
88
import Datasets from './pages/Datasets';
99
import Jwt from './pages/Jwt';
1010
import Graph from './pages/Graph';
11+
import Welcome from './pages/Welcome';
12+
import Homepage from './pages/Homepage';
1113

1214
const routes = () => [
1315
{
1416
path: '/',
1517
element: <Home />,
1618
children: [
17-
{ path: '/', element: <Collections /> },
19+
{ path: '/', element: <Homepage /> },
20+
{ path: '/welcome', element: <Welcome /> },
1821
{ path: '/console', element: <Console /> },
1922
{ path: '/datasets', element: <Datasets /> },
2023
{ path: '/collections', element: <Collections /> },

0 commit comments

Comments
 (0)