Skip to content

Commit 586a3a1

Browse files
committed
[Feature] Merge new landing service
1 parent a0c71c2 commit 586a3a1

File tree

2 files changed

+76
-12
lines changed

2 files changed

+76
-12
lines changed

src/pages/Home.tsx

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import { Box, Typography, Button, Container } from "@mui/material";
1+
import { Box, Typography, Button, Container, Grid } from "@mui/material";
2+
import { Colors } from "design/theme";
23
import { useAppDispatch } from "hooks/useAppDispatch";
34
import { useAppSelector } from "hooks/useAppSelector";
45
import NeuroJsonGraph from "modules/universe/NeuroJsonGraph";
56
import React, { useEffect } from "react";
7+
import { useNavigate } from "react-router-dom";
68
import { fetchRegistry } from "redux/neurojson/neurojson.action";
79
import { NeurojsonSelector } from "redux/neurojson/neurojson.selector";
810

911
const Home: React.FC = () => {
12+
const navigate = useNavigate();
1013
const dispatch = useAppDispatch();
1114
const { registry } = useAppSelector(NeurojsonSelector);
1215

@@ -15,12 +18,73 @@ const Home: React.FC = () => {
1518
}, [dispatch]);
1619

1720
return (
18-
<Container style={{ width: "100%", height: "100vh", padding: 0 }}>
19-
{registry && registry.length > 0 ? (
20-
<NeuroJsonGraph registry={registry} />
21-
) : (
22-
<div>No data available to display</div>
23-
)}
21+
<Container
22+
style={{
23+
minWidth: "100%",
24+
height: "100vh",
25+
padding: 0,
26+
overflow: "hidden",
27+
position: "relative",
28+
}}
29+
>
30+
<Box
31+
sx={{
32+
zIndex: "2",
33+
position: "relative",
34+
width: "100%",
35+
overflow: "hidden",
36+
}}
37+
>
38+
{registry && registry.length > 0 ? (
39+
<NeuroJsonGraph registry={registry} />
40+
) : (
41+
<div>No data available to display</div>
42+
)}
43+
</Box>
44+
45+
<Box
46+
sx={{
47+
maxWidth: "42%",
48+
zIndex: "3",
49+
position: "absolute",
50+
top: "10%",
51+
left: "5%",
52+
backgroundColor: "rgba(255, 255, 255, 0.8)",
53+
padding: "1.5rem",
54+
borderRadius: "8px",
55+
boxShadow: "0 4px 8px rgba(0, 0, 0, 0.1)",
56+
}}
57+
>
58+
{/* Header Section */}
59+
<Typography
60+
variant="h3"
61+
gutterBottom
62+
sx={{ color: Colors.primary.dark }}
63+
>
64+
Discover NeuroJSON IO
65+
</Typography>
66+
<Typography variant="body1" sx={{ color: Colors.textSecondary }}>
67+
Efficiently manage and explore your CouchDB databases and datasets
68+
with ease.
69+
</Typography>
70+
71+
{/* Navigation to Database Page */}
72+
<Box mt={4}>
73+
<Button
74+
variant="contained"
75+
sx={{
76+
backgroundColor: Colors.primary.main,
77+
color: Colors.white,
78+
"&:hover": {
79+
backgroundColor: Colors.primary.dark,
80+
},
81+
}}
82+
onClick={() => navigate("/databases")}
83+
>
84+
View Databases
85+
</Button>
86+
</Box>
87+
</Box>
2488
</Container>
2589
);
2690
};

src/services/couchDb.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import axios from "axios";
22

3-
const COUCHDB_URL = "http://127.0.0.1:5984"; // CouchDB URL
3+
const baseURL = "http://127.0.0.1:5984"; // CouchDB URL
44
const username = "admin"; // Replace with your username
55
const password = "mypassword"; // Replace with your password
66

77
export const fetchDatabases = async (): Promise<string[]> => {
88
try {
9-
const response = await axios.get(`${COUCHDB_URL}/_all_dbs`, {
9+
const response = await axios.get(`${baseURL}/_all_dbs`, {
1010
auth: { username, password },
1111
headers: { Accept: "application/json" },
1212
});
@@ -24,7 +24,7 @@ export const fetchDatabases = async (): Promise<string[]> => {
2424

2525
export const fetchDocuments = async (dbName: string): Promise<any[]> => {
2626
try {
27-
const response = await axios.get(`${COUCHDB_URL}/${dbName}/_all_docs`, {
27+
const response = await axios.get(`${baseURL}/${dbName}/_all_docs`, {
2828
auth: { username, password },
2929
params: { include_docs: true },
3030
});
@@ -41,7 +41,7 @@ export const fetchDocumentById = async (
4141
documentId: string
4242
): Promise<any> => {
4343
try {
44-
const response = await axios.get(`${COUCHDB_URL}/${dbName}/${documentId}`, {
44+
const response = await axios.get(`${baseURL}/${dbName}/${documentId}`, {
4545
auth: { username, password },
4646
});
4747

@@ -63,7 +63,7 @@ export const fetchPaginatedDocument = async (
6363
): Promise<any[]> => {
6464
try {
6565
console.log("Fetching paginated data:", { dbName, offset, limit });
66-
const response = await axios.get(`${COUCHDB_URL}/${dbName}/_all_docs`, {
66+
const response = await axios.get(`${baseURL}/${dbName}/_all_docs`, {
6767
auth: { username, password },
6868
params: { skip: offset, limit, include_docs: true },
6969
});

0 commit comments

Comments
 (0)