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:
dwindown
2025-12-26 01:53:30 +07:00
parent 734aa967ac
commit 9b2ac9beee

View File

@@ -287,6 +287,16 @@ export default function MemberDashboard() {
{access.length > 0 && (
<div className="mb-8">
{(() => {
const quickAccessItems = access
.map((item) => ({ item, action: getQuickAction(item) }))
.filter(({ action }) => action !== null)
.slice(0, 3);
if (quickAccessItems.length === 0) return null;
return (
<>
<div className="flex items-center justify-between mb-4">
<h2 className="text-2xl font-bold">Akses Cepat</h2>
<Button variant="ghost" onClick={() => navigate("/access")}>
@@ -295,11 +305,7 @@ export default function MemberDashboard() {
</Button>
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
{access
.map((item) => ({ item, action: getQuickAction(item) }))
.filter(({ action }) => action !== null)
.slice(0, 3)
.map(({ item, action }) => (
{quickAccessItems.map(({ item, action }) => (
<Card key={item.id} className="border-2 border-border">
<CardHeader className="pb-2">
<CardTitle className="text-lg">{item.product.title}</CardTitle>
@@ -318,6 +324,9 @@ export default function MemberDashboard() {
</Card>
))}
</div>
</>
);
})()}
</div>
)}