Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Frontend for Ubicate #191

Draft
wants to merge 44 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6f4dd02
Test on the sidebar
IgnacioPalma Jan 12, 2025
91b002f
added colors and improved sidebar
IgnacioPalma Jan 23, 2025
24ec6ae
added design system
IgnacioPalma Jan 31, 2025
0c70db6
Made sidebar and updated favicon
IgnacioPalma Jan 31, 2025
71ebff4
Made subsidebars
IgnacioPalma Feb 5, 2025
1635a95
Added search option on sidebar
IgnacioPalma Feb 5, 2025
b7d9b41
Merge branch 'main' of https://github.com/open-source-uc/UbiCate-v2 i…
IgnacioPalma Feb 6, 2025
4ff66a2
Updated to good practices on implementing the fonts
IgnacioPalma Feb 6, 2025
1fc002d
trying to sattisfy the build
IgnacioPalma Feb 6, 2025
ac3cd22
Updated to v4
IgnacioPalma Feb 7, 2025
be3aec2
Fixed lint problems
IgnacioPalma Feb 7, 2025
19a117e
Disabled the guides
IgnacioPalma Feb 7, 2025
46af856
Added search by campus
IgnacioPalma Feb 7, 2025
2211ebb
Added linting
IgnacioPalma Feb 7, 2025
4f85144
Handled user click on campus; now the sidebar collapses
IgnacioPalma Feb 7, 2025
78fe336
Back to darkv11
IgnacioPalma Feb 7, 2025
49aeedc
Update to navigation guidance night v4
IgnacioPalma Feb 7, 2025
f7606e7
npm run lint:fix
IgnacioPalma Feb 7, 2025
ccc757c
extraer logica del geocoder para que la funcion de busqueda cambie se…
Utmite Feb 8, 2025
880929b
(fix)legacy code remove
Utmite Feb 8, 2025
b0e86f2
Now, when searching, the sidebar closes
IgnacioPalma Feb 8, 2025
7620fdd
Remove legacy code
IgnacioPalma Feb 8, 2025
d99262f
Removed extra stuff from the map
IgnacioPalma Feb 8, 2025
60eb3d5
Changes to the pills; removed old icons, improved desktop
IgnacioPalma Feb 8, 2025
804bd85
Implemented pill filter for desktop
IgnacioPalma Feb 8, 2025
acf9f95
(fix)margin of map
Utmite Feb 8, 2025
0af2e68
Added BV suggestion; close button
IgnacioPalma Feb 9, 2025
db0eb9b
Improved pills; added hover
IgnacioPalma Feb 9, 2025
3cbab4f
Improved markers in the map. Also, changed colors in the layers, and …
IgnacioPalma Feb 9, 2025
6976b1c
npm lint fix
IgnacioPalma Feb 9, 2025
131a970
Changed build
IgnacioPalma Feb 9, 2025
1f87ab6
Improvements to menuinformation
IgnacioPalma Feb 9, 2025
36e7cc9
Added dropdown
IgnacioPalma Feb 9, 2025
729f38b
slint
Utmite Feb 10, 2025
1dc81c7
(feat)bug
Utmite Feb 10, 2025
992ab51
Updated form-geo
IgnacioPalma Feb 10, 2025
c70edd4
Added description to DCC for testing
IgnacioPalma Feb 10, 2025
7b98dfc
Desktop nearly done; menuInformation finished, accesibility changes i…
IgnacioPalma Feb 10, 2025
dcf741c
Fix error and lint
IgnacioPalma Feb 10, 2025
ac959c7
Fixed style issue in the menuInformation; details of the ubication color
IgnacioPalma Feb 10, 2025
7a341a6
Lint:fix
Utmite Feb 11, 2025
037880e
Started adding functionality to mobile and tablet
IgnacioPalma Feb 16, 2025
ac4e7d0
Improving the mobile experience
IgnacioPalma Feb 16, 2025
6893ecb
Lint fix
IgnacioPalma Feb 16, 2025
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
226 changes: 226 additions & 0 deletions app/components/NavigationBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
// Language: TSX
"use client";

import { useState } from "react";
import Link from "next/link";
import { useSearchParams } from "next/navigation";
import { useSidebar } from "../context/sidebarCtx";
import LandingSearch from "./landingSearch";
import PillFilter from "./pillFilter";

type SubSidebarType = "buscar" | "campus" | "guías" | null;

