diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index e3002b31..e8864d17 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -23,7 +23,7 @@ const App = () => { -
+
diff --git a/frontend/src/components/listing/ListingBody.tsx b/frontend/src/components/listing/ListingBody.tsx new file mode 100644 index 00000000..47e66cb2 --- /dev/null +++ b/frontend/src/components/listing/ListingBody.tsx @@ -0,0 +1,30 @@ +import { paths } from "gen/api"; +import ListingArtifacts from "./ListingArtifacts"; +import ListingChildren from "./ListingChildren"; +import ListingDescription from "./ListingDescription"; + +type ListingResponse = + paths["/listings/{id}"]["get"]["responses"][200]["content"]["application/json"]; + +interface ListingBodyProps { + listing: ListingResponse; +} + +const ListingBody = (props: ListingBodyProps) => { + const { listing } = props; + return ( +
+ + + +
+ ); +}; + +export default ListingBody; diff --git a/frontend/src/components/listing/ListingFooter.tsx b/frontend/src/components/listing/ListingFooter.tsx new file mode 100644 index 00000000..e262e26c --- /dev/null +++ b/frontend/src/components/listing/ListingFooter.tsx @@ -0,0 +1,20 @@ +import ListingDeleteButton from "./ListingDeleteButton"; + +interface Props { + listing_id: string; + edit: boolean; +} + +const ListingFooter = ({ listing_id, edit }: Props) => { + if (!edit) { + return <>; + } + + return ( +
+ +
+ ); +}; + +export default ListingFooter; diff --git a/frontend/src/components/listing/ListingHeader.tsx b/frontend/src/components/listing/ListingHeader.tsx new file mode 100644 index 00000000..3524800b --- /dev/null +++ b/frontend/src/components/listing/ListingHeader.tsx @@ -0,0 +1,37 @@ +import { Button } from "components/ui/Button/Button"; +import { FaTimes } from "react-icons/fa"; +import { useNavigate } from "react-router-dom"; + +interface Props { + title: string; + edit: boolean; +} + +const CloseButton = () => { + const navigate = useNavigate(); + + return ( + + ); +}; + +const ListingHeader = (props: Props) => { + const { title } = props; + return ( +
+
+

{title}

+ +
+
+ ); +}; + +export default ListingHeader; diff --git a/frontend/src/components/listing/ListingTitle.tsx b/frontend/src/components/listing/ListingTitle.tsx deleted file mode 100644 index feebe3e5..00000000 --- a/frontend/src/components/listing/ListingTitle.tsx +++ /dev/null @@ -1,16 +0,0 @@ -interface Props { - title: string; - // TODO: If can edit, allow the user to update the title. - edit: boolean; -} - -const ListingTitle = (props: Props) => { - const { title } = props; - return ( -
-

{title}

-
- ); -}; - -export default ListingTitle; diff --git a/frontend/src/components/nav/Navbar.tsx b/frontend/src/components/nav/Navbar.tsx index 7cd32f1e..793d08a9 100644 --- a/frontend/src/components/nav/Navbar.tsx +++ b/frontend/src/components/nav/Navbar.tsx @@ -1,4 +1,3 @@ -import { useAuthentication } from "hooks/auth"; import { useDarkMode } from "hooks/dark_mode"; import { useState } from "react"; import { FaMoon, FaSun, FaUserCircle } from "react-icons/fa"; @@ -10,7 +9,6 @@ const SIZE = 20; const Navbar = () => { const [showSidebar, setShowSidebar] = useState(false); const { darkMode, setDarkMode } = useDarkMode(); - const { isAuthenticated } = useAuthentication(); const navigate = useNavigate(); return ( @@ -29,22 +27,13 @@ const Navbar = () => { -
- {isAuthenticated && ( - setShowSidebar(false)} /> - )} + setShowSidebar(false)} /> ); }; diff --git a/frontend/src/components/nav/Sidebar.tsx b/frontend/src/components/nav/Sidebar.tsx index e8182664..0777a3f4 100644 --- a/frontend/src/components/nav/Sidebar.tsx +++ b/frontend/src/components/nav/Sidebar.tsx @@ -1,7 +1,9 @@ import clsx from "clsx"; +import { useAuthentication } from "hooks/auth"; import { FaBookOpen, FaDoorClosed, + FaDoorOpen, FaHome, FaKey, FaLock, @@ -17,15 +19,49 @@ interface SidebarItemProps { title: string; icon?: JSX.Element; onClick?: () => void; + size?: "sm" | "md" | "lg"; + align?: "left" | "right"; } -const SidebarItem = ({ icon, title, onClick }: SidebarItemProps) => { +const SidebarItem = ({ + icon, + title, + onClick, + size, + align, +}: SidebarItemProps) => { return (
  • -
  • @@ -47,6 +83,7 @@ interface Props { const Sidebar = ({ show, onClose }: Props) => { const navigate = useNavigate(); + const { isAuthenticated } = useAuthentication(); return (
    { Close menu
    -
      +
        } @@ -80,6 +117,7 @@ const Sidebar = ({ show, onClose }: Props) => { navigate("/"); onClose(); }} + size="md" /> { navigate("/browse"); onClose(); }} + size="md" /> { navigate("/create"); onClose(); }} + size="md" /> - } - onClick={() => { - navigate("/profile"); - onClose(); - }} - /> - } - onClick={() => { - navigate("/keys"); - onClose(); - }} - /> - } - onClick={() => { - navigate("/logout"); - onClose(); - }} - /> - + {isAuthenticated && ( + } + onClick={() => { + navigate("/profile"); + onClose(); + }} + size="md" + /> + )} + {isAuthenticated && ( + } + onClick={() => { + navigate("/keys"); + onClose(); + }} + size="md" + /> + )} + {isAuthenticated ? ( + } + onClick={() => { + navigate("/logout"); + onClose(); + }} + size="md" + /> + ) : ( + } + onClick={() => { + navigate("/login"); + onClose(); + }} + size="md" + /> + )} +
      +
    + {/* Aligned to bottom */} +
    +
      } @@ -130,6 +193,8 @@ const Sidebar = ({ show, onClose }: Props) => { navigate("/about"); onClose(); }} + size="sm" + align="right" /> { navigate("/privacy"); onClose(); }} + size="sm" + align="right" /> { navigate("/tos"); onClose(); }} + size="sm" + align="right" />
    diff --git a/frontend/src/pages/APIKeys.tsx b/frontend/src/pages/APIKeys.tsx index 7602ee62..6816229e 100644 --- a/frontend/src/pages/APIKeys.tsx +++ b/frontend/src/pages/APIKeys.tsx @@ -1,16 +1,20 @@ +import RequireAuthentication from "components/auth/RequireAuthentication"; + const APIKeys = () => { return ( -
    -
    -

    - API Key -

    -

    - This page is under construction. You will be able to generate API keys - here. -

    -
    -
    + +
    +
    +

    + API Key +

    +

    + This page is under construction. You will be able to generate API + keys here. +

    +
    +
    +
    ); }; diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index 1016969b..aaad8f41 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -15,7 +15,7 @@ const Home = () => { Buy and sell robots and robot parts, share hardware and software, and connect with other robot enthusiasts, all in one place.

    -
    +
    - - - - - +
    + + +
    ); }; diff --git a/frontend/src/pages/Profile.tsx b/frontend/src/pages/Profile.tsx index e7b15efb..8871af0b 100644 --- a/frontend/src/pages/Profile.tsx +++ b/frontend/src/pages/Profile.tsx @@ -1,16 +1,20 @@ +import RequireAuthentication from "components/auth/RequireAuthentication"; + const Profile = () => { return ( -
    -
    -

    - Profile -

    -

    - This page is under construction. You will be able to view and edit - your profile here. -

    -
    -
    + +
    +
    +

    + Profile +

    +

    + This page is under construction. You will be able to view and edit + your profile here. +

    +
    +
    +
    ); };