-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
feat(profile): implement employment history #2259
feat(profile): implement employment history #2259
Conversation
…e with updating previous
…t record and back
…for employment records
client/src/services/user.ts
Outdated
export type ProfileMainCardData = { | ||
location: Location | null; | ||
name: string; | ||
githubId: string | null; | ||
publicCvUrl: string | null; | ||
employmentHistory: EmploymentRecordDto[] | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you don't need employmentHistory
on the MainCardData
. AFAIK MainCard do not use it.
client/src/services/user.ts
Outdated
@@ -230,13 +237,15 @@ export type ProfileInfo = { | |||
publicFeedback?: PublicFeedback[]; | |||
stageInterviewFeedback?: StageInterviewDetailedFeedback[]; | |||
discord: Discord | null; | |||
employmentHistory: EmploymentRecordDto[] | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need explicit undefind
or optional
would suffice?
client/src/pages/profile/index.tsx
Outdated
@@ -193,6 +200,7 @@ export class ProfilePage extends React.Component<Props, State> { | |||
name: profile?.generalInfo?.name ?? '', | |||
githubId: profile?.generalInfo?.githubId ?? null, | |||
publicCvUrl: profile?.publicCvUrl ?? null, | |||
employmentHistory: profile?.employmentHistory, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you don't need employmentHistory
on the mainInfo
. AFAIK MainCard
do not use it.
client/src/pages/profile/index.tsx
Outdated
@@ -162,6 +168,7 @@ export class ProfilePage extends React.Component<Props, State> { | |||
profile: { | |||
...profile, | |||
publicCvUrl: profile?.publicCvUrl ?? null, | |||
employmentHistory: profile?.employmentHistory, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if employmentHistory
is optional you don't need to set it here too.
<Title level={5}> | ||
{title} at {companyName} | ||
</Title> | ||
{dateFrom && dateTo && <Text type="secondary">{getWorkingPeriod(dateFrom, dateTo)}</Text>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set currently working at some company, dateTo
is not set yet(need to reload page, see comment on EmploymentCard
), therefore this line won't show expected dateFrom - Present - duration
.
I'd handle empty dateTo
in getWorkingPeriod
label="Position title" | ||
rules={[{ required: true, message: '${label} is required' }]} | ||
> | ||
<Input /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add placeholder
on inputs?
client/src/components/Profile/EmploymentHistory/EmploymentHistoryFormItem.tsx
Show resolved
Hide resolved
return; | ||
} | ||
|
||
setDisplayEmployments(employments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
related to EmploymentHistoryDisplayItem
comment
So after save, if I don't reload the page I won't see employment from-present-duration, because it relies on dateTo
to be truthy,
this could solve it:
setDisplayEmployments(employments.map(( item ) => ({...item, dateTo: item.dateTo ? dayjs(item.dateTo) : dayjs() })));
but IMHO the way you set dateTo
on employmentRecordDtoToFormItem
seams not right, if it's not set, it should stay not set
better to handle it on EmploymentHistoryDisplayItem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could solve it:
setDisplayEmployments(employments.map(( item ) => ({...item, dateTo: item.dateTo ? dayjs(item.dateTo) : dayjs() })));
Yeah, I had such solution before somewhere, but for some reason I get rid of it.
Thanks I will double check this issue
server/src/models/user.ts
Outdated
@@ -33,6 +33,7 @@ export interface EmploymentRecord { | |||
dateFrom: string; | |||
companyName: string; | |||
toPresent: boolean; | |||
officeLocation?: Location; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just location
?
client/src/api/api.ts
Outdated
* @type {object} | ||
* @memberof EmploymentRecordDto | ||
*/ | ||
'officeLocation'?: object; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be object here?
const [displayEmployments, setDisplayEmployments] = useState<EmploymentRecordFormItem[]>( | ||
data.map(employmentRecordDtoToFormItem), | ||
); | ||
const [employments, setEmployments] = useState<EmploymentRecordFormItem[]>(displayEmployments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO looks weird to have 2 states for the same data
common/models/profile.ts
Outdated
export interface JobFoundInfo { | ||
jobFound: boolean; | ||
jobFoundCompanyName?: string | null; | ||
jobFoundOfficeLocation?: string | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you really need to repeat this jobFound
in each property?
|
||
const EmploymentHistoryFormItem = ({ name, restField, remove, form }: EmploymentHistoryFormItemPros) => { | ||
const { title, dateFrom, dateTo, toPresent, companyName, officeLocation } = | ||
form.getFieldValue(['employmentHistory', name]) ?? {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need explicitly get this data rather than us form items to consume it automatically?
form.getFieldValue(['employmentHistory', name]) ?? {}; | ||
const [isToPresent, setToPresent] = useState<boolean>(toPresent); | ||
const [isDateToRequired, setIsDateToRequired] = useState<boolean>(!toPresent); | ||
const [locationSelectValue, setLocationSelectValue] = useState(officeLocation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could u. please clarify why do you need state for them. why antd form state is not sufficient?
🟢 Add
deploy
label if you want to deploy this Pull Request to staging environment🧑⚖️ Pull Request Naming Convention
area:*
label(s)🤔 This is a ...
🔗 Related issue link
#2202
💡 Background and solution
Add employment history block to profile so students could submit in the app their working experience.
☑️ Self Check before Merge