Skip to content

Commit

Permalink
Merge pull request #124 from sandboxnu/staging
Browse files Browse the repository at this point in the history
Filter Feature + Map Rendering Rework
  • Loading branch information
sinhaaaryan authored Nov 12, 2024
2 parents 6a567b5 + 062ebd3 commit e3f5887
Show file tree
Hide file tree
Showing 29 changed files with 1,660 additions and 754 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ jobs:
with:
node-version: 18.16
- run: yarn install
- run: yarn test
- run: yarn test --passWithNoTests

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ This is a web app for Northeastern University's students to assists them in find
NEXTAUTH_SECRET=
NEXTAUTH_URL=
#MixPanel (use any value for local development)
NEXT_PUBLIC_MIXPANEL_PROJECT_TOKEN=
# Mapbox
NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=
Expand Down
33 changes: 4 additions & 29 deletions src/components/DropDownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,22 @@ import { signOut, useSession } from "next-auth/react";
import Image from "next/image";
import Link from "next/link";
import Spinner from "./Spinner";
import React, { Fragment, useEffect, useState } from "react";
import React, { Fragment, useState } from "react";
import { AiOutlineUser } from "react-icons/ai";
import { useRouter } from "next/router";
import { trpc } from "../utils/trpc";
import useProfileImage from "../utils/useProfileImage";

const DropDownMenu = () => {
const { data: session } = useSession();
const router = useRouter();
const [profileImageUrl, setProfileImageUrl] = useState("");
const [isLoading, setIsLoading] = useState(false);
const [imageLoadError, setImageLoadError] = useState(false);

const { profileImageUrl, imageLoadError } = useProfileImage();

const logout = () => {
signOut();
};

const {
data: presignedData,
error: presignedError,
refetch,
} = trpc.user.getPresignedDownloadUrl.useQuery({ userId: undefined });

useEffect(() => {
if (presignedData?.url) {
setProfileImageUrl(presignedData.url);
} else {
setProfileImageUrl("");
}
}, [presignedData]);
useEffect(() => {
const timer = setTimeout(() => {
refetch();
}, 1000);
return () => clearTimeout(timer);
}, [refetch]);

useEffect(() => {
setImageLoadError(false);
}, [profileImageUrl]);

const handleProfileClick = async () => {
setIsLoading(true);
await router.push("/profile");
Expand All @@ -64,7 +40,6 @@ const DropDownMenu = () => {
alt="Profile Image"
width={50}
height={50}
onError={() => setImageLoadError(true)}
/>
) : (
<AiOutlineUser className="h-12 w-12 rounded-full bg-gray-400" />
Expand Down
Loading

0 comments on commit e3f5887

Please sign in to comment.