Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ok 785 muut hakukohde #67

Merged
merged 39 commits into from
Feb 7, 2025
Merged

Ok 785 muut hakukohde #67

merged 39 commits into from
Feb 7, 2025

Conversation

SalamaGofore
Copy link
Contributor

@SalamaGofore SalamaGofore commented Jan 23, 2025

Oletko lisännyt tarvittavat yksikkö- tai ui-testit toiminnallisuudelle? Kyllä
Oletko tarkistanut ja päivittänyt riippuvuudet? Kyllä
Oletko kokeillut toimiiko käyttöliittymä mobiilissa landscape moodissa? Joo, huonosti (modaalissa oleva tekstieditori ja kalenterikomponenttia pystyy jotenkuten käyttämään)
Oletko testannut että lisäämäsi toiminto on saavutettava? Kyllä osittain (tekstieditorin kaikkia ominaisuuksia en ole testannut)

@SalamaGofore SalamaGofore force-pushed the OK-785-muut-hakukohde branch from 9ceb62e to 8708ef0 Compare February 5, 2025 12:13
@SalamaGofore SalamaGofore marked this pull request as ready for review February 6, 2025 08:57
@SalamaGofore SalamaGofore requested a review from pretseli February 6, 2025 08:57
}) => (
<div>
<button
aria-label="Previous Month"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tämä pitäs varmaan ottaa käännöksistä?

)}
</span>
<button
aria-label="Next Month"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tämä myös käännöksistä


type QuillProps = {
defaultValue: string;
setContentChanged: (value: string) => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Olisko tämä ennemmin onContentChanged? Vai ymmärsinkö väärin miten tää toimii? Vois näille propseille laittaa lyhyet kommentit, ja myös EditorComponentin propseille.

FormControlLabel,
Radio,
RadioGroup,
styled,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styled pitäs dokumentaation mukaan importoida @mui/material/styles:stä. Meillä on theme.tsx:ssä oma styled-wrapperi, jota olisi suositeltavaa aina käyttää.

Comment on lines 47 to 58
const CustomRadio = styled(Radio)(() => ({
padding: 0,
'&:first-child': {
padding: '5px 0',
},
}));

const CustomContainer = styled(Box)(() => ({
display: 'flex',
flexDirection: 'column',
rowGap: '1rem',
}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Voisko css:n välitykset yrittää pitää yhdenmukaisena? Gapit, marginaalit ja paddingit mun mielestä spacingilla niin pitkälle kuin mahdollista.

Comment on lines 75 to 148
const openAcceptedLetterTemplateModal = async () => {
showModal(AcceptedLetterTemplateModal, {
title: 'kirje-modaali.otsikko-hyvaksymiskirjeet',
hakukohde: hakukohde,
template: 'hyvaksymiskirje',
sijoitteluajoId,
setDocument: setHyvaksymiskirjeDocument,
});
closeMenu();
};

const openNonAcceptedLetterTemplateModal = async () => {
showModal(NonAcceptedLetterTemplateModal, {
title: 'kirje-modaali.otsikko-ei-hyvaksymiskirjeet',
hakukohde: hakukohde,
template: 'jalkiohjauskirje',
sijoitteluajoId,
});
closeMenu();
};

const openOsoitetarratModal = async () => {
showModal(ProgressModal, {
title: 'Osoitetarrojen muodostaminen',
defaultFileName: 'osoitetarrat.pdf',
progressMessage: 'Osoitetarroja muodostetaan....',
setDocument: setOsoitetarraDocument,
functionToMutate: () =>
luoOsoitetarratHakukohteessaHyvaksytyille({
sijoitteluajoId,
hakukohde,
}),
});
closeMenu();
};

const sendVastaanottoposti = async () => {
try {
const data = await sendVastaanottopostiHakukohteelle(hakukohde.oid);
if (!data || data.length < 1) {
addToast({
key: 'vastaanottoposti-hakemus-empty',
message:
'sijoittelun-tulokset.toiminnot.vastaanottoposti-hakukohteelle-ei-lahetettavia',
type: 'error',
});
} else {
addToast({
key: 'vastaanottoposti-hakemus',
message:
'sijoittelun-tulokset.toiminnot.vastaanottoposti-hakukohteelle-lahetetty',
type: 'success',
});
}
} catch (e) {
addToast({
key: 'vastaanottoposti-hakemus-virhe',
message:
'sijoittelun-tulokset.toiminnot.vastaanottoposti-hakukohteelle-virhe',
type: 'error',
});
console.error(e);
}
closeMenu();
};

const openDocument = async (documentId: string | null) => {
if (documentId) {
window.open(
configuration.lataaDokumenttiUrl({ dokumenttiId: documentId }),
);
}
closeMenu();
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tätä komponenttia selkeyttäisi aika paljon, jos eri MenuItem-palasia jakaisi omiksi komponenteikseen, jolloin esim. näitä handlereita saisi lähemmäksi komponentin koodia, jossa niitä oikeasti käytetään.

Comment on lines +35 to +65
const sendVastaanottoposti = async () => {
try {
const data = await sendVastaanottopostiValintatapaJonolle(
hakukohde.oid,
valintatapajono.oid,
);
if (!data || data.length < 1) {
addToast({
key: 'vastaanottoposti-valintatapajono-empty',
message:
'sijoittelun-tulokset.toiminnot.vastaanottoposti-jonolle-ei-lahetettavia',
type: 'error',
});
} else {
addToast({
key: 'vastaanottoposti-valintatapajonos',
message:
'sijoittelun-tulokset.toiminnot.vastaanottoposti-jonolle-lahetetty',
type: 'success',
});
}
} catch (e) {
addToast({
key: 'vastaanottoposti-valintatapajono-virhe',
message:
'sijoittelun-tulokset.toiminnot.vastaanottoposti-jonolle-virhe',
type: 'error',
});
console.error(e);
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tälle ei tarvi näyttää spinneriä?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tämä on toistaiseksi ollut yhtä nopea kuin noiden filujen avauskin, Muutetaan jos osoittautuu joissain tilanteissa hitaammaksi?

valintatapajonoOid: string,
): Promise<string[]> => {
const response = await client.post(
`${configuration.vastaanottopostiJonolleUrl({ hakukohdeOid, valintatapajonoOid })}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`${configuration.vastaanottopostiJonolleUrl({ hakukohdeOid, valintatapajonoOid })}`,
configuration.vastaanottopostiJonolleUrl({ hakukohdeOid, valintatapajonoOid }),

hakukohdeOid: string,
valintatapajonoOid: string,
): Promise<string[]> => {
const response = await client.post(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Response-tyyppi pitäs pystyä antaamaan post-funkkarillekin, eli ei pitäs tarvita tehdä as string[]

Suggested change
const response = await client.post(
const response = await client.post<Array<string>>(

tarjoajaOid: hakukohde.tarjoajaOid,
hakukohdeNimi: hakukohde.nimi.fi,
hakemusOids: hakemusOids,
letterBodyText: letterBody.replaceAll('&nbsp;', ' '),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kannattaiskohan tällanen letterBodyn siivous laittaa johonkin omaan funktioonsa? Oli toisessakin kohdassa tehty ja saattanee tulla muutakin siivottavaa.

@SalamaGofore SalamaGofore merged commit e9fb770 into main Feb 7, 2025
5 checks passed
@SalamaGofore SalamaGofore deleted the OK-785-muut-hakukohde branch February 7, 2025 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants