Skip to content

Commit

Permalink
✨ add event view count to event admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
FredrikMorstad committed Dec 3, 2023
1 parent 5258430 commit 6227bdf
Showing 1 changed file with 32 additions and 23 deletions.
55 changes: 32 additions & 23 deletions src/components/pages/events/eventAdmin/EventAdmin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import useFetchUpdate from 'hooks/useFetchUpdate';
import { SideBarItem } from 'components/pages/admin/AdminPage';
import DropdownMenu from 'components/molecules/dropdownMenu/DropdownMenu';
import { useMobileScreen } from 'hooks/useMobileScreen';
import { Flex } from '@chakra-ui/react';
import EventViewCount from 'components/molecules/event/eventViewCount/EventViewCount';
export interface IValidEvent {
eventData: Event | undefined;
}
Expand Down Expand Up @@ -84,7 +86,7 @@ interface componentsDict {
[key: string]: JSX.Element;
}

const EventAdmin: React.FC<{ eventData: Event }> = ({ eventData }) => {
const EventAdmin = () => {
const [isValid, setIsValid] = useState<boolean | undefined>();
const [event, setEvent] = useState<Event>();
const { id } = useParams<{ id: string }>();
Expand Down Expand Up @@ -156,28 +158,35 @@ const EventAdmin: React.FC<{ eventData: Event }> = ({ eventData }) => {
return (
<div className={styles.adminContent}>
{!isMobile ? (
<div className={styles.side}>
<SideBarItem
onClick={() => setComponentKey('Settings')}
iconType="cog"
label="Settings"
/>
<SideBarItem
onClick={() => setComponentKey('Responses')}
iconType="poll"
label="Responses"
/>
<SideBarItem
onClick={() => setComponentKey('Statistics')}
iconType="chart-line"
label="Statistics"
/>
<SideBarItem
onClick={() => setComponentKey('Export')}
iconType="file-export"
label="Export"
/>
</div>
<Flex flexDir="column">
<div className={styles.side}>
<SideBarItem
onClick={() => setComponentKey('Settings')}
iconType="cog"
label="Settings"
/>
<SideBarItem
onClick={() => setComponentKey('Responses')}
iconType="poll"
label="Responses"
/>
<SideBarItem
onClick={() => setComponentKey('Statistics')}
iconType="chart-line"
label="Statistics"
/>
<SideBarItem
onClick={() => setComponentKey('Export')}
iconType="file-export"
label="Export"
/>
</div>
{event !== undefined && (
<Flex w="100%" height="50%">
<EventViewCount page={`/event/${event.eid}`} />
</Flex>
)}
</Flex>
) : (
<div className={styles.top}>
<DropdownMenu items={dropdownMenuProps}></DropdownMenu>
Expand Down

0 comments on commit 6227bdf

Please sign in to comment.