import { Avatar, Box, Card, CardActionArea, CardContent, CardHeader, Grid, IconButton, Paper, Snackbar, Stack, Typography, } from "@mui/material"; import React, { FC, useState } from "react"; import { Clipboard, Link } from "react-feather"; import { Route, RoutesPageData } from "../types"; import Section from "./Section"; import SidebarPage from "./SidebarPage"; type RouteCardProps = { route: Route; }; const RouteCard: FC = ({ route }) => { const [showSnackbar, setShowSnackbar] = useState(false); const handleClick = (evt: React.MouseEvent) => { if (route.connect_command) { evt.preventDefault(); navigator.clipboard.writeText(route.connect_command); setShowSnackbar(true); } }; return ( ) : route.type === "tcp" ? ( TCP ) : route.type === "udp" ? ( UDP ) : ( ) } action={ route.connect_command && ( ) } title={route.name} /> {route.description && ( {route.description} )} {route.connect_command && ( {route.connect_command} )} setShowSnackbar(false)} message="Copied to Clipboard" /> ); }; type RoutesSectionProps = { type: "http" | "tcp" | "udp"; title: string; allRoutes: Route[]; }; const RoutesSection: FC = ({ type, title, allRoutes }) => { const routes = allRoutes?.filter((r) => r.type === type); if (routes?.length === 0) { return <>; } return (
{routes?.map((r) => ( ))}
); }; type RoutesPageProps = { data: RoutesPageData; }; const RoutesPage: FC = ({ data }) => { return ( {data?.routes ? ( <> ) : ( No accessible routes found )} ); }; export default RoutesPage;