export default function Sidebar() {
const { isOpen, toggleSidebar } = useSidebar();
const searchParams = useSearchParams();
const [activeSubSidebar, setActiveSubSidebar] = useState<SubSidebarType>(null);

const toggleSubSidebar = (type: SubSidebarType) => {
setActiveSubSidebar((prev) => (prev === type ? null : type));
};

// Handle button click in collapsed sidebar
const handleCollapsedClick = (type: SubSidebarType) => {
toggleSidebar(); // expand main sidebar
toggleSubSidebar(type); // open specific sub sidebar
};

return (
<>
{/* Collapsed Sidebar */}
{!isOpen && (
<aside className="fixed inset-y-0 left-0 bg-brown-dark text-white-ubi flex flex-col z-50">
<div className="flex flex-col items-center py-8 px-4 space-y-6">
<div className="mb-9 flex justify-center">
<button onClick={toggleSidebar} className="hover:text-brown-medium">
<span className="material-symbols-outlined self-center">dock_to_right</span>
</button>
</div>
<button
onClick={() => handleCollapsedClick("buscar")}
className="w-10 h-10 bg-brown-light rounded-lg flex items-center justify-center hover:bg-brown-medium"
>
<span className="material-symbols-outlined">search</span>
</button>
<button
onClick={() => handleCollapsedClick("campus")}
className="w-10 h-10 bg-brown-light rounded-lg flex items-center justify-center hover:bg-brown-medium"
>
<span className="material-symbols-outlined">map</span>
</button>
<button
onClick={() => handleCollapsedClick("guías")}
className="w-10 h-10 bg-brown-light rounded-lg flex items-center justify-center hover:bg-brown-medium"
>
<span className="material-symbols-outlined">menu_book</span>
</button>
</div>
</aside>
)}

{/* Expanded Sidebar */}
<aside
className={`fixed inset-y-0 left-0 bg-brown-dark text-white-ubi text-snow transform transition-transform duration-300 z-50 ${
isOpen ? "translate-x-0 w-64" : "-translate-x-full"
}`}
>
<div className="flex flex-col h-full py-5 px-4 space-y-6">
{/* Logo and Button to Close Sidebar */}
<div className="flex items-center justify-between">
<Link href="/">
<img src="/long-logo.svg" className="pl-2" alt="Logo" width={"120rm"} />
</Link>
<div className="flex-row-reverse">
<button onClick={toggleSidebar} className="hover:text-brown-medium">
<span className="material-symbols-outlined">dock_to_right</span>
</button>
</div>
</div>

{/* Navigation Options */}
<nav className="flex-1">
<div className="pt-5 space-y-2">
<button
onClick={() => toggleSubSidebar("buscar")}
className="w-full flex items-center space-x-4 p-2 rounded-md hover:bg-brown-medium"
>
<span
className={`w-10 h-10 rounded-lg flex items-center justify-center ${
activeSubSidebar === "buscar" ? "bg-blue-location" : "bg-brown-light"
}`}
>
<span className="material-symbols-outlined">search</span>
</span>
<span>Buscar</span>
</button>
<button
onClick={() => toggleSubSidebar("campus")}
className="w-full flex items-center space-x-4 p-2 rounded-md hover:bg-brown-medium"
>
<span
className={`w-10 h-10 rounded-lg flex items-center justify-center ${
activeSubSidebar === "campus" ? "bg-blue-location" : "bg-brown-light"
}`}
>
<span className="material-symbols-outlined">map</span>
</span>
<span>Campus</span>
</button>
<button
onClick={() => toggleSubSidebar("guías")}
className="w-full flex items-center space-x-4 p-2 rounded hover:bg-brown-medium"
>
<span
className={`w-10 h-10 rounded-lg flex items-center justify-center ${
activeSubSidebar === "guías" ? "bg-blue-location" : "bg-brown-light"
}`}
>
<span className="material-symbols-outlined">menu_book</span>
</span>
<span>Guías</span>
</button>
</div>
</nav>

{/* Buttons for Promotion */}
<div className="flex-col space-y-4">
<div className="w-full rounded-xl bg-brown-light">
<div className="text-xs text-white-blue p-4">
¿Crees que algo falta?
<Link
href={`/form-geo/${
searchParams.get("campus") ? `?campus=${searchParams.get("campus")}` : ""
}`}
className="font-semibold block hover:underline"
>
Ayúdanos agregándolo
</Link>
</div>
</div>
<div className="w-full rounded-xl bg-blue-location">
<div className="text-xs text-white-blue p-4">
Proyecto desarrollado por
<a href="https://osuc.dev" className="font-semibold block hover:underline">
Open Source eUC
</a>
</div>
</div>
</div>
</div>

{/* Sub Sidebar inside Expanded Sidebar */}
{isOpen && activeSubSidebar && (
<aside
className={`absolute top-0 left-full h-full w-96 border-1 border-l border-brown-light bg-brown-dark text-white-ubi transform transition-transform duration-300 z-60 ${
activeSubSidebar ? "translate-x-0" : "translate-x-full"
}`}
>
<div className="py-7 px-4 space-y-6">
{activeSubSidebar === "buscar" && (
<>
<h3 className="font-bold text-lg">Buscar</h3>
<ul className="space-y-2">
<LandingSearch />
</ul>
<div>

</div>
</>
)}
{activeSubSidebar === "campus" && (
<>
<h3 className="font-bold mb-4">Campus Options</h3>
<ul className="space-y-2">
<li>
<Link href="/campus/option1" className="hover:underline">
Campus Option 1
</Link>
</li>
<li>
<Link href="/campus/option2" className="hover:underline">
Campus Option 2
</Link>
</li>
<li>
<Link href="/campus/option3" className="hover:underline">
Campus Option 3
</Link>
</li>
</ul>
</>
)}
{activeSubSidebar === "guías" && (
<>
<h3 className="font-bold mb-4">Guías Options</h3>
<ul className="space-y-2">
<li>
<Link href="/guías/option1" className="hover:underline">
Guías Option 1
</Link>
</li>
<li>
<Link href="/guías/option2" className="hover:underline">
Guías Option 2
</Link>
</li>
<li>
<Link href="/guías/option3" className="hover:underline">
Guías Option 3
</Link>
</li>
</ul>
</>
)}
<button
onClick={() => toggleSubSidebar(activeSubSidebar)}
className="mt-4 text-sm hover:underline"
>
Close
</button>
</div>
</aside>
)}
</aside>
</>
);
}
7 changes: 0 additions & 7 deletions app/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
import Link from "next/link";
import { usePathname } from "next/navigation";

