Skip to content

Commit 93b2c20

Browse files
Merge pull request #17 from msenechal/main
Small UI enhancements
2 parents 765c0c3 + 898c4a6 commit 93b2c20

File tree

14 files changed

+98
-216
lines changed

14 files changed

+98
-216
lines changed

frontend/src/components/ConnectionModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ export default function ConnectionModal({ open, setOpenConnection, setConnection
1111
const [database, setDatabase] = useState<string>('recommendations');
1212
const [username, setUsername] = useState<string>('recommendations');
1313
const [password, setPassword] = useState<string>('recommendations');
14-
const {setUserCredentials}=useCredentials();
14+
const { setUserCredentials } = useCredentials();
1515

1616
function submitConnection() {
1717
const connectionURI = `${selectedProtocol}://${hostname}:${port}`;
18-
setUserCredentials({uri:hostname,userName:username,password});
18+
setUserCredentials({ uri: hostname, userName: username, password });
1919
setDriver(connectionURI, username, password).then((isSuccessful) => {
2020
setConnectionStatus(isSuccessful);
2121
});

frontend/src/components/Content.tsx

Lines changed: 26 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ export default function Content() {
1616
let session = localStorage.getItem('neo4j.connection');
1717
if (session) {
1818
let neo4jConnection = JSON.parse(session);
19-
setUserCredentials({ uri: neo4jConnection.uri, userName: neo4jConnection.user, password: neo4jConnection.password })
19+
setUserCredentials({
20+
uri: neo4jConnection.uri,
21+
userName: neo4jConnection.user,
22+
password: neo4jConnection.password,
23+
});
2024
setDriver(neo4jConnection.uri, neo4jConnection.user, neo4jConnection.password).then((isSuccessful: boolean) => {
2125
setConnectionStatus(isSuccessful);
2226
});
@@ -26,61 +30,30 @@ export default function Content() {
2630
});
2731

2832
return (
29-
<>
30-
<div
33+
<div
34+
className='n-bg-palette-neutral-bg-default'
35+
style={{
36+
width: '100%',
37+
height: 'calc(100dvh - 58px)',
38+
padding: 3,
39+
display: 'flex',
40+
flexDirection: 'column',
41+
alignItems: 'center',
42+
gap: 1,
43+
}}
44+
>
45+
<Flex
46+
flexDirection='column'
3147
style={{
32-
width: '100%',
33-
padding: 3,
34-
display: 'flex',
35-
flexDirection: 'column',
48+
padding: '12px',
49+
justifyContent: 'center',
3650
alignItems: 'center',
37-
gap: 1,
51+
width: '100%',
52+
marginTop: '10px',
3853
}}
3954
>
40-
<div className='n-bg-palette-neutral-bg-default' style={{
41-
width: '100%',
42-
padding: 3,
43-
display: 'flex',
44-
flexDirection: 'column',
45-
alignItems: 'center',
46-
gap: 1,
47-
}}>
48-
{ /*
49-
<ConnectionModal
50-
open={openConnection}
51-
setOpenConnection={setOpenConnection}
52-
setConnectionStatus={setConnectionStatus}
53-
/>
54-
55-
<Typography variant='body-medium' style={{ display: 'flex', padding: '20px' }}>
56-
Neo4j connection Status:
57-
<Typography variant='body-medium' style={{ marginLeft: '10px' }}>
58-
{!connectionStatus ? <Label color='danger'>Not connected</Label> : <Label color='success'>Connected</Label>}
59-
</Typography>
60-
</Typography>
61-
62-
{!connectionStatus ? (
63-
<Button onClick={() => setOpenConnection(true)}>Connect to Neo4j</Button>
64-
) : (
65-
<Button onClick={() => disconnect().then(() => setConnectionStatus(false))}>Disconnect</Button>
66-
)}
67-
*/ }
68-
</div>
69-
<Flex
70-
borderRadius="xl"
71-
flexDirection="column"
72-
style={{
73-
border: '1px solid rgb(var(--theme-palette-neutral-border-weak))',
74-
padding: '12px',
75-
justifyContent: "center",
76-
alignItems: "center",
77-
width: "100%",
78-
marginTop: "10px"
79-
}}
80-
>
81-
<DropZone />
82-
</Flex>
83-
</div>
84-
</>
55+
<DropZone />
56+
</Flex>
57+
</div>
8558
);
8659
}

frontend/src/components/DropZone.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface CustomFile extends Partial<globalThis.File> {
1212
status: string;
1313
NodesCount: number;
1414
id: string;
15-
relationshipCount: number,
15+
relationshipCount: number;
1616
}
1717

1818
export default function DropZone() {
@@ -99,8 +99,6 @@ export default function DropZone() {
9999
return (
100100
<>
101101
<Box
102-
borderRadius='xl'
103-
className=' n-border n-border-palette-primary-border-strong'
104102
style={{
105103
width: '100%',
106104
padding: '0.8em',

frontend/src/components/FileTable.tsx

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { useState, useEffect } from 'react';
33
import { useReactTable, getCoreRowModel, createColumnHelper } from '@tanstack/react-table';
44
import { formatFileSize } from '../utils/utils';
55

6-
76
interface CustomFile extends Partial<globalThis.File> {
8-
processing: string,
9-
status: string,
10-
NodesCount: number,
11-
id: string,
12-
relationshipCount: number,
7+
processing: string;
8+
status: string;
9+
NodesCount: number;
10+
id: string;
11+
relationshipCount: number;
1312
}
1413
export default function FileTable({ files }: { files: CustomFile[] | [] }) {
1514
const [data, setData] = useState([...files]);
@@ -33,43 +32,41 @@ export default function FileTable({ files }: { files: CustomFile[] | [] }) {
3332
footer: (info) => info.column.id,
3433
}),
3534
columnHelper.accessor((row) => row.processing, {
36-
id: "processing",
35+
id: 'processing',
3736
cell: (info) => <i>{info.getValue()}</i>,
3837
header: () => <span>Processing Time</span>,
3938
footer: (info) => info.column.id,
4039
}),
4140
columnHelper.accessor((row) => row.status, {
42-
id: "status",
41+
id: 'status',
4342
cell: (info) => <i>{info.getValue()}</i>,
4443
header: () => <span>Status</span>,
4544
footer: (info) => info.column.id,
4645
}),
4746
columnHelper.accessor((row) => row.NodesCount, {
48-
id: "NodesCount",
47+
id: 'NodesCount',
4948
cell: (info) => <i>{info.getValue()}</i>,
5049
header: () => <span>Nodes Count</span>,
5150
footer: (info) => info.column.id,
5251
}),
5352
columnHelper.accessor((row) => row.relationshipCount, {
54-
id: "relationshipCount",
53+
id: 'relationshipCount',
5554
cell: (info) => <i>{info.getValue()}</i>,
5655
header: () => <span>Relationships</span>,
5756
footer: (info) => info.column.id,
58-
})
57+
}),
5958
];
6059

6160
useEffect(() => {
6261
setData([...files]);
6362
}, [files]);
6463

65-
6664
const table = useReactTable({
6765
data,
6866
columns,
6967
getCoreRowModel: getCoreRowModel(),
7068
});
7169

72-
7370
return (
7471
<>
7572
{data ? (
@@ -81,10 +78,8 @@ export default function FileTable({ files }: { files: CustomFile[] | [] }) {
8178
styling={{
8279
zebraStriping: false,
8380
borderStyle: 'all-sides',
84-
8581
}}
8682
/>
87-
8883
</div>
8984
) : null}
9085
</>

frontend/src/components/Layout/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function Header({ themeMode, toggleTheme }: { themeMode: string;
2424
>
2525
<Typography variant='h6' component='a' href='#app-bar-with-responsive-menu' sx={{}}>
2626
<img
27-
src={themeMode === 'dark' ? Neo4jLogoBW : Neo4jLogoColor }
27+
src={themeMode === 'dark' ? Neo4jLogoBW : Neo4jLogoColor}
2828
style={{ height: '32px', minHeight: '32px', minWidth: '32px' }}
2929
alt='Neo4j Logo'
3030
/>

frontend/src/components/Layout/PageLayout.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

frontend/src/components/Layout/SideNav.tsx

Lines changed: 0 additions & 66 deletions
This file was deleted.

frontend/src/components/QuickStarter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Header from './Layout/Header';
2-
import PageLayout from './Layout/PageLayout';
2+
import Content from './Content';
33
import React, { useState } from 'react';
44
import { ThemeWrapperContext } from '../context/ThemeWrapper';
55

@@ -17,7 +17,7 @@ export default function QuickStarter() {
1717
return (
1818
<div>
1919
<Header themeMode={themeMode} toggleTheme={toggleColorMode} />
20-
<PageLayout />
20+
<Content />
2121
</div>
2222
);
2323
}

frontend/src/context/ThemeWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import QuickStarter from '../components/QuickStarter';
44
import UserCredentialsWrapper from './UserCredentials';
55

66
export const ThemeWrapperContext = createContext({
7-
toggleColorMode: () => { },
7+
toggleColorMode: () => {},
88
colorMode: 'light' as string,
99
});
1010

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import axios from 'axios';
22
import { url } from '../utils/utils';
33
const healthStatus = async () => {
4-
try {
5-
const healthUrl = `${url()}health`
6-
const response = await axios.get(healthUrl);
7-
return response
8-
} catch (error) {
9-
console.log("API status error", error)
10-
throw error
11-
}
12-
}
13-
export {healthStatus}
4+
try {
5+
const healthUrl = `${url()}health`;
6+
const response = await axios.get(healthUrl);
7+
return response;
8+
} catch (error) {
9+
console.log('API status error', error);
10+
throw error;
11+
}
12+
};
13+
export { healthStatus };

0 commit comments

Comments
 (0)