Skip to content

Commit 4d588dc

Browse files
committed
feat: ✨ Redirect to team page with /team#[author] opens respective author modal
1 parent 6d89019 commit 4d588dc

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/pages/team.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// pages/team.tsx
22
import { motion } from 'framer-motion';
33
import { InferGetStaticPropsType } from 'next';
4-
import { useState } from 'react';
4+
import { useEffect, useState } from 'react';
55

66
import Seo from '@/components/seo/seo';
77
import ProfileModal from '@/components/team/ProfileModal';
@@ -26,6 +26,19 @@ export default function TeamPage({
2626
setSelected(p);
2727
setOpen(true);
2828
};
29+
30+
useEffect(() => {
31+
const hash = window.location.hash.slice(1);
32+
if (!hash) return;
33+
const allProfiles: CardProfile[] = [
34+
...TeamMembers,
35+
...currentInterns,
36+
...pastInterns,
37+
...(SUPPORT_JSON as CardProfile[]),
38+
];
39+
const matched = allProfiles.find((p) => p.id === hash);
40+
if (matched) openProfile(matched);
41+
}, [TeamMembers, currentInterns, pastInterns]);
2942
const closeProfile = () => setOpen(false);
3043
const clearSelected = () => setSelected(null);
3144

0 commit comments

Comments
 (0)