Skip to content

Commit b6f6968

Browse files
author
raineer
committed
Card Click Redirect Implementationbe a codev
1 parent 1408969 commit b6f6968

4 files changed

Lines changed: 23 additions & 7 deletions

File tree

‎apps/codebility/app/(marketing)/_components/landing/LandingIntern-CodevCard.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { motion, useInView } from "framer-motion";
66
import { Card, CardContent } from "@/components/ui/card";
77

88
type Person = {
9+
id: string; // ✅ Added id field for navigation
910
name: string;
1011
role: 'Intern' | 'Codev'; // Only two possible roles from database
1112
image?: string; // image URL (optional)
@@ -231,6 +232,8 @@ export default function InternCards({ interns }: { interns: Person[] }) {
231232
}}
232233
whileTap={{ scale: 0.95 }}
233234
style={{ perspective: "1000px" }}
235+
onClick={() => window.location.href = `https://www.codebility.tech/profiles/${intern.id}`}
236+
className="cursor-pointer"
234237
>
235238
<motion.div
236239
className="h-full relative"

‎apps/codebility/app/(marketing)/profiles/_components/CodevCard.tsx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,17 @@ const CodevCard = ({ codev, color }: Props) => {
118118
: {};
119119
}, [codev.level, codev.codev_points]);
120120

121+
// Line 119: Enhanced card wrapper with click redirect
121122
return (
122123
<div
123124
className="h-64"
124125
onMouseEnter={() => setHovered(true)}
125126
onMouseLeave={() => setHovered(false)}
126127
>
127-
<div className="group relative flex h-full w-full flex-col items-center justify-between rounded-lg border border-white/20 bg-white/10 p-4 shadow-2xl backdrop-blur-md transition-all duration-300 hover:bg-white/20 dark:border-white/10 dark:bg-white/5 dark:hover:bg-white/10">
128+
<div
129+
onClick={() => window.location.href = `https://www.codebility.tech/profiles/${codev.id}`}
130+
className="group relative flex h-full w-full flex-col items-center justify-between rounded-lg border border-white/20 bg-white/10 p-4 shadow-2xl backdrop-blur-md transition-all duration-300 cursor-pointer hover:bg-white/20 hover:scale-[1.02] dark:border-white/10 dark:bg-white/5 dark:hover:bg-white/10"
131+
>
128132
{/* Background decoration */}
129133
<div className="from-customBlue-50/30 dark:from-customBlue-950/10 absolute inset-0 bg-gradient-to-br to-purple-50/30 opacity-0 transition-opacity duration-300 group-hover:opacity-100 dark:to-purple-950/10" />
130134
<div className="absolute -right-4 -top-4 h-32 w-32 rounded-full bg-gradient-to-br from-yellow-400/10 to-orange-400/10 opacity-0 blur-2xl transition-opacity duration-500 group-hover:opacity-100" />
@@ -197,7 +201,8 @@ const CodevCard = ({ codev, color }: Props) => {
197201
<TooltipProvider>
198202
<Tooltip delayDuration={100}>
199203
<TooltipTrigger asChild>
200-
<Link href={`/profiles/${codev.id}`} target="_blank">
204+
{/* Line 217: Added stopPropagation to prevent card click when button is clicked */}
205+
<Link href={`/profiles/${codev.id}`} target="_blank" onClick={(e) => e.stopPropagation()}>
201206
<Button
202207
variant="outline"
203208
size="icon"
@@ -242,4 +247,4 @@ const CodevCard = ({ codev, color }: Props) => {
242247
);
243248
};
244249

245-
export default CodevCard;
250+
export default CodevCard;

‎apps/codebility/app/home/in-house/_components/cards/CodevCard.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export function CodevCard({ data, onEdit, onDelete, roles }: CodevCardProps) {
9595
alt={`${data.first_name} avatar`}
9696
width={80}
9797
height={80}
98+
unoptimized={true}
9899
className="border-light-700 dark:border-dark-200 h-20 w-20 rounded-full border-2 object-cover"
99100
/>
100101
</div>
@@ -182,10 +183,11 @@ export function CodevCard({ data, onEdit, onDelete, roles }: CodevCardProps) {
182183
</CardContent>
183184

184185
<CardFooter className="border-light-700 dark:border-dark-200 flex justify-center gap-2 border-t py-1">
186+
{/* Line 138: Enhanced View button with actual profile navigation */}
185187
<Button
186188
variant="ghost"
187189
size="sm"
188-
onClick={() => alert("View action")}
190+
onClick={() => window.location.href = `https://www.codebility.tech/profiles/${data.id}`}
189191
className="dark:text-light-900 hover:bg-light-800 dark:hover:bg-dark-200 p-1 text-black"
190192
>
191193
<Eye className="h-4 w-4" />
@@ -209,4 +211,4 @@ export function CodevCard({ data, onEdit, onDelete, roles }: CodevCardProps) {
209211
</CardFooter>
210212
</Card>
211213
);
212-
}
214+
}

‎apps/codebility/app/home/orgchart/_components/OrgChartTeamMemberCard.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@ import { Card, CardContent } from "@codevs/ui/card";
66

77
import { TeamMemberCardProps } from "../_types/org-chart";
88

9+
// Line 8: Added id destructuring and onClick handler with hover effects
910
export const TeamMemberCard = ({
11+
id,
1012
first_name,
1113
last_name,
1214
display_position,
1315
image_url,
1416
}: TeamMemberCardProps) => {
1517
const validImageUrl = getValidImageUrl(image_url);
1618

19+
// Line 15: Card wrapper now clickable with cursor pointer and enhanced hover
1720
return (
18-
<Card className="group relative h-32 w-36 overflow-hidden border-2 border-gray-200 shadow-lg transition-all duration-300 hover:-translate-y-1 hover:shadow-xl dark:border-gray-700">
21+
<Card
22+
onClick={() => window.location.href = `https://www.codebility.tech/profiles/${id}`}
23+
className="group relative h-32 w-36 overflow-hidden border-2 border-gray-200 shadow-lg transition-all duration-300 cursor-pointer hover:-translate-y-1 hover:shadow-2xl hover:scale-[1.02] dark:border-gray-700"
24+
>
1925
<div className="absolute inset-0 bg-gradient-to-t from-customBlue-500/5 to-transparent opacity-0 transition-opacity duration-300 group-hover:opacity-100" />
2026
<CardContent className="relative flex h-full flex-col items-center justify-center gap-1 p-2">
2127
<div className="relative">
@@ -40,4 +46,4 @@ export const TeamMemberCard = ({
4046
</CardContent>
4147
</Card>
4248
);
43-
};
49+
};

0 commit comments

Comments
 (0)