Skip to content

Commit

Permalink
Merge pull request #663 from shreyas1434shinde/YouthNet
Browse files Browse the repository at this point in the history
Issue task PS-3327 :Youth UI figma match
  • Loading branch information
itsvick authored Jan 31, 2025
2 parents 21bcb1c + 40e580c commit b4dad59
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 19 deletions.
4 changes: 3 additions & 1 deletion src/components/SimpleModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface SimpleModalProps {
open: boolean;
onClose: () => void;
modalTitle: string;
handleNext? : any
}
const SimpleModal: React.FC<SimpleModalProps> = ({
open,
Expand All @@ -33,6 +34,7 @@ const SimpleModal: React.FC<SimpleModalProps> = ({
secondaryActionHandler,
children,
modalTitle,
handleNext
}) => {
const theme = useTheme<any>();
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
Expand Down Expand Up @@ -118,7 +120,7 @@ const SimpleModal: React.FC<SimpleModalProps> = ({
variant="contained"
color="primary"
sx={buttonStyle}
onClick={primaryActionHandler}
onClick={primaryActionHandler || handleNext}
className='one-line-text'
>
{primaryText}
Expand Down
1 change: 0 additions & 1 deletion src/components/youthNet/GenericForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const GenericForm: React.FC<GenericFormProps> = ({ fields }) => {
display: "flex",
flexDirection: "column",
gap: 2,
padding: 2,
borderRadius: "8px",
}}
>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/youthboard/campDetails/[surveyCamp].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const SurveyClassDetails = () => {
</Box>
</Box>
)}
{value === 2 && <Box>Tab 2</Box>}
{value === 2 && <Box>coming soon</Box>}
</Box>
);
};
Expand Down
15 changes: 1 addition & 14 deletions src/pages/youthboard/surveys/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,7 @@ const Survey = () => {
router.push('/youthboard/volunteerList');
};

const formFields = [
{ type: "text", label: "Full Name" },
{ type: "number", label: "Contact Number" },
{
type: "radio",
label: "Gender",
options: [
{ value: "female", label: "Female" },
{ value: "male", label: "Male" },
],
},
{ type: "number", label: "Age" },
{ type: "email", label: "Mentor's Email ID" },
];


return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const villageSurveyName = () => {
</Box>
</Box>
)}
{value === 2 && <Box>Tab 2</Box>}
{value === 2 && <Box>coming soon</Box>}
</Box>
)
}
Expand Down
69 changes: 69 additions & 0 deletions src/pages/youthboard/villages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ import AddIcon from '@mui/icons-material/Add';
import SimpleModal from '@/components/SimpleModal';
import Surveys from '@/components/youthNet/Surveys';
import { useDirection } from '@/hooks/useDirection';
import GenericForm from '@/components/youthNet/GenericForm';
import ExamplePage from '@/components/youthNet/BlockItem';

const Index = () => {
const { isRTL } = useDirection();
Expand All @@ -62,11 +64,15 @@ const Index = () => {

const [openReassignDistrict, setOpenReassignDistrict] = useState(false);
const [openReassignVillage, setOpenReassignVillage] = useState(false);
const [addNew, setAddNew] = useState(false);
const [count, setCount] = useState(0);

const [openDelete, setOpenDelete] = useState(false);
const [selectedValue, setSelectedValue] = useState('');
const [districtData, setDistrictData] = useState<any>(null);
const [blockData, setBlockData] = useState<any>(null);


useEffect(() => {
const getData = async () => {
const districtData = await fetchDistrictData();
Expand Down Expand Up @@ -107,6 +113,7 @@ const Index = () => {
setOpenDelete(false);
setOpenReassignDistrict(false);
setOpenReassignVillage(false);
setAddNew(false)
};

const handleButtonClick = (actionType: string) => {
Expand Down Expand Up @@ -176,6 +183,29 @@ const Index = () => {
setSelectedValue(value);
};

const formFields = [
{ type: "text", label: "Full Name" },
{ type: "number", label: "Contact Number" },
{
type: "radio",
label: "Gender",
options: [
{ value: "female", label: "Female" },
{ value: "male", label: "Male" },
],
},
{ type: "number", label: "Age" },
{ type: "email", label: "Mentor's Email ID" },
];

const handleOpenNew = () => {
setAddNew(true)
}

const handleNext= () => {
setCount(count + 1)
}

return (
<Box minHeight="100vh">
<Box>
Expand Down Expand Up @@ -286,6 +316,7 @@ const Index = () => {
className="text-1E"
// onClick={handleOpenAddFaciModal}
endIcon={<AddIcon />}
onClick={handleOpenNew}
>
{t('COMMON.ADD_NEW')}
</Button>
Expand Down Expand Up @@ -477,6 +508,44 @@ const Index = () => {
</Box>
</Box>
</SimpleModal>


<SimpleModal
open={addNew}
onClose={onClose}
showFooter={true}
modalTitle={
'New Mentor'
}
handleNext={handleNext}
primaryText={count === 0 ? 'Next' : 'Finish & Assign'}
// secondaryText={t('YOUTHNET_USERS_AND_VILLAGES.FINISH_ASSIGN')}

//pass function handler as props
>
{
count === 0 && (
<Box>
<Box mt={2}>
<GenericForm fields={formFields}/>
</Box>
</Box>
)
}
{
count === 1 && (
<Box>
<Box mt={2}>
<ExamplePage/>
</Box>
</Box>
)
}
</SimpleModal>




</>
)}
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/services/youthNet/Dashboard/UserServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || '';

const MENTOR_DETAILS = {
MENTOR_NAME: 'Mentor',
MENTOR_OPTIONS: ['Shivan Mathur', 'Mentor 2', 'Mentor 3', 'Mentor 4'],
MENTOR_OPTIONS: ['Shivan Mathur', 'Vivek kasture', 'Rohan Nene', 'Sanket Jadhav'],
};

export const fetchUserData = async (): Promise<any> => {
Expand Down

0 comments on commit b4dad59

Please sign in to comment.