Skip to content

Fk 4#23

Open
FilipKaczmarek wants to merge 34 commits intomasterfrom
fk-4
Open

Fk 4#23
FilipKaczmarek wants to merge 34 commits intomasterfrom
fk-4

Conversation

@FilipKaczmarek
Copy link
Collaborator

Created Jobs module with list of job offers

@auto-assign auto-assign bot requested a review from pdybowski December 8, 2021 15:19
@FilipKaczmarek FilipKaczmarek linked an issue Dec 8, 2021 that may be closed by this pull request
Copy link
Owner

@pdybowski pdybowski left a comment

Choose a reason for hiding this comment

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

please fix

Copy link
Owner

@pdybowski pdybowski left a comment

Choose a reason for hiding this comment

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

please fix

Comment on lines +35 to +55
const offerBox = document.createElement('div');
offerBox.classList.add('jobOffers__offerBox', 'position-relative', 'shadow', 'p-3', 'mb-5', 'bg-light', 'rounded');
const offerHeader = document.createElement('h4');
offerHeader.classList.add('fs-4')
const offerCompanyName = document.createElement('p');
const offerLocalization = document.createElement('p');
offerLocalization.classList.add('fw-light')
const offerSalary = document.createElement('span');
offerSalary.classList.add('fw-light')
const button = document.createElement('a');
button.setAttribute('href', job.redirect_url)
button.setAttribute('target', '_blank')
button.classList.add('jobOffers__offerBox--button', 'position-absolute', 'bottom-0', 'start-50', 'translate-middle-x')
button.innerText = 'Show more!';
let minSalary = job.salary_min ? job.salary_min : 'unknow';
let maxSalary = job.salary_max ? job.salary_max : 'unknow';

offerHeader.innerText = job.title ? job.title : 'No title for this role';
offerCompanyName.innerText = job.company.display_name ? job.company.display_name : null;
offerLocalization.innerText = job.location.display_name ? job.location.display_name : 'Location unknown';
offerSalary.innerText = `min. salary: ${minSalary} || max. salary: ${maxSalary}`;
Copy link
Owner

Choose a reason for hiding this comment

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

please put this all in separate methods like:
const offerHeader = _createOfferHeader()
const offerBox = _createOfferBox()
...

@FilipKaczmarek
Copy link
Collaborator Author

@pdybowski done

Copy link
Owner

@pdybowski pdybowski left a comment

Choose a reason for hiding this comment

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

please update



_renderContent(data) {
const containerWithJobOffers = document.createElement('div');
Copy link
Owner

Choose a reason for hiding this comment

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

we have createElement util to create elements

this.APP_ID = '07300533';
this.APP_KEY = 'fadda830981b47b9ef3e023f82b349ca';
this.URL = `https://api.adzuna.com/v1/api/jobs/pl/search/1?app_id=${this.APP_ID}&app_key=${this.APP_KEY}`;
this.fetchedData;
Copy link
Owner

Choose a reason for hiding this comment

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

do we need this here?

export class Jobs {
constructor() {
this.viewElement = document.querySelector('#main');
this.APP_ID = '07300533';
Copy link
Owner

Choose a reason for hiding this comment

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

these fields should be taken from envirnoment file

fetch(this.URL)
.then(response => response.json())
.then(data => this._renderContent(data.results))
.catch(error => this.fetchError = error);
Copy link
Owner

Choose a reason for hiding this comment

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

please use Notification class to show errors

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.

tab: job offer

2 participants