Skip to content

Commit

Permalink
Merge pull request #54 from shreyas1434shinde/coursePlaner
Browse files Browse the repository at this point in the history
Issue #PS-1532 feat: Foundation Course and Main Course functionality
  • Loading branch information
itsvick authored Jul 29, 2024
2 parents c104587 + 9c6a18c commit 6957bdb
Show file tree
Hide file tree
Showing 7 changed files with 283 additions and 4 deletions.
5 changes: 5 additions & 0 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -426,5 +426,10 @@
"MIN_LENGTH_CHARACTERS_ERROR": "Minimum {{minLength}} characters required",
"MAX_LENGTH_CHARACTERS_ERROR": "Maximum {{maxLength}} characters allowed",
"NUMBER_AND_SPECIAL_CHARACTERS_NOT_ALLOWED": "Numbers and special characters are not allowed"
},
"COURSE_PLANNER":{
"COURSE_PLANNER" :"Course Plan",
"FOUNDATION_COURSE":"Foundation Course",
"MAIN_COURSE":"Main Course"
}
}
37 changes: 37 additions & 0 deletions src/components/MenuDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Role } from '@/utils/app.constant';
import useStore from '@/store/store';
import { accessGranted } from '@/utils/Helper';
import { accessControl } from '../../app.config';
import EventAvailableOutlinedIcon from '@mui/icons-material/EventAvailableOutlined';
interface DrawerProps {
toggleDrawer: (open: boolean) => () => void;
open: boolean;
Expand Down Expand Up @@ -76,6 +77,7 @@ const MenuDrawer: React.FC<DrawerProps> = ({

const isDashboard = router.pathname === '/dashboard';
const isTeacherCenter = router.pathname === '/centers';
const isCoursePlanner = router.pathname === '/course-planner';
// const isManageUser = router.pathname === '/manageUser';

return (
Expand Down Expand Up @@ -249,6 +251,41 @@ const MenuDrawer: React.FC<DrawerProps> = ({
{t('COMMON.OBSERVATIONS_FORMS')}
</Button>
</Box>

<Box sx={{ marginTop: '12px' }}>
<Button
className="fs-14"
sx={{
width: '100%',
display: 'flex',
justifyContent: 'flex-start',
background: isCoursePlanner
? theme.palette.primary.main
: 'transparent',

padding: isCoursePlanner
? '16px 18px !important'
: '0px 18px !important',
color: isCoursePlanner
? theme.palette.action.focus
: theme.palette.warning.A200,
fontWeight: isCoursePlanner ? '600' : 500,
'&:hover': {
background: isCoursePlanner
? theme.palette.primary.main
: 'transparent',
},
marginTop: '15px',
}}
startIcon={<EventAvailableOutlinedIcon />}
onClick={() => {
router.push(`/course-planner`); // Check route
}}
>
{t('COURSE_PLANNER.COURSE_PLANNER')}
</Button>
</Box>

{/* <Box sx={{ marginTop: '12px' }}>
<Button
className="fs-14"
Expand Down
4 changes: 2 additions & 2 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function DarkTheme() {

function App({ Component, pageProps }: AppProps) {
const router = useRouter();
const isFullWidthPage = fullWidthPages.includes(router.pathname);
const isFullWidthPage = fullWidthPages.includes(router.pathname);
useEffect(() => {
telemetryFactory.init();
}, []);
Expand Down Expand Up @@ -148,7 +148,7 @@ function App({ Component, pageProps }: AppProps) {
width: !isFullWidthPage ? 'calc(100% - 22rem)' : '100%',
marginLeft: !isFullWidthPage ? '351px' : '0',
},
'@media (min-width: 1600px)': {
'@media (min-width: 2000px)': {
width: '100%',
marginLeft: !isFullWidthPage ? '351px' : '0',
},
Expand Down
7 changes: 5 additions & 2 deletions src/pages/centers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,11 @@ const TeachingCenters = () => {
onCenterAdded={handleCenterAdded}
/>
<Box
className="linerGradient"
sx={{ borderRadius: '16px', mt: 2 }}
sx={{
borderRadius: '16px',
mt: 2,
background: theme.palette.action.selected,
}}
padding={'10px 16px 2px'}
>
{accessGranted(
Expand Down
223 changes: 223 additions & 0 deletions src/pages/course-planner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
import Header from '@/components/Header';
import {
Box,
FormControl,
Grid,
IconButton,
InputBase,
MenuItem,
Paper,
Select,
Tab,
Tabs,
Typography,
} from '@mui/material';
import React from 'react';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'next-i18next';
import SearchIcon from '@mui/icons-material/Search';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
import { CircularProgressbar, buildStyles } from 'react-circular-progressbar';

const CoursePlanner = () => {
const [value, setValue] = React.useState(1);
const theme = useTheme<any>();
const { t } = useTranslation();

const inputRef = React.useRef<HTMLInputElement>(null);

const handleScrollDown = () => {
if (inputRef.current) {
const inputRect = inputRef.current.getBoundingClientRect();
const scrollMargin = 20;
const scrollY = window.scrollY;
const targetY = inputRect.top + scrollY - scrollMargin;
window.scrollTo({ top: targetY - 70, behavior: 'smooth' });
}
};
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
setValue(newValue);
};
return (
<Box minHeight={'100vh'}>
<Box>
<Header />
</Box>
<Box
sx={{
display: 'flex',
justifyContent: 'left',
alignItems: 'center',
color: '#4D4639',
padding: '20px 20px 5px',
}}
width={'100%'}
>
<Typography textAlign={'left'} fontSize={'22px'}>
{t('COURSE_PLANNER.COURSE_PLANNER')}
</Typography>
</Box>

<Grid sx={{ display: 'flex', alignItems: 'center' }} container>
<Grid item md={6} xs={12}>
<Box sx={{ mt: 2, px: '20px' }}>
<Box sx={{ flexBasis: '70%' }}>
<FormControl className="drawer-select" sx={{ width: '100%' }}>
<Select
className="SelectLanguages"
displayEmpty
style={{
borderRadius: '0.5rem',
color: theme.palette.warning['200'],
width: '100%',
marginBottom: '0rem',
}}
>
<MenuItem className="text-truncate">
Khapari Dharmu (Chimur, Chandrap {/* will come from API */}
</MenuItem>
</Select>
</FormControl>
</Box>
</Box>
</Grid>
<Grid item md={6} xs={12}>
<Box sx={{ mt: 2, px: '20px' }}>
<Paper
component="form"
className="100"
sx={{
display: 'flex',
alignItems: 'center',
borderRadius: '100px',
background: theme.palette.warning.A700,
boxShadow: 'none',
}}
>
<InputBase
ref={inputRef}
sx={{ ml: 3, flex: 1, mb: '0', fontSize: '14px' }}
placeholder={t('COMMON.SEARCH_STUDENT') + '..'}
inputProps={{ 'aria-label': 'search student' }}
onClick={handleScrollDown}
/>
<IconButton type="button" sx={{ p: '10px' }} aria-label="search">
<SearchIcon />
</IconButton>
</Paper>
</Box>
</Grid>
</Grid>

<Box sx={{ mt: 2 }}>
<Box sx={{ width: '100%' }}>
<Tabs
value={value}
onChange={handleChange}
textColor="inherit"
aria-label="secondary tabs example"
sx={{
fontSize: '14px',
borderBottom: `1px solid ${theme.palette.primary.contrastText}`,

'& .MuiTab-root': {
color: '#4D4639',
padding: '0 20px',
},
'& .Mui-selected': {
color: '#4D4639',
},
'& .MuiTabs-indicator': {
display: 'flex',
justifyContent: 'center',
backgroundColor: theme.palette.primary.main,
borderRadius: '100px',
height: '3px',
},
'& .MuiTabs-scroller': {
overflowX: 'unset !important',
},
}}
>
<Tab value={1} label={t('COURSE_PLANNER.FOUNDATION_COURSE')} />
<Tab value={2} label={t('COURSE_PLANNER.MAIN_COURSE')} />
</Tabs>
</Box>
{value === 1 && (
<Box sx={{ px: '16px', mt: 2 }}>
<Box
sx={{
background: theme.palette.action.selected,
padding: '14px',
borderRadius: '8px',
}}
>
<Box
sx={{
border: `1px solid ${theme.palette.warning.A100}`,
borderRadius: '8px',
padding: '12px',
cursor: 'pointer',
}}
>
<Box
sx={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}
>
<Box>
<Box
sx={{
display: 'flex',
gap: '15px',
alignItems: 'center',
}}
>
<Box sx={{ width: '40px', height: '40px' }}>
{/* <CircularProgressbar
value={50}
strokeWidth={12}
styles={buildStyles({
pathColor: '#06A816',
trailColor: '#E2D9CC',
strokeLinecap: 'round',
textColor: theme.palette.warning['300'],
})}
/> */}
</Box>
<Box
sx={{
fontSize: '16px',
color: theme.palette.warning['300'],
}}
>
Mathematics {/* will come form API */}
</Box>
</Box>
</Box>
<Box>
<KeyboardArrowRightIcon
sx={{ color: theme.palette.warning['300'] }}
/>
</Box>
</Box>
</Box>
</Box>
</Box>
)}
</Box>
</Box>
);
};
export async function getStaticProps({ locale }: any) {
return {
props: {
...(await serverSideTranslations(locale, ['common'])),
// Will be passed to the page component as props
},
};
}
export default CoursePlanner;
2 changes: 2 additions & 0 deletions src/styles/customTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const customTheme = extendTheme({
active: '#E2D9CC',
selected: '#FBF4E4',
},

Skeleton: {
bg: '#FFDCC2',
},
Expand Down Expand Up @@ -102,6 +103,7 @@ const customTheme = extendTheme({
action: {
activeChannel: '#987100',
selectedChannel: '#dba403',
focus: '#2E1500',
},
},
},
Expand Down
9 changes: 9 additions & 0 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -974,3 +974,12 @@ input[type='number']::-webkit-outer-spin-button {
}

/* To hide the input type number arrows */


.text-truncate{
white-space: nowrap;
overflow: hidden;
width: 100%;
text-overflow: ellipsis;
padding-right: 20px;
}

0 comments on commit 6957bdb

Please sign in to comment.