Hide Quick Access section when no scheduled events available
- Check if quickAccessItems has any items before rendering section - If no consulting/webinar events qualify, entire section is hidden - Prevents empty "Akses Cepat" section from showing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -287,37 +287,46 @@ export default function MemberDashboard() {
|
|||||||
|
|
||||||
{access.length > 0 && (
|
{access.length > 0 && (
|
||||||
<div className="mb-8">
|
<div className="mb-8">
|
||||||
<div className="flex items-center justify-between mb-4">
|
{(() => {
|
||||||
<h2 className="text-2xl font-bold">Akses Cepat</h2>
|
const quickAccessItems = access
|
||||||
<Button variant="ghost" onClick={() => navigate("/access")}>
|
|
||||||
Lihat Semua
|
|
||||||
<ArrowRight className="w-4 h-4 ml-2" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
|
||||||
{access
|
|
||||||
.map((item) => ({ item, action: getQuickAction(item) }))
|
.map((item) => ({ item, action: getQuickAction(item) }))
|
||||||
.filter(({ action }) => action !== null)
|
.filter(({ action }) => action !== null)
|
||||||
.slice(0, 3)
|
.slice(0, 3);
|
||||||
.map(({ item, action }) => (
|
|
||||||
<Card key={item.id} className="border-2 border-border">
|
if (quickAccessItems.length === 0) return null;
|
||||||
<CardHeader className="pb-2">
|
|
||||||
<CardTitle className="text-lg">{item.product.title}</CardTitle>
|
return (
|
||||||
<CardDescription className="capitalize">{item.product.type}</CardDescription>
|
<>
|
||||||
</CardHeader>
|
<div className="flex items-center justify-between mb-4">
|
||||||
<CardContent>
|
<h2 className="text-2xl font-bold">Akses Cepat</h2>
|
||||||
{action && action.href && (
|
<Button variant="ghost" onClick={() => navigate("/access")}>
|
||||||
<Button asChild variant="outline" className="w-full border-2">
|
Lihat Semua
|
||||||
<a href={action.href} target="_blank" rel="noopener noreferrer">
|
<ArrowRight className="w-4 h-4 ml-2" />
|
||||||
<action.icon className="w-4 h-4 mr-2" />
|
</Button>
|
||||||
{action.label}
|
</div>
|
||||||
</a>
|
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||||
</Button>
|
{quickAccessItems.map(({ item, action }) => (
|
||||||
)}
|
<Card key={item.id} className="border-2 border-border">
|
||||||
</CardContent>
|
<CardHeader className="pb-2">
|
||||||
</Card>
|
<CardTitle className="text-lg">{item.product.title}</CardTitle>
|
||||||
))}
|
<CardDescription className="capitalize">{item.product.type}</CardDescription>
|
||||||
</div>
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
{action && action.href && (
|
||||||
|
<Button asChild variant="outline" className="w-full border-2">
|
||||||
|
<a href={action.href} target="_blank" rel="noopener noreferrer">
|
||||||
|
<action.icon className="w-4 h-4 mr-2" />
|
||||||
|
{action.label}
|
||||||
|
</a>
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user