diff --git a/src/components/pages/events/eventPage/validEvent/ValidEvent.tsx b/src/components/pages/events/eventPage/validEvent/ValidEvent.tsx
index 44fc31cb..c93cdbc1 100644
--- a/src/components/pages/events/eventPage/validEvent/ValidEvent.tsx
+++ b/src/components/pages/events/eventPage/validEvent/ValidEvent.tsx
@@ -1,4 +1,4 @@
-import React, { useContext, useState } from 'react';
+import React, { useContext, useEffect, useState } from 'react';
import styles from './validEvent.module.scss';
import { Event } from 'models/apiModels';
import {
@@ -7,10 +7,12 @@ import {
} from 'components/molecules/event/eventBody/EventBody';
import { AuthenticateContext, Roles } from 'contexts/authProvider';
import EventHeader from 'components/molecules/event/eventHeader/EventHeader';
-import { Button } from '@chakra-ui/react';
+import { Button, Center, Flex, Heading, Text } from '@chakra-ui/react';
import Icon from 'components/atoms/icons/icon';
import { useHistory } from 'react-router-dom';
import useTitle from 'hooks/useTitle';
+import { useMobileScreen } from 'hooks/useMobileScreen';
+import { getPageVisit } from 'api';
export interface EventPageProps {
eid: string;
@@ -23,26 +25,64 @@ const ValidEventLayout: React.FC<{ event: Event }> = ({ event }) => {
const history = useHistory();
return (
-
+
-
-
{role === Roles.admin && (
-
+
history.push(`${event.eid}/admin`)}>
-
+
)}
-
+
);
};
export default ValidEventLayout;
+export const ViewCount: React.FC<{ page: string }> = ({ page }) => {
+ const [views, setViews] = useState();
+
+ const fetchPageVisist = async () => {
+ const response = await getPageVisit(page);
+ setViews(response.visits);
+ };
+
+ useEffect(() => {
+ fetchPageVisist();
+ }, []);
+
+ return (
+
+
+ Antall besøk
+
+
+
+
+ {views ?? 'N/A'}
+
+
+
+ );
+};
+
export const ValidEventEditLayout: React.FC<{ event: Event }> = ({ event }) => {
const { role } = useContext(AuthenticateContext);
+ const isMobile = useMobileScreen();
const [edit, setEdit] = useState(false);
const setEventEdit = () => {
@@ -50,23 +90,37 @@ export const ValidEventEditLayout: React.FC<{ event: Event }> = ({ event }) => {
};
return (
-
-
- {!edit ? (
-
- ) : (
-
- )}
- {role === Roles.admin && !edit && (
-
-
-
- )}
-
+
+
+
+ {!edit ? (
+
+ ) : (
+
+ )}
+ {role === Roles.admin && !edit && (
+
+
+
+ )}
+
+
+
+
+
);
};
diff --git a/src/components/pages/events/eventPage/validEvent/validEvent.module.scss b/src/components/pages/events/eventPage/validEvent/validEvent.module.scss
index d89db211..12ee752f 100644
--- a/src/components/pages/events/eventPage/validEvent/validEvent.module.scss
+++ b/src/components/pages/events/eventPage/validEvent/validEvent.module.scss
@@ -1,18 +1,3 @@
-.eventBody {
- display: flex;
- flex-direction: column;
- width: 100%;
- border-radius: 20px;
- background-color: #222136;
- text-align: center;
-}
-
-.editContainer {
- display: flex;
- justify-content: center;
- width: 100%;
-}
-
.header {
min-height: 35vh;
border-radius: 20px 20px 0px 0px;
@@ -20,13 +5,6 @@
.adminButtons {
margin: 1% 0 1% 0;
- width: 25%;
-}
-
-.settingsIcon {
- margin: 1% 1% 1% 1%;
- width: 100%;
- display: flex;
}
@media screen and (max-width: 768px) {