Skip to content

Commit

Permalink
Style fixes for dropdown, favorites query logic
Browse files Browse the repository at this point in the history
  • Loading branch information
matherg committed Jul 31, 2024
1 parent c3cf991 commit fbe414b
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 57 deletions.
6 changes: 0 additions & 6 deletions .idea/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/nucarpool.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

76 changes: 76 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 13 additions & 17 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const Home: NextPage<any> = () => {
}
}, [user, geoJsonUsers]);

// seperate use effect for user location rendering
// separate use effect for user location rendering
useEffect(() => {
if (mapState) {
updateUserLocation(
Expand Down Expand Up @@ -261,6 +261,18 @@ const Home: NextPage<any> = () => {
className="flex-1 pt-4"
/>
</div>
<div className="flex items-center space-x-4">
<VisibilityToggle
map={mapState}
style={{
width: "100%",
marginTop: "20px",
backgroundColor: "white",
borderRadius: "8px",
borderColor: "black",
}}
/>
</div>
</div>
);
return (
Expand Down Expand Up @@ -307,22 +319,6 @@ const Home: NextPage<any> = () => {
className={"h-full w-full flex-auto"}
>
{user.role === "VIEWER" && viewerBox}
{user.role === "VIEWER" && (
<VisibilityToggle
map={mapState}
style={{
position: "absolute",
top: "10px",
right: "10px",
zIndex: 9999,
padding: "10px",
paddingRight: "25px",
backgroundColor: "white",
boxShadow: "0 2px 6px rgba(0,0,0,0.3)",
borderRadius: "8px",
}}
/>
)}
<MapLegend role={user.role} />
<MapConnectPortal
otherUser={popupUser}
Expand Down
8 changes: 6 additions & 2 deletions src/server/router/user/favorites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const favoritesRouter = router({
const user = await ctx.prisma.user.findUnique({
where: { id },
select: {
role: true,
favorites: true,
},
});
Expand All @@ -21,8 +22,11 @@ export const favoritesRouter = router({
message: `No profile with id '${id}'`,
});
}

return user.favorites.map(convertToPublic);
const userRole = user.role;
const filteredFavorites = user.favorites.filter(
(favorite) => favorite.role !== userRole
);
return filteredFavorites.map(convertToPublic);
}),
edit: protectedRouter
.input(
Expand Down

0 comments on commit fbe414b

Please sign in to comment.