Skip to content

Commit

Permalink
filter out non-event folders from home screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ichub committed Jul 24, 2024
1 parent 9c76b72 commit b1f332b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apps/passport-client/components/screens/HomeScreen/Folder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CSSProperties, useCallback } from "react";
import styled from "styled-components";
import { usePCDsInFolder } from "../../../src/appHooks";
import { cn } from "../../../src/util";
import { EVENT_DATES } from "./utils";
import { EVENTS } from "./utils";

export function FolderCard({
folder,
Expand All @@ -20,8 +20,8 @@ export function FolderCard({

const pcds = usePCDsInFolder(folder);

const startDate = EVENT_DATES[folder]?.start;
const endDate = EVENT_DATES[folder]?.end;
const startDate = EVENTS[folder]?.start;
const endDate = EVENTS[folder]?.end;

let dateStr = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
FolderEntryContainer,
FolderExplorerContainer
} from "./Folder";
import { isEvent } from "./utils";

export const HomeScreen = React.memo(HomeScreenImpl);

Expand Down Expand Up @@ -187,6 +188,7 @@ export function HomeScreenImpl(): JSX.Element | null {
// /FrogCrypto is a special and rendered by <FrogFolder />
(folder) => folder !== FrogCryptoFolderName
)
.filter(isEvent)
.sort((a, b) => a.localeCompare(b))
.map((folder) => {
return (
Expand Down
11 changes: 10 additions & 1 deletion apps/passport-client/components/screens/HomeScreen/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export const EVENT_DATES: Record<string, { start: string; end: string }> = {
export interface EventInfo {
start: string;
end: string;
}

export const EVENTS: Record<string, EventInfo> = {
"ETH Berlin 04": { start: "2023-04-01", end: "2023-04-03" },
"0xPARC Summer '24": { start: "2023-05-15", end: "2023-05-18" },
"Edge Esmeralda": { start: "2023-06-10", end: "2023-06-12" },
Expand All @@ -7,3 +12,7 @@ export const EVENT_DATES: Record<string, { start: string; end: string }> = {
"ETH Berlin 09": { start: "2023-09-18", end: "2023-09-21" },
"Edge City": { start: "2023-10-18", end: "2023-10-21" }
};

export function isEvent(folder: string): folder is keyof typeof EVENTS {
return EVENTS[folder] !== undefined;
}

0 comments on commit b1f332b

Please sign in to comment.