Skip to content

Commit

Permalink
[EN-6369] feat(cv): wording 6369 and placeholder 6392 + limit number …
Browse files Browse the repository at this point in the history
…skills on experience and formation
  • Loading branch information
PaulEntourage committed Sep 12, 2023
1 parent 882d61d commit 48b1eaf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
10 changes: 8 additions & 2 deletions src/components/forms/schemas/formSendExternalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
EXTERNAL_MESSAGE_CONTACT_TYPE_FILTERS,
ExternalMessageSubject,
ExternalMessageContactType,
ExternalMessageSubjects,
} from 'src/constants';

export const formSendExternalMessage: FormSchema<{
Expand Down Expand Up @@ -97,15 +98,20 @@ export const formSendExternalMessage: FormSchema<{
id: 'message',
name: 'message',
component: 'textarea',
title: 'Écrire votre message *',
title: (getValue) => {
if (getValue('subject') === ExternalMessageSubjects.HIRING) {
return 'Dites-lui en plus sur le(s) poste(s). N’oubliez pas de mentionner le(s) types de contrat et la localisation.';
}
return 'Écrire votre message *';
},
isRequired: true,
},
{
id: 'optInContact',
name: 'optInContact',
component: 'checkbox',
title:
"En cochant cette case, vous acceptez qu'un membre de l'équipe vous recontacte *",
'J’accepte que mon message soit lu par LinkedOut afin de protéger les Candidats LinkedOut du spam. *',
isRequired: true,
},
{
Expand Down
8 changes: 2 additions & 6 deletions src/components/partials/CV/PageCvContent/PageCVContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,7 @@ export const PageCVContent = ({
title={`Donnez un coup de pouce à ${cv.user.candidat.firstName} !`}
color={CV_COLORS.titleGray}
/>
<p>
Apporter des conseils, informations sur le secteur
d&#8217;activité, retour d&#8217;expérience, mise en contact, une
opportunité&nbsp;...
</p>
<p>Une suggestion, une info à partager&nbsp;?</p>
<Button
style="custom-secondary-inverted"
onClick={() => {
Expand Down Expand Up @@ -205,7 +201,7 @@ export const PageCVContent = ({
);
}}
>
M&#8217;envoyer un message
Envoyer un message
</Button>
</StyledCVMessageContainer>
{!isDesktop && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import CreatableSelect from 'react-select/creatable';
import {
StyledAnnotations,
Expand Down Expand Up @@ -45,15 +45,24 @@ export function SelectCreatable<T extends FilterConstant | FilterConstant[]>({
}: SelectAsyncProps<T>) {
const [remainingItems, setRemainingItems] = useState<number>(maxItems);

useEffect(() => {
const receivedValues = value as FilterConstant[];
setRemainingItems(
receivedValues ? maxItems - receivedValues.length : maxItems
);
}, [value, maxItems]);

if (hidden) {
return null;
}

const handleChange = (selectedOptions) => {
setRemainingItems(
selectedOptions ? maxItems - selectedOptions.length : maxItems
);
if (remainingItems >= 0) {
const existingValues = value as FilterConstant[];
if (
selectedOptions &&
(existingValues.length > selectedOptions.length ||
maxItems - selectedOptions.length >= 0)
) {
onChange(selectedOptions);
}
};
Expand Down

0 comments on commit 48b1eaf

Please sign in to comment.