From a90114f5ff392174c13567efe14e565be7ab10e9 Mon Sep 17 00:00:00 2001 From: Berra Karaman Date: Thu, 22 Feb 2024 18:30:14 +0300 Subject: [PATCH] add tabs --- .../zubhub/public/locales/en/translation.json | 6 +++++ .../views/activities/activitiesStyles.js | 11 ++++++++ .../src/views/activities/activities.jsx | 25 ++++++++++++++++--- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/zubhub_frontend/zubhub/public/locales/en/translation.json b/zubhub_frontend/zubhub/public/locales/en/translation.json index 51afb1356..6113f76c9 100644 --- a/zubhub_frontend/zubhub/public/locales/en/translation.json +++ b/zubhub_frontend/zubhub/public/locales/en/translation.json @@ -1075,6 +1075,12 @@ }, "activities": { + "title": "Activities", + "tabs": { + "published": "Published", + "unpublished": "Unpublished", + "ariaLabel": "Activity Tabs" + }, "LinkedProjects": "Linked Projects", "errors": { "emptyList": "No activities created yet !", diff --git a/zubhub_frontend/zubhub/src/assets/js/styles/views/activities/activitiesStyles.js b/zubhub_frontend/zubhub/src/assets/js/styles/views/activities/activitiesStyles.js index e92c4483e..8e7ca3ef7 100644 --- a/zubhub_frontend/zubhub/src/assets/js/styles/views/activities/activitiesStyles.js +++ b/zubhub_frontend/zubhub/src/assets/js/styles/views/activities/activitiesStyles.js @@ -1,4 +1,15 @@ const styles = theme => ({ + tabs: { + margin: '2em 0', + [theme.breakpoints.up('900')]: { + paddingRight: '1em' + } + }, + tab: { + textTransform: 'none', + fontSize: '1.2em', + fontWeight: 600 + }, activityListContainer: { padding: '4em 0', width: '70%', diff --git a/zubhub_frontend/zubhub/src/views/activities/activities.jsx b/zubhub_frontend/zubhub/src/views/activities/activities.jsx index cb0cbd9c2..02589f07a 100644 --- a/zubhub_frontend/zubhub/src/views/activities/activities.jsx +++ b/zubhub_frontend/zubhub/src/views/activities/activities.jsx @@ -15,7 +15,8 @@ import styles from '../../assets/js/styles/views/activities/activitiesStyles'; import { makeStyles } from '@mui/styles'; import ErrorPage from '../error/ErrorPage'; import DefaultStyles from '../../assets/js/styles'; -import { Grid, Box, Typography } from '@mui/material'; +import { Grid, Tab, Tabs, Typography } from '@mui/material'; +import { useTranslation } from 'react-i18next'; import LoadingPage from '../loading/LoadingPage'; const useStyles = makeStyles(styles); @@ -25,8 +26,9 @@ function Activities(props) { const [loading, setLoading] = useState(true); const { activities } = useSelector(state => state); let [activityList, setActivityList] = useState([]); - + const [tab, setTab] = useState("published"); const commonClasses = makeStyles(DefaultStyles)(); + const { t } = useTranslation(); useEffect(() => { setActivityList(activities.all_activities); @@ -55,6 +57,10 @@ function Activities(props) { setLoading(false); }, [location]); + const handleTabChange = (event, newTab) => { + setTab(newTab) + } + if (loading) { return ; } else { @@ -63,9 +69,20 @@ function Activities(props) { } else { return (
- - Activities + + {t('activities.title')} + + + + {activityList && activityList.map((activity, index) => (