Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions src/app/people/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ async function PeopleResults({
params.role
);

const [{ profiles, error }, myProfile] = demoMode
const [{ profiles: found, error }, myProfile] = demoMode
? ([
{
profiles: filterDemoProfiles(
Expand All @@ -250,6 +250,9 @@ async function PeopleResults({
getProfile(user.id),
]);

// You're searching for other people, so leave yourself out.
const profiles = found.filter((p) => p.id !== user.id);

return (
<div className="min-h-[calc(100vh-6rem)] pb-12">
{!demoMode && !myProfile && (
Expand Down Expand Up @@ -326,10 +329,7 @@ async function PeopleResults({
key={p.id}
className="min-w-0"
>
<ProfileCard
profile={p}
isMe={p.id === user.id}
/>
<ProfileCard profile={p} />
</li>
))}
</ul>
Expand Down
16 changes: 2 additions & 14 deletions src/app/people/profile-card.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
import type { DirectoryProfile } from "./demo-profiles";
import { ProfileDetailModal } from "./profile-detail-modal";

export function ProfileCard({
profile,
isMe,
}: {
profile: DirectoryProfile;
isMe: boolean;
}) {
return (
<ProfileDetailModal
profile={profile}
isMe={isMe}
card
/>
);
export function ProfileCard({ profile }: { profile: DirectoryProfile }) {
return <ProfileDetailModal profile={profile} card />;
}
8 changes: 5 additions & 3 deletions src/app/people/profile-detail-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,9 @@ function ContactRow({

export function ProfileDetailModal({
profile: p,
isMe,
card = false,
}: {
profile: DirectoryProfile;
isMe: boolean;
card?: boolean;
}) {
const dialogRef = useRef<HTMLDialogElement>(null);
Expand Down Expand Up @@ -144,7 +142,11 @@ export function ProfileDetailModal({

<p className="mt-3 w-full truncate text-[13px] font-semibold leading-5">
{p.name}
{isMe ? " (You)" : ""}
</p>

{/* Email tells apart people who share a name. */}
<p className="w-full truncate text-[11px] text-hint">
{p.email}
</p>

<p className="w-full truncate text-[11px] font-medium leading-4">
Expand Down
3 changes: 3 additions & 0 deletions src/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "server-only";
import { cache } from "react";
import { notFound, redirect } from "next/navigation";
import { connection } from "next/server";
import { isOrganizer } from "@/lib/data";
import { createClient } from "@/lib/supabase/server";
import { isSupabaseConfigured } from "@/lib/supabase/env";
Expand All @@ -10,6 +11,8 @@ export type CurrentUser = { id: string; email: string };
/** The signed-in user, verified from the session JWT. Deduped per request. */
export const getCurrentUser = cache(async (): Promise<CurrentUser | null> => {
if (!isSupabaseConfigured) return null;
// The auth client reads the clock, so opt out of prerendering before touching it.
await connection();

const supabase = await createClient();
const { data } = await supabase.auth.getClaims();
Expand Down
Loading