Skip to content

Commit

Permalink
Merge pull request #293 from shreyas1434shinde/teachingCenter
Browse files Browse the repository at this point in the history
Issue #PS-798 fix: UI Reusable components (branch 2)
  • Loading branch information
itsvick authored Jun 18, 2024
2 parents 10eca47 + 2c4684f commit 2561283
Show file tree
Hide file tree
Showing 11 changed files with 825 additions and 21 deletions.
15 changes: 14 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@
"FROM_TO_DATE": "From - To dates",
"REMOVE": "Remove",
"MARK_DROP_OUT": "Mark as Drop Out",
"SOMETHING_WENT_WRONG": "Something went wrong"
"SOMETHING_WENT_WRONG": "Something went wrong",
"NO_GO_BACK":"No, go back",
"YES":"Yes",
"REVIEW_ATTENDANCE":"Review Attendance",
"ADD_NEW":"Add New",
"ADD":"ADD",
"ADD_CENTER":"Add Centers to your view",
"REMOVE_FROM_CENTER":"Remove From Center",
"DROP_OUT":"Drop Out",
"REASON_FOR_DROPOUT":"Reason for Dropout",
"SURE_LOGOUT" :"Are you sure you want to Logout?",
"SURE_UPDATE" :"Are you sure you want to update this attendance?",
"SURE_CLOSE":"Are you sure you want to close?",
"LEARNER_LIST":"Learners List"
},
"LOGIN_PAGE": {
"USERNAME": "Username",
Expand Down
15 changes: 14 additions & 1 deletion public/locales/hi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@
"FROM_TO_DATE": "से - दिनांक तक",
"REMOVE": "हटाएं",
"MARK_DROP_OUT": "ड्रॉप आउट के रूप में चिह्नित करें",
"SOMETHING_WENT_WRONG": "कुछ गलत हो गया"
"SOMETHING_WENT_WRONG": "कुछ गलत हो गया",
"YES": "हाँ",
"NO_GO_BACK": "नहीं, वापस जाएँ",
"REVIEW_ATTENDANCE": "उपस्थिति की समीक्षा करें",
"ADD_NEW": "नया जोड़ें",
"ADD": "जोड़ें",
"ADD_CENTER": "अपने दृश्य में केंद्र जोड़ें",
"REMOVE_FROM_CENTER": "केंद्र से हटाएं",
"DROP_OUT": "छोड़ दें",
"REASON_FOR_DROPOUT": "ड्रॉपआउट का कारण",
"SURE_LOGOUT": "क्या आप वाकई लोगआउट करना चाहते हैं?",
"SURE_UPDATE": "क्या आप इस उपस्थिति को अपडेट करना चाहते हैं?",
"SURE_CLOSE": "क्या आप वाकई बंद करना चाहते हैं?",
"LEARNER_LIST":"शिक्षार्थियों की सूची"
},
"LOGIN_PAGE": {
"USERNAME": "उपयोगकर्ता नाम",
Expand Down
15 changes: 14 additions & 1 deletion public/locales/mr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@
"FROM_TO_DATE": "पासून - पर्यंत तारीख",
"REMOVE": "काढून टाका",
"MARK_DROP_OUT": "ड्रॉप आउट म्हणून चिन्हांकित करा",
"SOMETHING_WENT_WRONG": "काहीतरी चूक झाली"
"SOMETHING_WENT_WRONG": "काहीतरी चूक झाली",
"NO_GO_BACK": "नाही, परत जा",
"YES": "होय",
"REVIEW_ATTENDANCE": "उपस्थिती पुनरावलोकन",
"ADD_NEW": "नवीन जोडा",
"ADD": "जोडा",
"ADD_CENTER": "तुमच्या दृश्यात केंद्रे जोडा",
"REMOVE_FROM_CENTER": "केंद्रातून काढून टाका",
"DROP_OUT": "गैरहजर",
"REASON_FOR_DROPOUT": "बाहेर पडण्याचे कारण",
"SURE_LOGOUT": "तुम्हाला खाते बंद करायचं आहे का?",
"SURE_UPDATE": "तुम्हाला ही उपस्थिती अपडेट करायची आहे का?",
"SURE_CLOSE": "तुम्हाला हे बंद करायचं आहे का?",
"LEARNER_LIST":"शिकणाऱ्यांची यादी"
},
"LOGIN_PAGE": {
"USERNAME": "वापरकर्तानाव",
Expand Down
Binary file added src/assets/images/apartment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 84 additions & 0 deletions src/components/BottomDrawer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import * as React from 'react';

import Box from '@mui/material/Box';
import Drawer from '@mui/material/Drawer';
import DropOutModal from './DropOutModal';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemButton from '@mui/material/ListItemButton';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'next-i18next';

type Anchor = 'bottom';

interface BottomDrawerProps {
toggleDrawer: (
anchor: Anchor,
open: boolean
) => (event: React.MouseEvent) => void;
state: { [key in Anchor]?: boolean };
optionList: {
label: string;
icon: React.ReactNode;
name: string;
}[];
listItemClick: (event: React.MouseEvent, name: string) => void;
}

export default function BottomDrawer({
toggleDrawer,
state,
optionList,
listItemClick,
}: BottomDrawerProps) {
const { t } = useTranslation();
const theme = useTheme<any>();

const list = (anchor: Anchor) => (
<Box
sx={{
width: 'auto',
}}
role="presentation"
>
<Box
sx={{
padding: '30px 40px 40px',
display: 'flex',
justifyContent: 'center',
}}
onClick={toggleDrawer(anchor, false)}
>
<Box className="bg-grey"></Box>
</Box>
<List>
{optionList.map(({ label, icon, name }, index) => (
<ListItem disablePadding key={index}>
<ListItemButton
sx={{
borderBottom: '1px solid #D0C5B4',
padding: '20px',
fontSize: '14px',
color: theme.palette.warning['300'],
}}
onClick={(e) => listItemClick(e, name)}
>
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={label} />
</ListItemButton>
</ListItem>
))}
</List>
</Box>
);

return (
<div>
<Drawer anchor="bottom" open={state.bottom} className="modal-bottom">
{list('bottom')}
</Drawer>
</div>
);
}
132 changes: 132 additions & 0 deletions src/components/DropOutModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import * as React from 'react';

import {
Box,
Button,
Divider,
FormControl,
InputLabel,
MenuItem,
Modal,
OutlinedInput,
Select,
SelectChangeEvent,
Typography,
} from '@mui/material';
import { Theme, useTheme } from '@mui/material/styles';

import CloseIcon from '@mui/icons-material/Close';
import { useTranslation } from 'next-i18next';

interface DropOutModalProps {
open: boolean;
onClose: (confirmed: boolean) => void;
}

function DropOutModal({ open, onClose }: DropOutModalProps) {
const { t } = useTranslation();

const style = {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: '85%',
boxShadow: 24,
bgcolor: '#fff',
borderRadius: '24px',
'@media (min-width: 600px)': {
width: '450px',
},
};

const theme = useTheme<any>();

return (
<React.Fragment>
<Modal
open={open}
aria-labelledby="child-modal-title"
aria-describedby="child-modal-description"
>
<Box sx={{ ...style }}>
<Box
display={'flex'}
justifyContent={'space-between'}
sx={{ padding: '18px 16px' }}
>
<Box marginBottom={'0px'}>
<Typography
variant="h2"
sx={{
color: theme.palette.warning['A200'],
fontSize: '14px',
}}
component="h2"
>
{t('COMMON.DROP_OUT')}
</Typography>
</Box>
<CloseIcon
sx={{
cursor: 'pointer',
color: theme.palette.warning['A200'],
}}
onClick={() => onClose(false)}
/>
</Box>
<Divider />
<Box sx={{ padding: '10px 18px' }}>
<FormControl sx={{ mt: 1, width: '100%' }}>
<InputLabel
sx={{ fontSize: '16px', color: theme.palette.warning['300'] }}
id="demo-multiple-name-label"
>
{t('COMMON.REASON_FOR_DROPOUT')}
</InputLabel>
<Select
labelId="demo-multiple-name-label"
id="demo-multiple-name"
input={<OutlinedInput label="Reason for Dropout" />}
>
<MenuItem
value="Unable to cope with studies"
sx={{
fontSize: '16px',
color: theme.palette.warning['300'],
}}
>
Unable to cope with studies {/* come from API */}
</MenuItem>
<MenuItem
value="Family responsibilities"
sx={{
fontSize: '16px',
color: theme.palette.warning['300'],
}}
>
Family responsibilities {/* come from API */}
</MenuItem>
</Select>
</FormControl>
</Box>
<Box mt={1.5}>
<Divider />
</Box>
<Box p={'18px'}>
<Button
className="w-100"
sx={{ boxShadow: 'none' }}
variant="contained"
onClick={() => onClose(true)}
>
{t('COMMON.MARK_DROP_OUT')}
</Button>
</Box>
</Box>
</Modal>
</React.Fragment>
);
}

export default DropOutModal;
Loading

0 comments on commit 2561283

Please sign in to comment.