diff --git a/src/components/Sidebar/SidebarContent.tsx b/src/components/Sidebar/SidebarContent.tsx index 81e1cbb6..8ac78328 100644 --- a/src/components/Sidebar/SidebarContent.tsx +++ b/src/components/Sidebar/SidebarContent.tsx @@ -92,7 +92,8 @@ const renderUserCard = ( export const SidebarContent = (props: SidebarContentProps) => { return (
- {props.userCardList.length === 0 || props.disabled ? ( + {props.userCardList.length === 0 || + (props.disabled && props.subType !== "favorites") ? (
{emptyMessage(props.subType, props.disabled)}
diff --git a/src/components/UserCards/UserCard.tsx b/src/components/UserCards/UserCard.tsx index 60cd4e48..bcf7f1bd 100644 --- a/src/components/UserCards/UserCard.tsx +++ b/src/components/UserCards/UserCard.tsx @@ -93,9 +93,7 @@ export const UserCard = (props: UserCardProps): JSX.Element => { {user.role === "VIEWER" ? (

{`${props.otherUser.role.charAt( 0 - )}${props.otherUser.role.slice(1).toLowerCase()} ${ - props.otherUser.id - }`}

+ )}${props.otherUser.role.slice(1).toLowerCase()}`}

) : (

{props.otherUser.preferredName}

)} diff --git a/src/pages/api/auth/[...nextauth].ts b/src/pages/api/auth/[...nextauth].ts index fb3c2b0c..0c2bf190 100644 --- a/src/pages/api/auth/[...nextauth].ts +++ b/src/pages/api/auth/[...nextauth].ts @@ -6,7 +6,6 @@ import { serverEnv } from "../../../utils/env/server"; import AzureADProvider from "next-auth/providers/azure-ad"; import GoogleProvider from "next-auth/providers/google"; import { Adapter } from "next-auth/adapters"; -import { browserEnv } from "../../../utils/env/browser"; const CustomPrismaAdapter = (p: typeof prisma): Adapter => { return { @@ -50,14 +49,10 @@ export const authOptions: NextAuthOptions = { }, adapter: CustomPrismaAdapter(prisma), providers: [ - ...(browserEnv.NEXT_PUBLIC_ENV === "staging" - ? [ - GoogleProvider({ - clientId: serverEnv.GOOGLE_CLIENT_ID, - clientSecret: serverEnv.GOOGLE_CLIENT_SECRET, - }), - ] - : []), + GoogleProvider({ + clientId: serverEnv.GOOGLE_CLIENT_ID, + clientSecret: serverEnv.GOOGLE_CLIENT_SECRET, + }), AzureADProvider({ clientId: serverEnv.AZURE_CLIENT_ID, clientSecret: serverEnv.AZURE_CLIENT_SECRET, diff --git a/src/pages/index.tsx b/src/pages/index.tsx index ac760434..7b292445 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -207,8 +207,8 @@ const Home: NextPage = () => { newMap.setMaxZoom(13); newMap.on("load", () => { addClusters(newMap, geoJsonUsers); - updateUserLocation(newMap, user.startCoordLng, user.startCoordLat); if (!isViewer) { + updateUserLocation(newMap, user.startCoordLng, user.startCoordLat); updateCompanyLocation( newMap, user.companyCoordLng, diff --git a/src/server/router/mapbox.ts b/src/server/router/mapbox.ts index c400b8d7..b2d5030e 100644 --- a/src/server/router/mapbox.ts +++ b/src/server/router/mapbox.ts @@ -58,7 +58,8 @@ export const mapboxRouter = router({ // Now returns all drivers and riders if user is in viewer mode const oppRole = currentUser?.role === Role.DRIVER ? Role.RIDER : Role.DRIVER; - const viewCheck = currentUser?.role === Role.VIEWER ? Role.RIDER : oppRole; + const isViewer = currentUser?.role === Role.VIEWER; + const viewCheck = isViewer ? Role.RIDER : oppRole; const users = await ctx.prisma.user.findMany({ where: { id: { @@ -96,10 +97,11 @@ export const mapboxRouter = router({ distances.sort((a, b) => a.score - b.score); const sortedUsers = _.compact( distances.map((rec) => users.find((user) => user.id === rec.id)) - ).slice(0, 50); + ); + const finalUsers = isViewer ? sortedUsers : sortedUsers.slice(0, 50); // creates points for each user with coordinates at company location - const features: Feature[] = sortedUsers.map((u) => { + const features: Feature[] = finalUsers.map((u) => { const feat = { type: "Feature" as "Feature", geometry: { diff --git a/src/utils/env/browser.ts b/src/utils/env/browser.ts index ef455358..86a2c8ea 100644 --- a/src/utils/env/browser.ts +++ b/src/utils/env/browser.ts @@ -4,7 +4,4 @@ export const browserEnv = envsafe({ NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN: str({ input: process.env.NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN, }), - NEXT_PUBLIC_ENV: str({ - input: process.env.NEXT_PUBLIC_ENV, - }), });