From c18bab394613bd94481f6f83a1ed699383836d5c Mon Sep 17 00:00:00 2001 From: Diego Alzate Date: Tue, 6 Aug 2024 14:42:24 +0100 Subject: [PATCH] move tabs so they can modify the activetab state in questions --- packages/berlin/src/pages/Event.tsx | 74 ++++++++++++++++------------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/packages/berlin/src/pages/Event.tsx b/packages/berlin/src/pages/Event.tsx index aa01079c..51430bec 100644 --- a/packages/berlin/src/pages/Event.tsx +++ b/packages/berlin/src/pages/Event.tsx @@ -4,7 +4,7 @@ import { useQuery } from '@tanstack/react-query'; import { useParams } from 'react-router-dom'; // API -import { fetchEvent, fetchEventCycles } from 'api'; +import { fetchEvent, fetchEventCycles, GetCycleResponse } from 'api'; // Components import { Body } from '../components/typography/Body.styled'; @@ -49,33 +49,6 @@ function Event() { [openCycles], ); - const tabNames = ['upcoming', 'past']; - - const tabs = { - upcoming: ( - setActiveTab('past'), - }} - /> - ), - past: ( - setActiveTab('upcoming'), - }} - /> - ), - }; - return ( <> @@ -106,7 +79,13 @@ function Event() { /> )} - + @@ -114,16 +93,45 @@ function Event() { } function Questions({ - tabNames, - tabs, initialTab, + openCycles, + closedCycles, + eventId, }: { - tabNames: string[]; - tabs: Record; initialTab: string; + openCycles: GetCycleResponse[] | undefined; + eventId?: string; + closedCycles: GetCycleResponse[] | undefined; }) { const [activeTab, setActiveTab] = useState(initialTab); + const tabNames = ['upcoming', 'past']; + + const tabs = { + upcoming: ( + setActiveTab('past'), + }} + /> + ), + past: ( + setActiveTab('upcoming'), + }} + /> + ), + }; + return (