diff --git a/src/components/Modals/BecomeInternModal.module.scss b/src/components/Modals/BecomeInternModal.module.scss deleted file mode 100644 index aee76445..00000000 --- a/src/components/Modals/BecomeInternModal.module.scss +++ /dev/null @@ -1,28 +0,0 @@ -.modal { - display: flex; - flex-direction: column; - padding: 16px; - background: white; - max-width: 600px; - width: 100%; - - align-items: center; - - .buttonContainer { - justify-content: center; - align-items: center; - margin-top: 12px; - display: flex; - button { - margin: 8px; - } - } -} - -.formContainer { - width: 100%; -} - -.formItem { - width: 100%; -} diff --git a/src/components/Modals/BecomeInternModal.tsx b/src/components/Modals/BecomeInternModal.tsx deleted file mode 100644 index 12ea857f..00000000 --- a/src/components/Modals/BecomeInternModal.tsx +++ /dev/null @@ -1,230 +0,0 @@ -import React, { useContext, useState } from 'react'; -import StyledReactModal from 'styled-react-modal'; -import { Input, message, Form, Select, InputNumber } from 'antd'; -import ClipLoader from 'react-spinners/ClipLoader'; -import { Title } from '../Typography'; -import Button from '../button'; -import { ModalContext } from '../../context/ModalContext'; -import { User } from '../../types'; -import { ApiContext } from '../../context/ApiContext'; -import { BecomeIntern } from '../../types/Instructor'; -import { UserContext } from '../../context/UserContext'; -import { dev } from '../../api/config'; - -import classes from './BecomeInternModal.module.scss'; -import UniSelect from '../forms/select/UniSelect'; - -const { Option } = Select; - -interface Props { - user: User; -} - -const BecomeInternModal: React.FC = ({ user }) => { - const [loading, setLoading] = useState(false); - - const modalContext = useContext(ModalContext); - const userContext = useContext(UserContext); - const api = useContext(ApiContext); - - const onFinish = (onFinish) => { - if ( - !onFinish.description || - !onFinish.university || - !onFinish.hours || - !onFinish.state || - !onFinish.subjects - ) { - if (dev) console.log('Not all forms filled', onFinish); - return; - } - - setLoading(true); - - const data: BecomeIntern = { - msg: onFinish.description, - isOfficial: true, - university: onFinish.university, - hours: onFinish.hours, - state: onFinish.state.toLowerCase(), - module: 'internship', - subjects: onFinish.subjects.map((s) => ({ name: s })), - }; - - api - .becomeInstructor(data) - .then(() => { - message.success('Du wurdest als Kursleiter:in angemeldet.'); - modalContext.setOpenedModal(null); - userContext.fetchUserData(); - }) - .catch((err) => { - if (dev) console.error(err); - message.error('Etwas ist schief gegangen.'); - }) - .finally(() => { - setLoading(false); - }); - }; - - if (loading) { - return ( - -
- Praktikum anmelden - -
- -
-
-
- ); - } - - return ( - modalContext.setOpenedModal(null)} - > -
- Praktikum anmelden -
- - - - - - - - - - - - - - - - - - - -
- -
-
-
-
- ); -}; - -export default BecomeInternModal; diff --git a/src/components/cards/SettingsCard.tsx b/src/components/cards/SettingsCard.tsx index efd623ad..c91078dd 100644 --- a/src/components/cards/SettingsCard.tsx +++ b/src/components/cards/SettingsCard.tsx @@ -13,7 +13,6 @@ import context from '../../context'; import classes from './SettingsCard.module.scss'; import BecomeInstructorModal from '../Modals/BecomeInstructorModal'; -import BecomeInternModal from '../Modals/BecomeInternModal'; import EditableUserSettingsCard, { EditableUserSettings, } from './EditableUserSettingsCard'; @@ -84,14 +83,6 @@ const SettingsCard: React.FC = ({ user, reloadCertificates }) => { const buttons = []; if (!user.isInstructor) { - buttons.push( - modalContext.setOpenedModal('startInternship')} - accentColor="#4E6AE6" - label="Praktikum anmelden" - small - /> - ); buttons.push( modalContext.setOpenedModal('becomeInstructor')} @@ -215,7 +206,6 @@ const SettingsCard: React.FC = ({ user, reloadCertificates }) => { - diff --git a/src/routes/Login.tsx b/src/routes/Login.tsx index 5af65d54..184ed3cd 100644 --- a/src/routes/Login.tsx +++ b/src/routes/Login.tsx @@ -20,6 +20,7 @@ import Register from './Register'; import { getDomainComponents } from '../utils/DomainUtils'; import RegisterTutor from './RegisterTutor'; import { ReactComponent as PaperPlane } from '../assets/icons/paper-plane-solid.svg'; +import { NoRegistration } from '../components/NoService'; const useQuery = () => { return new URLSearchParams(useLocation().search); @@ -278,7 +279,7 @@ const Login: React.FC<{ /> - + diff --git a/src/routes/RegisterTutor.tsx b/src/routes/RegisterTutor.tsx index 8f98595f..5b225e91 100644 --- a/src/routes/RegisterTutor.tsx +++ b/src/routes/RegisterTutor.tsx @@ -39,7 +39,6 @@ interface FormData { firstname?: string; lastname?: string; email?: string; - isOfficial?: boolean; isInstructor?: boolean; isTutor?: boolean; isJufo?: boolean; @@ -64,7 +63,6 @@ interface FormData { } interface Props { - isInternship?: boolean; isClub?: boolean; isStudent?: boolean; isJufoSubdomain?: boolean; @@ -78,14 +76,9 @@ const useQuery = () => { const RegisterTutor: React.FC = (props) => { const history = useHistory(); const [loading, setLoading] = useState(false); - const [isOfficial, setOfficial] = useState(props.isInternship || false); - const [isTutor, setTutor] = useState( - props.isStudent || props.isInternship || false - ); + const [isTutor, setTutor] = useState(props.isStudent || false); const [supportsInDaz, setSupportsInDaz] = useState(false); - const [isGroups, setGroups] = useState( - props.isInternship || props.isClub || false - ); + const [isGroups, setGroups] = useState(props.isClub || false); const [isJufo, setJufo] = useState(props.isJufoSubdomain ?? false); const [wasJufoParticipant, setWasJufoParticipant] = useState(true); const [isUniversityStudent, setIsUniversityStudent] = useState(true); @@ -109,9 +102,6 @@ const RegisterTutor: React.FC = (props) => { return ( { - if (props.isInternship) { - return; - } setTutor(!isTutor); }} value="isTutor" @@ -133,9 +123,6 @@ const RegisterTutor: React.FC = (props) => { return ( { - if (props.isInternship) { - return; - } setGroups(!isGroups); }} value="isGroups" @@ -183,57 +170,6 @@ const RegisterTutor: React.FC = (props) => { ); }; - const renderDLLFormItem = () => { - return ( - - Für Lehramtsstudierende: Möchtest du dich für unser{' '} - - digitales Praktikum - {' '} - anmelden? - - } - rules={[ - () => ({ - required: props.isInternship, - validator() { - if ((!isGroups || !isTutor) && isOfficial) { - return Promise.reject( - 'Um am Praktikum teilzunehmen, musst du sowohl Schüler:innen im 1:1-Format beim Lernen als auch in Gruppenkursen helfen.' - ); - } - if (!props.isInternship) { - return Promise.resolve(); - } - if (props.isInternship && isOfficial) { - return Promise.resolve(); - } - return Promise.reject('Bitte wähle eine Option aus.'); - }, - }), - ]} - > - { - setOfficial(!isOfficial); - }} - style={{ lineHeight: '32px', marginLeft: '8px' }} - checked={isOfficial} - > - Ja - - - ); - }; - const renderOfferPickerForJufo = () => { return ( <> @@ -359,7 +295,6 @@ const RegisterTutor: React.FC = (props) => { {(props.isJufoSubdomain && renderOfferPickerForJufo()) || renderOfferPickerNormal()} - {renderDLLFormItem()} ); }; @@ -680,26 +615,6 @@ const RegisterTutor: React.FC = (props) => { /> )} - {isOfficial && ( - - - - )} = (props) => { email: data.email.toLowerCase(), isTutor: data.isTutor, subjects: data.subjects || [], - isOfficial: data.isOfficial, + isOfficial: false, isInstructor: data.isInstructor, university: data.university, module: data.module, @@ -870,7 +785,6 @@ const RegisterTutor: React.FC = (props) => { firstname: formValues.firstname, lastname: formValues.lastname, email: formValues.email, - isOfficial, isTutor, isInstructor: isGroups, isJufo,