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

Edit company interest #3608

Merged
merged 4 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/reducers/companyInterest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import type { CompanySemesterEntity } from 'app/reducers/companySemesters';
import createEntityReducer from 'app/utils/createEntityReducer';
import { CompanyInterestForm } from '../actions/ActionTypes';

export enum CompanyInterestCompanyType {
SmallConsultant = 'company_types_small_consultant',
MediumConsultant = 'company_types_medium_consultant',
LargeConsultant = 'company_types_large_consultant',
Inhouse = 'company_types_inhouse',
Others = 'company_types_others',
StartUp = 'company_types_start_up',
Governmental = 'company_types_governmental',
}

export type CompanyInterestEntity = {
id: number;
companyName: string;
Expand All @@ -16,6 +26,8 @@ export type CompanyInterestEntity = {
collaboration: boolean;
comment: boolean;
semesters: Array<CompanySemesterEntity>;
companyType: CompanyInterestCompanyType;
officeInTrondheim: boolean;
};
export default createEntityReducer({
key: 'companyInterest',
Expand Down
10 changes: 5 additions & 5 deletions app/routes/bdb/EditCompanyRoute.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { connect } from 'react-redux';
import { compose } from 'redux';
import {
editCompany,
fetchAdmin,
deleteCompany,
} from 'app/actions/CompanyActions';
import { uploadFile } from 'app/actions/FileActions';
import { LoginPage } from 'app/components/LoginForm';
import { selectCompanyById } from 'app/reducers/companies';
import replaceUnlessLoggedIn from 'app/utils/replaceUnlessLoggedIn';
import withPreparedDispatch from 'app/utils/withPreparedDispatch';
import {
editCompany,
fetchAdmin,
deleteCompany,
} from '../../actions/CompanyActions';
import CompanyEditor from './components/CompanyEditor';

const mapStateToProps = (state, props) => {
Expand Down
9 changes: 9 additions & 0 deletions app/routes/companyInterest/CompanyInterestEditRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import CompanyInterestPage, {
OTHER_TYPES,
TARGET_GRADE_TYPES,
PARTICIPANT_RANGE_MAP,
SURVEY_OFFER_TYPES,
} from './components/CompanyInterestPage';
import { sortSemesterChronologically } from './utils';

Expand All @@ -37,6 +38,7 @@ const mapStateToProps = (state, props) => {
const allCollaborations = Object.keys(COLLABORATION_TYPES);
const allTargetGrades = Object.keys(TARGET_GRADE_TYPES);
const allParticipantRanges = Object.keys(PARTICIPANT_RANGE_MAP);
const allSurveyOffers = Object.keys(SURVEY_OFFER_TYPES);
const allowedBdb = state.allowed.bdb;
const participantRange =
allParticipantRanges.filter(
Expand All @@ -62,6 +64,12 @@ const mapStateToProps = (state, props) => {
checked:
companyInterest.events && companyInterest.events.includes(event),
})),
companyCourseThemes: allSurveyOffers.map((offer) => ({
name: offer,
checked:
companyInterest.companyCourseThemes &&
companyInterest.companyCourseThemes.includes(offer),
})),
otherOffers: allOtherOffers.map((offer) => ({
name: offer,
checked:
Expand All @@ -80,6 +88,7 @@ const mapStateToProps = (state, props) => {
companyInterest.targetGrades &&
companyInterest.targetGrades.includes(Number(targetGrade)),
})),

participantRange: (participantRange && participantRange[0]) || null,
semesters: semesters
.map((semester) => ({
Expand Down
8 changes: 8 additions & 0 deletions app/routes/companyInterest/CompanyInterestRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import CompanyInterestPage, {
OTHER_TYPES,
COLLABORATION_TYPES,
TARGET_GRADE_TYPES,
SURVEY_OFFER_TYPES,
} from './components/CompanyInterestPage';
import { sortSemesterChronologically } from './utils';

Expand All @@ -30,6 +31,7 @@ const mapStateToProps = (state, props) => {
const allOtherOffers = Object.keys(OTHER_TYPES);
const allCollaborations = Object.keys(COLLABORATION_TYPES);
const allTargetGrades = Object.keys(TARGET_GRADE_TYPES);
const allSurveyOffers = Object.keys(SURVEY_OFFER_TYPES);
const allowedBdb = state.allowed.bdb;
const language = pathname === '/register-interest' ? 'english' : 'norwegian';
return {
Expand All @@ -39,6 +41,10 @@ const mapStateToProps = (state, props) => {
name: event,
checked: false,
})),
companyCourseThemes: allSurveyOffers.map((offer) => ({
name: offer,
checked: false,
})),
otherOffers: allOtherOffers.map((offer) => ({
name: offer,
checked: false,
Expand All @@ -52,6 +58,8 @@ const mapStateToProps = (state, props) => {
checked: false,
})),
participantRange: null,
companyTypes: null,
officeInTrondheim: null,
semesters: semesters.sort(sortSemesterChronologically),
},
interestForm: {
Expand Down
14 changes: 14 additions & 0 deletions app/routes/companyInterest/components/CompanyInterest.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

.checkboxField {
width: 30px;
margin-top: 5px;
}

.content {
Expand Down Expand Up @@ -148,3 +149,16 @@
width: 5em;
object-fit: cover;
}

.subHeading {
margin-bottom: 0.5em;
}

ion-icon {
font-size: 20px;
}
Comment on lines +157 to +159
Copy link
Member

Choose a reason for hiding this comment

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

Use classnames instead of generic tags, as it may affect other icons unexpectedly.

Copy link
Member

Choose a reason for hiding this comment

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

Just use the size prop on the <Icon /> component for this though.

Copy link
Member

Choose a reason for hiding this comment

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

bruh u never fixed this

Copy link
Member

Choose a reason for hiding this comment

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


.tooltip {
text-transform: initial;
font-weight: initial;
jonasdeluna marked this conversation as resolved.
Show resolved Hide resolved
}