Skip to content

Commit

Permalink
Merge pull request #116 from cs3216-a3-group-4/seeleng/add-time-columns
Browse files Browse the repository at this point in the history
fix: hide mobile sidebar if not logged in
  • Loading branch information
seelengxd authored Oct 2, 2024
2 parents 9a434bf + f18ef6e commit b0a5b35
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
2 changes: 0 additions & 2 deletions backend/src/cron/fetch_articles.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from src.scrapers.cna.process import process_all_categories
from src.scrapers.cna.scrape import scrape_from_date
from src.scrapers.guardian.get_analyses import get_analyses
from src.scrapers.guardian.get_articles import get_articles
from src.scrapers.guardian.process import GuardianArticle, GuardianArticleFields

from src.lm.generate_events import generate_events
Expand Down Expand Up @@ -170,4 +169,3 @@ async def run(limit: int = 30):

if __name__ == "__main__":
asyncio.run(run(1000))

1 change: 0 additions & 1 deletion backend/src/scrapers/cna/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,3 @@ async def process_all_categories(filepath: str):

if __name__ == "__main__":
asyncio.run(process_all_categories())

1 change: 0 additions & 1 deletion backend/src/scrapers/guardian/get_analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ def get_analyses(event_ids: list[int]):

if __name__ == "__main__":
print(get_analyses([0, 1, 2, 3])[0].content)

2 changes: 1 addition & 1 deletion frontend/components/navigation/mobile/mobile-navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function MobileNavbar() {
</Link>
</div>
<div className="flex flex-1 justify-center">
<MobileSidebar />
{isLoggedIn && <MobileSidebar />}
</div>
<div className="flex items-center gap-x-4 justify-end min-h-[52px] max-h-[52px] min-w-fit ml-8">
{isLoggedIn !== undefined &&
Expand Down
55 changes: 31 additions & 24 deletions frontend/components/navigation/mobile/mobile-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
BookmarkIcon,
HistoryIcon,
HomeIcon,
LucideIcon,
MessageCircleQuestionIcon,
} from "lucide-react";

Expand All @@ -20,6 +21,27 @@ import {
} from "@/components/ui/select";
import { cn } from "@/lib/utils";

type SidebarOption = {
icon: LucideIcon;
label: string;
path: string;
};

const OPTIONS: SidebarOption[] = [
{
icon: HomeIcon,
label: "Home",
path: "/",
},
{
icon: BookmarkIcon,
label: "Bookmarks",
path: "/bookmarks",
},
{ icon: MessageCircleQuestionIcon, label: "Ask a question", path: "/ask" },
{ icon: HistoryIcon, label: "Past questions", path: "/questions" },
];

const MobileSidebar = () => {
const pathname = usePathname();
const router = useRouter();
Expand All @@ -45,30 +67,15 @@ const MobileSidebar = () => {
<SelectContent>
<div className="flex flex-col bg-primary-100/20 space-y-6 py-4 px-8">
<div className="flex flex-col space-y-2">
<SidebarItemWithIcon
Icon={HomeIcon}
isActive={pathname === "/"}
label="Home"
onClick={() => router.push("/")}
/>
<SidebarItemWithIcon
Icon={BookmarkIcon}
isActive={pathname === "/bookmarks"}
label="Bookmarks"
onClick={() => router.push("/bookmarks")}
/>
<SidebarItemWithIcon
Icon={MessageCircleQuestionIcon}
isActive={pathname === "/ask"}
label="Ask a question"
onClick={() => router.push("/ask")}
/>
<SidebarItemWithIcon
Icon={HistoryIcon}
isActive={pathname === "/questions"}
label="Past questions"
onClick={() => router.push("/questions")}
/>
{OPTIONS.map(({ icon, label, path }, index) => (
<SidebarItemWithIcon
Icon={icon}
isActive={pathname === path}
key={index}
label={label}
onClick={() => router.push(path)}
/>
))}
</div>
<SidebarOtherTopics />
</div>
Expand Down

0 comments on commit b0a5b35

Please sign in to comment.