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

Ability to Resort Job Items #240

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [saadq]
1 change: 0 additions & 1 deletion app/client/src/app/pages/Error404.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import React from 'react'
import styled from 'styled-components'
import { darken, rgba } from 'polished'
import { PrimaryButton } from '../../common/components'
import { colors } from '../../common/theme'
import comic from '../assets/comic.png'
Expand Down
17 changes: 16 additions & 1 deletion app/client/src/features/form/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,19 @@ function removeAward(): Action {
}
}

function moveJobUp(index: number): Action {
return {
type: 'MOVE_JOB_UP',
index
}
}
function moveJobDown(index: number): Action {
return {
type: 'MOVE_JOB_DOWN',
index
}
}

export {
uploadJSON,
uploadJSONRequest,
Expand All @@ -210,5 +223,7 @@ export {
removeProjectKeyword,
addAward,
removeAward,
uploadFileAndGenerateResume
uploadFileAndGenerateResume,
moveJobUp,
moveJobDown
}
34 changes: 32 additions & 2 deletions app/client/src/features/form/components/fragments/Job.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,43 @@ type Props = {
highlights: Array<?string>,
index: number,
addHighlight: (index: number) => void,
removeHighlight: (index: number) => void
removeHighlight: (index: number) => void,
jobCount: number,
moveUp: (index: number) => void,
moveDown: (index: number) => void
}

function Job({ highlights, index, addHighlight, removeHighlight }: Props) {
function Job({
highlights,
index,
addHighlight,
removeHighlight,
jobCount,
moveUp,
moveDown
}: Props) {
return (
<div>
{index > 0 ? <Divider /> : null}
<Row>
<Label>Move job position</Label>
<ButtonRow>
<RoundButton
disabled={index === 0}
type="button"
onClick={() => moveUp(index)}
>
<Icon type="arrow_upward" />
</RoundButton>
<RoundButton
disabled={index >= jobCount - 1}
type="button"
onClick={() => moveDown(index)}
>
<Icon type="arrow_downward" />
</RoundButton>
</ButtonRow>
</Row>
<LabeledInput
name={`work[${index}].company`}
label="Company Name"
Expand Down
20 changes: 16 additions & 4 deletions app/client/src/features/form/components/sections/Work.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import {
addJob,
removeJob,
addJobHighlight,
removeJobHighlight
removeJobHighlight,
moveJobUp,
moveJobDown
} from '../../actions'
import type { FormValues } from '../../types'
import type { State } from '../../../../app/types'
Expand All @@ -24,15 +26,20 @@ type Props = {
addJob: () => void,
removeJob: () => void,
addJobHighlight: (index: number) => void,
removeJobHighlight: (index: number) => void
removeJobHighlight: (index: number) => void,
moveJobUp: (index: number) => void,
moveJobDown: (index: number) => void
}

function Work({
work,
jobCount = work.length,
addJob,
removeJob,
addJobHighlight,
removeJobHighlight
removeJobHighlight,
moveJobUp,
moveJobDown
}: Props) {
return (
<Section heading="Your Work Experience">
Expand All @@ -49,6 +56,9 @@ function Work({
highlights={job.highlights}
addHighlight={addJobHighlight}
removeHighlight={removeJobHighlight}
jobCount={jobCount}
moveUp={moveJobUp}
moveDown={moveJobDown}
/>
))}
<Button onClick={addJob} type="button">
Expand All @@ -71,7 +81,9 @@ const mapActions = {
addJob,
removeJob,
addJobHighlight,
removeJobHighlight
removeJobHighlight,
moveJobUp,
moveJobDown
}

export default connect(mapState, mapActions)(Work)
41 changes: 41 additions & 0 deletions app/client/src/features/form/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,47 @@ function form(state: FormState = initialState, action: Action): FormState {
}
}

case 'MOVE_JOB_UP': {
if (state.values.work.length <= 1 || action.index <= 0) {
return state
}

return {
...state,
values: {
...state.values,
work: [
...state.values.work.slice(0, action.index - 1),
state.values.work[action.index],
state.values.work[action.index - 1],
...state.values.work.slice(action.index + 1)
]
}
}
}

case 'MOVE_JOB_DOWN': {
if (
state.values.work.length <= 1 ||
action.index + 1 >= state.values.work.length
) {
return state
}

return {
...state,
values: {
...state.values,
work: [
...state.values.work.slice(0, action.index),
state.values.work[action.index + 1],
state.values.work[action.index],
...state.values.work.slice(action.index + 2)
]
}
}
}

default:
return state
}
Expand Down
2 changes: 2 additions & 0 deletions app/client/src/features/form/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,7 @@ type FormAction =
| { type: 'REMOVE_PROJECT_KEYWORD', index: number }
| { type: 'ADD_AWARD' }
| { type: 'REMOVE_AWARD' }
| { type: 'MOVE_JOB_UP', index: number }
| { type: 'MOVE_JOB_DOWN', index: number }

export type { FormState, FormAction, FormValues, FormValuesWithSectionOrder }
1 change: 1 addition & 0 deletions app/server/src/generator/templates/template1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ function template1(values: SanitizedValues) {
\\textheight=10in
\\pagestyle{empty}
\\raggedright
\\usepackage[left=0.8in,right=0.8in,bottom=0.8in,top=0.8in]{geometry}

${generator.resumeDefinitions()}

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Important Note

All development is currently happening in the Resumake rewrite which is in the [v3](https://github.com/saadq/resumake.io/tree/v3) branch. In the mean time, no further development/fixes will be done in the current app in order to focus efforts on the next version.
All development is currently happening in the Resumake rewrite which is in the [main](https://github.com/saadq/resumake.io/tree/main) branch. In the mean time, no further development/fixes will be done in the current app in order to focus efforts on the next version.

---

Expand Down