Skip to content

Commit a95ab38

Browse files
authored
feat: blur past venues in navbar and dropdowns (#1044)
1 parent 5e9c297 commit a95ab38

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

components/Dropdown/dropdown.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React, { useState, useRef, useEffect, SetStateAction, JSX } from 'react';
22
import Arrows from '../illustration/arrows';
3+
import { ConferenceStatus } from '../../types/types';
4+
import { getEventStatus } from '../../utils/status';
35

46
interface IDropdown<T> {
57
selectedItem: T | null;
@@ -75,11 +77,16 @@ function Dropdown<T>({
7577
{items &&
7678
items.map((item, i) => {
7779
const displayText = getDisplayValue(item);
80+
const isEnded =
81+
item && typeof item === 'object' && 'date' in item && typeof (item as any).date === 'string'
82+
? getEventStatus((item as any).date) === ConferenceStatus.ENDED
83+
: false;
84+
7885
return (
7986
<div
8087
key={i}
8188
onClick={() => handleItemSelect(item)}
82-
className={`block p-4 text-md text-white cursor-pointer hover:bg-black/10`}
89+
className={`block p-4 text-md text-white cursor-pointer hover:bg-black/10 ${isEnded ? 'opacity-50' : ''}`}
8390
role="menuitem"
8491
tabIndex={-1}
8592
id={`menu-item-${i}`}

components/Navbar/navDrop.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import React, {
77
} from 'react';
88
import Link from 'next/link';
99
import Dropdown from '../illustration/dropdown';
10-
import { LinkItem } from '../../types/types';
10+
import { LinkItem, ConferenceStatus } from '../../types/types';
1111
import { isExternalUrl, resolveCfpUrl } from '../../utils/pretalx';
1212
import { links } from '../../config/navigation';
1313
import { usePathname } from 'next/navigation';
@@ -83,7 +83,7 @@ const NavDrop = forwardRef<HTMLDivElement, INavDropProp>(
8383
pathname === sub.ref
8484
? 'font-semibold bg-white/10 text-[#C6BED9]'
8585
: ''
86-
}`}
86+
} ${sub.status === ConferenceStatus.ENDED ? 'opacity-50' : ''}`}
8787
>
8888
{sub.title}
8989
</div>

components/Navbar/navbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Hamburger from '../illustration/hamburger';
88
import { useMediaQuery } from 'react-responsive';
99
import Cancel from '../illustration/cancel';
1010
import Image from 'next/image';
11-
import { LinkItem } from '../../types/types';
11+
import { LinkItem, ConferenceStatus } from '../../types/types';
1212
import { isExternalUrl, resolveCfpUrl } from '../../utils/pretalx';
1313
import { links } from '../../config/navigation';
1414
import { usePathname } from 'next/navigation';
@@ -248,7 +248,7 @@ function Navbar(): JSX.Element {
248248
isActive(subL)
249249
? 'bg-white bg-opacity-10 font-semibold text-[#C6BED9]'
250250
: ''
251-
}`}
251+
} ${subL.status === ConferenceStatus.ENDED ? 'opacity-50' : ''}`}
252252
data-test={`nav-sub-${subL.title}`}
253253
onKeyDown={(e) => {
254254
const currentIndex = index;

config/navigation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import linksJson from './links.json';
22
import { cities } from './conference-data';
33
import { LinkItem } from '../types/types';
4+
import { getEventStatus } from '../utils/status';
45

56
export const links: LinkItem[] = (linksJson as LinkItem[]).map((link) => {
67
if (link.title !== 'Venue') {
@@ -13,6 +14,7 @@ export const links: LinkItem[] = (linksJson as LinkItem[]).map((link) => {
1314
title:
1415
city.name === 'Online' ? city.name : `${city.name}, ${city.country}`,
1516
ref: `/venue/${encodeURIComponent(city.name)}`,
17+
status: getEventStatus(city.date),
1618
})),
1719
};
1820
});

types/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface LinkItem {
99
title: string;
1010
ref: string;
1111
subMenu?: LinkItem[];
12+
status?: ConferenceStatus;
1213
}
1314

1415
export type CfpConfig =

0 commit comments

Comments
 (0)