import { AlignJustify } from "lucide-react";

import { useSidebar } from "../context/sidebarCtx";

import DarkModeSelector from "./darkModeSelector";

export default function Header() {
const { toggleSidebar } = useSidebar();
const pathname = usePathname();
Expand All @@ -20,17 +16,14 @@ export default function Header() {
<div className="w-full h-12 fixed flex items-center bg-sky-600 px-4">
<div className="flex items-center mr-4">
<button onClick={toggleSidebar} className="p-1.5 rounded-lg hover:bg-sky-700">
<AlignJustify />
</button>
</div>

<div className="absolute left-1/2 transform -translate-x-1/2 font-bold font-heading md:text-2xl text-lg">
<Link href="/">
<h1>{title}</h1>
</Link>
</div>

<DarkModeSelector />
</div>
</header>
);
Expand Down
14 changes: 6 additions & 8 deletions app/components/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ export default function Sidebar() {

return (
<aside
className={`fixed inset-y-0 left-0 bg-white dark:bg-dark-1 dark:text-white text-white transform transition-transform duration-300 z-50 ${
isOpen ? "translate-x-0 w-full map-sm:w-72" : "-translate-x-full"
}`}
className={`fixed inset-y-0 left-0 bg-white dark:bg-dark-1 dark:text-white text-white transform transition-transform duration-300 z-50 ${isOpen ? "translate-x-0 w-full map-sm:w-72" : "-translate-x-full"
}`}
>
<div className="flex flex-col h-full">
<header className="h-12 bg-sky-600 flex items-center">
Expand All @@ -38,11 +37,10 @@ export default function Sidebar() {
<Link
href={`/map?campus=${campus.properties.shortName}`}
passHref
className={`block px-4 rounded-lg transition-all hover:text-sky-600 dark:hover:text-sky-300 ${
searchParams.get("campus") === campus.properties.shortName
? "text-sky-600 dark:text-sky-300"
: "text-gray-700 dark:text-white"
}`}
className={`block px-4 rounded-lg transition-all hover:text-sky-600 dark:hover:text-sky-300 ${searchParams.get("campus") === campus.properties.shortName
? "text-sky-600 dark:text-sky-300"
: "text-gray-700 dark:text-white"
}`}
onClick={toggleSidebar}
>
{campus.properties.name}
Expand Down
Loading