Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/components/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,17 @@ export default function DataTable({
bg={selectedRow === file.id ? theme.primaryColor : ""}
>
<Table.Td style={{ paddingLeft: "25px", size: "xs" }}>
{getFileNameWithoutExtension(file.mcap_files[0].file_name)}
{file.mcap_files
? getFileNameWithoutExtension(file.mcap_files[0].file_name)
: null}
</Table.Td>
<Table.Td>{file.date}</Table.Td>
<Table.Td style={{ size: "xs"}}>
<Input.Wrapper >
<Table.Td style={{ size: "xs" }}>
<Input.Wrapper>
<Textarea
variant="unstyled"
value={file.location}
style={{ whiteSpace: "normal", wordWrap: "break-word"}}
style={{ whiteSpace: "normal", wordWrap: "break-word" }}
readOnly
autosize
placeholder="No Location Available"
Expand All @@ -81,7 +83,7 @@ export default function DataTable({
<Textarea
variant="unstyled"
value={file.notes}
style={{ whiteSpace: "normal", wordWrap: "break-word"}}
style={{ whiteSpace: "normal", wordWrap: "break-word" }}
readOnly
autosize
placeholder="No Note Available"
Expand Down
22 changes: 13 additions & 9 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "@/css/Navbar.css";
import { NavLink } from "react-router-dom";
import FileUpload from "@/components/FileUpload";
import Feedback from "@/components/Feedback";
import PingStatus from "@/components/PingStatus";
import { Button } from "@mantine/core";
import { IconHelp } from "@tabler/icons-react";

Expand All @@ -29,23 +30,26 @@ export default function Navbar() {
alt="Logo"
className="navbar-icon"
/>
<Button
<Button
variant="filled"
component="a"
target="_blank"
href="https://wiki.hytechracing.org/books/software/page/query-frontend-demo-and-documentation">
<IconHelp size="25"/>
href="https://wiki.hytechracing.org/books/software/page/query-frontend-demo-and-documentation"
>
<IconHelp size="25" />
</Button>
{links}

{/* Once POST API is out -- Currently WIP */}
<FileUpload uploadUrl={`${import.meta.env.VITE_API_URL}/api/v2/mcaps/bulk_upload`}/>
<div style={{right: 0}}>
<Feedback/>
</div>
<FileUpload
uploadUrl={`${import.meta.env.VITE_API_URL}/api/v2/mcaps/bulk_upload`}
/>
<div style={{ right: 0 }}>
<Feedback />
</div>
{/* Optionally render active link or other content here */}
<h3 className="hytechName">{hytechName}</h3>

<PingStatus />
</nav>
);
}
}
37 changes: 37 additions & 0 deletions src/components/PingStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import "@/css/Navbar.css";
import { useEffect, useState } from "react";

const PingStatus: React.FC = () => {
const [vpnActive, setVpnActive] = useState(false);
const [isHovering, setIsHovering] = useState(false);

const handleGetStatus = async () => {
try {
const res = await fetch(`${import.meta.env.VITE_API_URL}/ping`, {});

setVpnActive(res.ok); // res is always truthy if fetch didn't throw
} catch {
setVpnActive(false);
}
};

useEffect(() => {
handleGetStatus();
}, []);

return (
<div
className={`vpnStatus ${vpnActive ? "vpnStatusGood" : "vpnStatusBad"}`}
onMouseEnter={() => setIsHovering(true)}
onMouseLeave={() => setIsHovering(false)}
>
{isHovering ? (
<div className="vpnStatusHover">
VPN is {vpnActive ? "active" : "inactive"}
</div>
) : null}
</div>
);
};

export default PingStatus;
87 changes: 57 additions & 30 deletions src/css/Navbar.css
Original file line number Diff line number Diff line change
@@ -1,47 +1,74 @@
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap");

nav {
padding: 15px 0;
background: #B3A36A;
display: flex;
height: 50px;
align-items: center;
padding: 15px 0;
background: #b3a36a;
display: flex;
height: 50px;
align-items: center;
}

.nav-link {
padding: 3px 15px;
text-decoration: none;
color: #FFFFFF;
background-color: transparent;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
transition: all 0.2s ease-in-out;
display: inline-block;
margin-left: 20px;
font-family: 'Roboto', sans-serif;
padding: 3px 15px;
text-decoration: none;
color: #ffffff;
background-color: transparent;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
transition: all 0.2s ease-in-out;
display: inline-block;
margin-left: 20px;
font-family: "Roboto", sans-serif;
}

#navbar a.active {
background-color: #978750;
font-weight: bold;
background-color: #978750;
font-weight: bold;
}

.nav-link:hover {
color: white;
background-color: #D1BF80;
color: white;
background-color: #d1bf80;
}

.navbar-icon {
height: 30px;
margin-right: 20px;
margin-left: 20px;
height: 30px;
margin-right: 20px;
margin-left: 20px;
}

.hytechName {
margin-left: auto;
margin-right: 10px;
border-radius: 5px;
color: white;
font-weight: 900;
}
margin-left: auto;
margin-right: 10px;
border-radius: 5px;
color: white;
font-weight: 900;
}

.vpnStatus {
border-radius: 100%;
width: 1rem;
height: 1rem;
margin: 1rem;
cursor: pointer;
}

.vpnStatusGood {
background-color: green;
}

.vpnStatusBad {
background-color: red;
}

.vpnStatusHover {
white-space: nowrap;
z-index: 10;
background-color: white;
width: fit-content;
border-radius: 5px;
transform: translate(-85%, 75%);
padding: 0.25rem;
border: 1px solid gray;
}