= () => {
+// eslint-disable-next-line
+const Copyright: React.SFC<{}> = () => {
return (
Copyright Β©
diff --git a/src/client/components/Header.tsx b/src/client/components/Header.tsx
index e6dca29..0cddb96 100644
--- a/src/client/components/Header.tsx
+++ b/src/client/components/Header.tsx
@@ -1,12 +1,14 @@
import * as React from "react";
+import { Link } from "react-router-dom";
-export interface HeaderProps {}
-
-const Header: React.SFC = () => {
+// eslint-disable-next-line
+const Header: React.SFC<{}> = () => {
return (
-
+
+
+
);
};
diff --git a/src/client/components/JobCard.tsx b/src/client/components/JobCard.tsx
index bd5acb2..22e20af 100644
--- a/src/client/components/JobCard.tsx
+++ b/src/client/components/JobCard.tsx
@@ -12,7 +12,7 @@ const JobCard: React.SFC = (props: JobCardProps) => {
const { job } = props;
const handleImageError = () => {
// TODO - Should set the image to a fallback/just display the div with the not found text
- alert("IMAGE ERROR - CREATE FUNCTIONALITY");
+ // alert("IMAGE ERROR - CREATE FUNCTIONALITY");
};
return (
diff --git a/src/client/components/PaginationMore.tsx b/src/client/components/PaginationMore.tsx
index 71285ef..1d23f86 100644
--- a/src/client/components/PaginationMore.tsx
+++ b/src/client/components/PaginationMore.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+// eslint-disable-next-line
const PaginationMore: React.SFC<{}> = () => (
more_horiz
diff --git a/src/client/index.css b/src/client/index.css
index 468560e..633c36c 100644
--- a/src/client/index.css
+++ b/src/client/index.css
@@ -19,6 +19,10 @@ body {
padding: 0;
}
+#header-link {
+ text-decoration: none;
+}
+
header {
font-size: 1.5rem;
font-weight: lighter;
@@ -470,6 +474,7 @@ input::placeholder {
display: flex;
flex-direction: column;
margin-top: 36px;
+ overflow-wrap: break-word;
}
.details__container__label {
@@ -674,21 +679,21 @@ input::placeholder {
left: 0%;
top: 0%;
animation: orbit-spinner-orbit-one-animation 1200ms linear infinite;
- border-bottom: 3px solid #00d3ff;
+ border-bottom: 3px solid #b9bdcf;
}
.orbit-spinner .orbit:nth-child(2) {
right: 0%;
top: 0%;
animation: orbit-spinner-orbit-two-animation 1200ms linear infinite;
- border-right: 3px solid #00d3ff;
+ border-right: 3px solid #b9bdcf;
}
.orbit-spinner .orbit:nth-child(3) {
right: 0%;
bottom: 0%;
animation: orbit-spinner-orbit-three-animation 1200ms linear infinite;
- border-top: 3px solid #00d3ff;
+ border-top: 3px solid #b9bdcf;
}
@keyframes orbit-spinner-orbit-one-animation {
diff --git a/src/client/pages/Details.tsx b/src/client/pages/Details.tsx
index 307b920..35add74 100644
--- a/src/client/pages/Details.tsx
+++ b/src/client/pages/Details.tsx
@@ -12,7 +12,7 @@ interface DetailsProps {
const Details: React.SFC = (props: DetailsProps) => {
const { jobs } = props;
- let { id } = useParams();
+ const { id } = useParams();
const [data, setData] = React.useState(null);
const [applyLink, setApplyLink] = React.useState("");
diff --git a/src/client/redux/actions/application.ts b/src/client/redux/actions/application.ts
index ab2249b..2e0e009 100644
--- a/src/client/redux/actions/application.ts
+++ b/src/client/redux/actions/application.ts
@@ -10,46 +10,51 @@ import {
SET_TOTAL_PAGES,
} from "../actionTypes";
-import { Job } from "../../types";
+import { ApplicationAction, Job } from "../../types";
-export const setCurrentJobs = (currentJobs: Job[]) => ({
+export const setCurrentJobs = (currentJobs: Job[]): ApplicationAction => ({
type: SET_CURRENT_JOBS,
payload: { currentJobs },
});
-export const setCurrentPage = (currentPage: number) => ({
+export const setCurrentPage = (currentPage: number): ApplicationAction => ({
type: SET_CURRENT_PAGE,
payload: { currentPage },
});
-export const setFullTime = (fullTime: boolean) => ({
+export const setFullTime = (fullTime: boolean): ApplicationAction => ({
type: SET_FULL_TIME,
payload: { fullTime },
});
-export const setIsLoading = (isLoading: boolean) => ({
+export const setIsLoading = (isLoading: boolean): ApplicationAction => ({
type: SET_IS_LOADING,
payload: { isLoading },
});
-export const setJobs = (jobs: Job[]) => ({ type: SET_JOBS, payload: { jobs } });
+export const setJobs = (jobs: Job[]): ApplicationAction => ({
+ type: SET_JOBS,
+ payload: { jobs },
+});
-export const setJobsFetchedAt = (jobsFetchedAt: string) => ({
+export const setJobsFetchedAt = (jobsFetchedAt: string): ApplicationAction => ({
type: SET_JOBS_FETCHED_AT,
payload: { jobsFetchedAt },
});
-export const setLocationSearch = (locationSearch: string) => ({
+export const setLocationSearch = (
+ locationSearch: string
+): ApplicationAction => ({
type: SET_LOCATION_SEARCH,
payload: { locationSearch },
});
-export const setSearchValue = (searchValue: string) => ({
+export const setSearchValue = (searchValue: string): ApplicationAction => ({
type: SET_SEARCH_VALUE,
payload: { searchValue },
});
-export const setTotalPages = (totalPages: number) => ({
+export const setTotalPages = (totalPages: number): ApplicationAction => ({
type: SET_TOTAL_PAGES,
payload: { totalPages },
});
diff --git a/src/client/redux/thunks.ts b/src/client/redux/thunks.ts
index 63262e9..b0269d6 100644
--- a/src/client/redux/thunks.ts
+++ b/src/client/redux/thunks.ts
@@ -11,7 +11,7 @@ import { getData, unique } from "../util";
import { AppThunk, Job, LocationOption, RootState } from "../types";
-export const getJobs = (): AppThunk => async (dispatch, getState) => {
+export const getJobs = (): AppThunk => async (dispatch) => {
try {
const jobs: Job[] = await getData("/jobs");
@@ -26,7 +26,6 @@ export const getJobs = (): AppThunk => async (dispatch, getState) => {
}
};
-// TODO - `full_time` doesn't really work on GitHub API
export const searchJobs = (
search: string,
locationOptions: LocationOption[]
@@ -61,7 +60,7 @@ export const searchJobs = (
location.value
)}`;
const data = await getData(url);
- jobs.push.apply(jobs, data);
+ jobs.push(...data);
})
);
@@ -70,20 +69,21 @@ export const searchJobs = (
fullTime.toString()
)}&description=${encodeURI(search)}`;
const data = await getData(url);
- jobs.push.apply(jobs, data);
+ jobs.push(...data);
}
const uniqueJobs = unique(jobs);
- dispatch(setCurrentJobs(uniqueJobs));
+ const finalJobs = uniqueJobs.filter((job: Job) =>
+ fullTime ? job.type === "Full Time" : job
+ );
+
+ dispatch(setCurrentJobs(finalJobs));
dispatch(setCurrentPage(1));
- dispatch(setTotalPages(Math.ceil(uniqueJobs.length / 5)));
+ dispatch(setTotalPages(Math.ceil(finalJobs.length / 5)));
dispatch(setIsLoading(false));
};
-export const pagination = (pageNumber: number): AppThunk => (
- dispach,
- getState
-) => {
+export const pagination = (pageNumber: number): AppThunk => (dispach) => {
dispach(setCurrentPage(pageNumber));
};
diff --git a/src/client/util.ts b/src/client/util.ts
index 295ca7d..16d1265 100644
--- a/src/client/util.ts
+++ b/src/client/util.ts
@@ -9,12 +9,14 @@ export const getData = async (url: string): Promise => {
return data;
};
+// eslint-disable-next-line
export const groupBy = (arr: any[], key: any): any =>
arr.reduce(
(acc, item) => ((acc[item[key]] = [...(acc[item[key]] || []), item]), acc),
{}
);
+// eslint-disable-next-line
export const unique = (arr: any[]): any[] => [...new Set(arr)];
export const validURL = (str: string): boolean => {
@@ -34,7 +36,7 @@ export const validURL = (str: string): boolean => {
* Loads the state of the application from localStorage if present.
* @returns {object}
*/
-export const loadState = () => {
+export const loadState = (): any => {
try {
const serializedState = localStorage.getItem("state");
if (serializedState === null) {
@@ -50,7 +52,8 @@ export const loadState = () => {
* Saves the application state in localStorage.
* @param {object} state State of the application.
*/
-export const saveState = (state) => {
+// eslint-disable-next-line
+export const saveState = (state: any): void => {
try {
const serializedState = JSON.stringify(state);
localStorage.setItem("state", serializedState);
diff --git a/src/server/app.ts b/src/server/app.ts
index a8a237c..45c0b9e 100644
--- a/src/server/app.ts
+++ b/src/server/app.ts
@@ -32,7 +32,10 @@ class App {
];
const corsOptions: CorsOptions = {
- origin: (requestOrigin: string | undefined, callback: Function): void => {
+ origin: (
+ requestOrigin: string | undefined,
+ callback: (error?: Error, success?: boolean) => void
+ ): void => {
if (whitelistDomains.indexOf(requestOrigin) !== -1) {
callback(null, true);
} else {
diff --git a/src/server/index.ts b/src/server/index.ts
index 3608fba..665ded5 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -1,5 +1,3 @@
-import chalk from "chalk";
-
import App from "./app";
import AssetsController from "./controllers/assets";
import JobController from "./controllers/job";
diff --git a/src/server/models/Beer.ts b/src/server/models/Beer.ts
deleted file mode 100644
index 6f9d8ca..0000000
--- a/src/server/models/Beer.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import mongoose from "mongoose";
-
-/**
- * Beer Model.
- */
-const beerSchema = new mongoose.Schema(
- {
- abv: {
- required: true,
- type: Number,
- },
- brewer: {
- required: true,
- type: String,
- },
- description: {
- required: true,
- type: String,
- },
- name: {
- required: true,
- type: String,
- },
- type: {
- required: true,
- type: String,
- },
- },
- { timestamps: true }
-);
-
-/* NEW LINE */
-function applicationToJSON(this: any): void {
- return this.toObject();
-}
-
-/* NEW LINE */
-beerSchema.methods.toJSON = applicationToJSON;
-
-/* NEW LINE */
-const Beer = mongoose.model("Beer", beerSchema);
-
-/* NEW LINE */
-export default Beer;
diff --git a/src/server/util.ts b/src/server/util.ts
index 8292bc8..c3181ff 100644
--- a/src/server/util.ts
+++ b/src/server/util.ts
@@ -3,12 +3,11 @@ import fetch from "node-fetch";
/**
* Check if MongoDB is running locally. Stops application from continuing if false.
*/
-export const checkIfMongoDBIsRunning = async (): Promise =>
- new Promise(async (resolve, reject) => {
+export const checkIfMongoDBIsRunning = async (): Promise =>
+ new Promise(async (resolve) => {
try {
if (!process.env.MONGODB_URL) throw new Error("No MONGODB_URL");
- /* NEW LINE */
const response = await fetch(
process.env.MONGODB_URL.replace(/mongodb:\/\//gm, "http://")
);