diff --git a/src/components/proposalPreview.tsx b/src/components/proposalPreview.tsx index 1b8a46a..096779e 100644 --- a/src/components/proposalPreview.tsx +++ b/src/components/proposalPreview.tsx @@ -72,7 +72,7 @@ export const ProposalPreview = ({ proposal }: ProposalPreviewProps) => { { t('internship.duration', { duration, count: Math.floor(duration.asWeeks()) }) } { ", " } - { t('internship.hours', { hours: proposal.hours }) } + { t('internship.hours', { hours: proposal.hours, count: proposal.hours }) } diff --git a/src/forms/company.tsx b/src/forms/company.tsx index a728935..d18ddcc 100644 --- a/src/forms/company.tsx +++ b/src/forms/company.tsx @@ -7,6 +7,7 @@ import { BoundProperty, formFieldProps } from "./helpers"; import { InternshipFormSectionProps } from "@/forms/internship"; import { emptyMentor } from "@/provider/dummy/internship"; import { useProxyState } from "@/hooks"; +import { useTranslation } from "react-i18next"; export type CompanyFormProps = {} & InternshipFormSectionProps; @@ -32,6 +33,7 @@ export const OfficeItem = ({ office, ...props }: { office: BranchOffice } & HTML export const BranchForm: React.FC = ({ value: office, onChange: setOffice, offices = [], disabled = false }) => { const canEdit = useMemo(() => !office.id && !disabled, [office.id, disabled]); const fieldProps = formFieldProps(office.address, address => setOffice({ ...office, address })) + const { t } = useTranslation(); const handleCityChange = (event: any, value: BranchOffice | string | null) => { if (typeof value === "string") { @@ -68,7 +70,7 @@ export const BranchForm: React.FC = ({ value: office, onChang disabled={ disabled } getOptionLabel={ office => typeof office == "string" ? office : office.address.city } renderOption={ office => } - renderInput={ props => } + renderInput={ props => } onChange={ handleCityChange } onInputChange={ handleCityInput } inputValue={ office.address.city } @@ -77,16 +79,16 @@ export const BranchForm: React.FC = ({ value: office, onChang /> - + - + - + - + @@ -95,21 +97,22 @@ export const BranchForm: React.FC = ({ value: office, onChang export const MentorForm = ({ mentor, onMentorChange }: BoundProperty) => { const fieldProps = formFieldProps(mentor, onMentorChange) + const { t } = useTranslation(); return ( <> - + - + - + - + @@ -120,6 +123,7 @@ export const CompanyForm: React.FunctionComponent = ({ interns const [company, setCompany] = useProxyState(internship.company || emptyCompany, company => onChange({ ...internship, company })); const [mentor, setMentor] = useProxyState(internship.mentor || emptyMentor, mentor => onChange({ ...internship, mentor })); const [office, setOffice] = useProxyState(internship.office || emptyBranchOffice, office => onChange({ ...internship, office })); + const { t } = useTranslation(); const canEdit = useMemo(() => !company.id, [company.id]); @@ -145,21 +149,21 @@ export const CompanyForm: React.FunctionComponent = ({ interns option.name } renderOption={ company => } - renderInput={ props => } + renderInput={ props => } onChange={ handleCompanyChange } value={ company } freeSolo /> - + {/**/} {/* */} {/**/} - Zakładowy opiekun praktyki + { t("internship.mentor") } - Oddział + { t("internship.office") } ) diff --git a/src/forms/internship.tsx b/src/forms/internship.tsx index f4d2324..a6c5e3a 100644 --- a/src/forms/internship.tsx +++ b/src/forms/internship.tsx @@ -1,23 +1,10 @@ import React, { HTMLProps, useEffect, useMemo, useState } from "react"; -import { - Button, - Dialog, - DialogActions, - DialogContent, - DialogContentText, - FormControl, - FormHelperText, - Grid, - Input, - InputLabel, - TextField, - Typography -} from "@material-ui/core"; +import { Button, Dialog, DialogActions, DialogContent, DialogContentText, Grid, TextField, Typography } from "@material-ui/core"; import { KeyboardDatePicker as DatePicker } from "@material-ui/pickers"; import { CompanyForm } from "@/forms/company"; import { StudentForm } from "@/forms/student"; import { sampleStudent } from "@/provider/dummy/student"; -import { Course, Internship, InternshipType, internshipTypeLabels } from "@/data"; +import { Internship, InternshipType, internshipTypeLabels } from "@/data"; import { Nullable } from "@/helpers"; import moment, { Moment } from "moment"; import { computeWorkingHours } from "@/utils/date"; @@ -55,12 +42,12 @@ export const InternshipTypeItem = ({ type, ...props }: { type: InternshipType } const InternshipProgramForm = ({ internship, onChange }: InternshipFormSectionProps) => { const fieldProps = formFieldProps(internship, onChange); - const course = internship.intern?.course as Course; + const { t } = useTranslation(); return ( - } + } getOptionLabel={ (option: InternshipType) => internshipTypeLabels[option].label } renderOption={ (option: InternshipType) => } options={ Object.values(InternshipType) as InternshipType[] } @@ -69,7 +56,7 @@ const InternshipProgramForm = ({ internship, onChange }: InternshipFormSectionPr /> - { internship.type === InternshipType.Other && } + { internship.type === InternshipType.Other && } {/**/ } {/* */ } @@ -88,6 +75,8 @@ const InternshipProgramForm = ({ internship, onChange }: InternshipFormSectionPr } const InternshipDurationForm = ({ internship, onChange }: InternshipFormSectionProps) => { + const { t } = useTranslation(); + const [startDate, setStartDate] = useProxyState(internship.startDate, value => onChange({ ...internship, startDate: value })); const [endDate, setEndDate] = useProxyState(internship.endDate, value => onChange({ ...internship, endDate: value })); @@ -107,45 +96,34 @@ const InternshipDurationForm = ({ internship, onChange }: InternshipFormSectionP - - Wymiar etatu - setWorkingHours(parseInt(ev.target.value) || 0) } - fullWidth - /> - Liczba godzin w tygodniu roboczym - + setWorkingHours(parseInt(ev.target.value) || 0) } + helperText={ t("forms.internship.help.working-hours") } + /> - - Łączna liczba godzin - setHoursOverride(parseInt(ev.target.value) || 0) } - fullWidth - /> - + setHoursOverride(parseInt(ev.target.value) || 0) } + /> - - Liczba tygodni - - Wyliczona automatycznie - + ); diff --git a/src/forms/student.tsx b/src/forms/student.tsx index da722e8..db1ec6e 100644 --- a/src/forms/student.tsx +++ b/src/forms/student.tsx @@ -3,42 +3,43 @@ import { Button, Grid, TextField } from "@material-ui/core"; import { Alert, Autocomplete } from "@material-ui/lab"; import React from "react"; import { sampleCourse } from "@/provider/dummy/student"; +import { useTranslation } from "react-i18next"; type StudentFormProps = { student: Student } export const StudentForm = ({ student }: StudentFormProps) => { - return ( - <> - - - - - - - - - - - - course.name } - renderInput={ props => } - options={[ sampleCourse ]} - value={ student.course } - disabled - /> - - - - - - skontaktuj się z opiekunem }> - Powyższe dane nie są poprawne? - - + const { t } = useTranslation(); + + return <> + + + - - ); + + + + + + + + course.name } + renderInput={ props => } + options={[ sampleCourse ]} + value={ student.course } + disabled + /> + + + + + + skontaktuj się z opiekunem }> + Powyższe dane nie są poprawne? + + + + ; } diff --git a/src/pages/internship/plan.tsx b/src/pages/internship/plan.tsx index e09a214..5706817 100644 --- a/src/pages/internship/plan.tsx +++ b/src/pages/internship/plan.tsx @@ -12,7 +12,7 @@ export const SubmitPlanPage = () => { return - { t('sections.my-internship.header') } + { t('pages.my-internship.header') } { t("steps.plan.submit") } { t("steps.plan.submit") } diff --git a/src/pages/internship/proposal.tsx b/src/pages/internship/proposal.tsx index f9767bd..939998b 100644 --- a/src/pages/internship/proposal.tsx +++ b/src/pages/internship/proposal.tsx @@ -30,13 +30,15 @@ import { MenuDown, StickerCheckOutline, StickerRemoveOutline } from "mdi-materia import { useVerticalSpacing } from "@/styles"; export const InternshipProposalFormPage = () => { - return + const { t } = useTranslation(); + + return - Moja praktyka - Zgłoszenie praktyki + { t("pages.my-internship.header") } + { t("pages.proposal-form.header") } - Zgłoszenie praktyki + { t("pages.proposal-form.header") } diff --git a/src/pages/main.tsx b/src/pages/main.tsx index 5d2da88..f03e9b3 100644 --- a/src/pages/main.tsx +++ b/src/pages/main.tsx @@ -25,7 +25,7 @@ export const MainPage = () => { return - { t("sections.my-internship.header") } + { t("pages.my-internship.header") } { missingStudentData.length > 0 && <> diff --git a/src/ui/theme.ts b/src/ui/theme.ts index 0cb8e31..cf65aad 100644 --- a/src/ui/theme.ts +++ b/src/ui/theme.ts @@ -10,7 +10,7 @@ export const studentTheme = responsiveFontSizes(createMuiTheme({ maxWidth: "md" }, MuiTextField: { - variant: "outlined" + variant: "outlined", } }, palette: { diff --git a/translations/en.yaml b/translations/en.yaml index 902dbbd..1fc2920 100644 --- a/translations/en.yaml +++ b/translations/en.yaml @@ -11,6 +11,41 @@ left: '{{ left, humanize }} left' dropzone: "Drag and drop a file here or click to choose" +forms: + internship: + fields: + start-date: Internship start date + end-date: Internship end date + working-hours: Working time + total-hours: Total hours + weeks: Total weeks + first-name: First name + last-name: Last name + album: Album number + course: Course + semester: Semester + kind: Contract type + kind-other: Other - please fill + company-name: Company name + nip: NIP + e-mail: e-mail address + phone: Phone number + city: City + postal-code: Postal code + country: Country + street: Street + building: Building + help: + weeks: Calculated automatically + working-hours: Total working hours in working week + send-confirmation: > + Po wysłaniu zgłoszenia nie będzie możliwości jego zmiany do czasu zweryfikowania go przez pełnomocnika ds. Twojego + kierunku. Czy na pewno chcesz wysłać zgłoszenie praktyki w tej formie? + plan: + instructions: > + Wypełnij i zeskanuj Indywidualny program Praktyk a następnie wyślij go z pomocą tego formularza. + dropzone-help: Skan dokumentu w formacie PDF + student: name: first name surname: last name @@ -19,7 +54,41 @@ student: email: e-mail albumNumber: album number -sections: +internship: + intern: + semester: semesetr {{ semester, roman }} + album: "album number {{ album }}" + date-range: "{{ start, DD MMMM YYYY }} - {{ end, DD MMMM YYYY }}" + duration: "{{ duration, weeks }} week" + duration_plural: "{{ duration, weeks }} weeks" + hours: "{{ hours }} hour" + hours_plural: "{{ hours }} hours" + office: "Office / Address" + mentor: "Internship mentor" + address: + city: "{{ city }}, {{ country }}" + street: "{{ postalCode }}, {{ street }} {{ building }}" + sections: + intern-info: "Intern personal data" + duration: "Internship duration" + place: "Internship place" + kind: "Contract and programme" + mentor: "Internship mentor" + discard: + title: "Discard internship proposal" + info: "This comments will be presented to student in order to fix errors." + accept: + title: "Accept internship proposal" + info: "This comments will be presented to student." + +submission: + status: + awaiting: "sent, awaiting verification" + accepted: "accepted" + declined: "needs correction" + draft: "draft" + +pages: my-internship: header: "My internship" @@ -29,10 +98,22 @@ steps: info: > Your profile is incomplete. In order to continue your internship you have to supply information given below. In case of problem with providing those information - please contact with your internship coordinator of your course. + form: "Add missing data" internship-proposal: header: "Internship proposal" form: "Internship proposal form" - info: "" + info: + draft: > + Przed podjęciem praktyki należy ją zgłosić. (TODO) + awaiting: > + Twoje zgłoszenie musi zostać zweryfikowane i zatwierdzone. Po weryfikacji zostaniesz poinformowany o + akceptacji bądź konieczności wprowadzenia zmian. + accepted: > + Twoje zgłoszenie zostało zweryfikowane i zaakceptowane. + declined: > + Twoje zgłoszenie zostało zweryfikowane i odrzucone. Popraw zgłoszone uwagi i wyślij zgłoszenie ponownie. W razie + pytań możesz również skontaktować się z pełnomocnikiem ds. praktyk Twojego kierunku. + action: "Send internship proposal" plan: header: "Individual Internship Plan" info: "" diff --git a/translations/pl.yaml b/translations/pl.yaml index 6547b33..a82d788 100644 --- a/translations/pl.yaml +++ b/translations/pl.yaml @@ -27,12 +27,39 @@ discard: zgłoś uwagi dropzone: "Przeciągnij i upuść plik bądź kliknij, aby wybrać" -sections: +pages: my-internship: header: "Moja praktyka" + proposal-form: + header: "Propose internship" forms: internship: + fields: + start-date: Data rozpoczęcia praktyki + end-date: Data zakończenia praktyki + working-hours: Wymiar etatu + total-hours: Łączna liczba godzin + weeks: Liczba tygodni + first-name: Imię + last-name: Nazwisko + album: Numer albumu + course: Kierunek + semester: Semestr + kind: Rodzaj praktyki/umowy + kind-other: Inny - wprowadź + company-name: Nazwa firmy + nip: NIP + e-mail: Kontaktowy adres e-mail + phone: Numer telefonu + city: Miasto + postal-code: Kod pocztowy + country: Kraj + street: Ulica + building: Nr budynku + help: + weeks: Wartość wyliczana automatycznie + working-hours: Liczba godzin w tygodniu roboczym send-confirmation: > Po wysłaniu zgłoszenia nie będzie możliwości jego zmiany do czasu zweryfikowania go przez pełnomocnika ds. Twojego kierunku. Czy na pewno chcesz wysłać zgłoszenie praktyki w tej formie? @@ -63,9 +90,12 @@ internship: date-range: "{{ start, DD MMMM YYYY }} - {{ end, DD MMMM YYYY }}" duration_2: "{{ duration, weeks }} tygodni" duration_0: "{{ duration, weeks }} tydzień" - duration_1: "{{ count }} tygodnie" - hours: "{{ hours }} godzin" + duration_1: "{{ duration, weeks }} tygodnie" + hours_2: "{{ hours }} godzin" + hours_0: "{{ hours }} godzina" + hours_1: "{{ hours }} godziny" office: "Oddział / adres" + mentor: "Zakładowy opiekun praktyki" address: city: "{{ city }}, {{ country }}" street: "{{ postalCode }}, {{ street }} {{ building }}"