Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit faf08d0

Browse files
author
dengjun
committed
remove dummy data finished
2 parents 7007b51 + 9b46724 commit faf08d0

File tree

9 files changed

+33
-66
lines changed

9 files changed

+33
-66
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dev-https": "cross-env APPMODE=development webpack-dev-server --https --port 8008",
77
"build": "webpack --mode=${APPMODE:-development} --env.config=${APPENV:-dev}",
88
"analyze": "webpack --mode=production --env.analyze=true",
9-
"lint": "eslint src --ext js,jsx",
9+
"lint": "eslint src --ext js,jsx --fix",
1010
"format": "prettier --write \"./**\"",
1111
"test": "cross-env BABEL_ENV=test jest",
1212
"watch-tests": "cross-env BABEL_ENV=test jest --watch",

src/actions/lookup.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ async function checkIsLoggedIn() {
1313
return service.checkIsLoggedIn();
1414
}
1515

16-
async function getGigPhases() {
17-
return service.getGigPhases();
18-
}
19-
20-
async function getGigStatuses() {
21-
return service.getGigStatuses();
22-
}
16+
// async function getGigStatuses() {
17+
// return service.getGigStatuses();
18+
// }
2319

2420
/**
2521
* Gets all the countries.
@@ -51,7 +47,6 @@ export default createActions({
5147
GET_TAGS: getTags,
5248
GET_COMMUNITY_LIST: getCommunityList,
5349
CHECK_IS_LOGGED_IN: checkIsLoggedIn,
54-
GET_GIG_PHASES: getGigPhases,
55-
GET_GIG_STATUSES: getGigStatuses,
50+
// GET_GIG_STATUSES: getGigStatuses,
5651
GET_ALL_COUNTRIES: getAllCountries,
5752
});

src/assets/data/my-gigs.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/containers/MyGigs/index.jsx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,24 @@ import "./styles.scss";
1313

1414
const MyGigs = ({
1515
myGigs,
16-
phases,
17-
getPhases,
1816
getMyGigs,
1917
loadMore,
2018
total,
2119
numLoaded,
2220
profile,
23-
statuses,
21+
// statuses,
2422
getProfile,
25-
getStatuses,
23+
// getStatuses,
2624
updateProfile,
2725
updateProfileSuccess,
2826
}) => {
2927
const propsRef = useRef();
30-
propsRef.current = { getMyGigs, getPhases, getProfile, getStatuses };
28+
propsRef.current = { getMyGigs, getProfile };
3129

3230
useEffect(() => {
3331
propsRef.current.getMyGigs();
34-
propsRef.current.getPhases();
3532
propsRef.current.getProfile();
36-
propsRef.current.getStatuses();
33+
// propsRef.current.getStatuses();
3734
}, []);
3835

3936
const [openUpdateProfile, setOpenUpdateProfile] = useState(false);
@@ -65,7 +62,6 @@ const MyGigs = ({
6562
</h1>
6663
<JobListing
6764
jobs={myGigs}
68-
phases={phases}
6965
loadMore={loadMore}
7066
total={total}
7167
numLoaded={numLoaded}
@@ -74,7 +70,7 @@ const MyGigs = ({
7470
<Modal open={openUpdateProfile}>
7571
<UpdateGigProfile
7672
profile={profile}
77-
statuses={statuses}
73+
// statuses={statuses}
7874
onSubmit={(profileEdit) => {
7975
updateProfile(profileEdit);
8076
setOpenUpdateProfile(false);
@@ -102,9 +98,9 @@ MyGigs.propTypes = {
10298
total: PT.number,
10399
numLoaded: PT.number,
104100
profile: PT.shape(),
105-
statuses: PT.arrayOf(PT.string),
101+
// statuses: PT.arrayOf(PT.string),
106102
getProfile: PT.func,
107-
getStatuses: PT.func,
103+
// getStatuses: PT.func,
108104
updateProfile: PT.func,
109105
updateProfileSuccess: PT.bool,
110106
};
@@ -113,18 +109,16 @@ const mapStateToProps = (state) => ({
113109
myGigs: state.myGigs.myGigs,
114110
total: state.myGigs.total,
115111
numLoaded: state.myGigs.numLoaded,
116-
phases: state.lookup.gigPhases,
117112
profile: state.myGigs.profile,
118-
statuses: state.lookup.gigStatuses,
113+
// statuses: state.lookup.gigStatuses,
119114
updateProfileSuccess: state.myGigs.updatingProfileSucess,
120115
});
121116

122117
const mapDispatchToProps = {
123118
getMyGigs: actions.myGigs.getMyGigs,
124119
loadMore: actions.myGigs.loadMoreMyGigs,
125-
getPhases: actions.lookup.getGigPhases,
126120
getProfile: actions.myGigs.getProfile,
127-
getStatuses: actions.lookup.getGigStatuses,
121+
// getStatuses: actions.lookup.getGigStatuses,
128122
updateProfile: actions.myGigs.updateProfile,
129123
};
130124

src/containers/MyGigs/modals/UpdateGigProfile/index.jsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,34 @@ import IconClose from "assets/icons/close.svg";
1111
import IconInfo from "assets/icons/info.svg";
1212
import StatusTooltip from "./tooltips/StatusTooltip";
1313
import actions from "../../../../actions";
14-
import _, { size } from "lodash";
14+
import _, { size, values } from "lodash";
1515

16-
import * as constants from "constants";
16+
import { GIG_STATUS } from "../../../../constants";
1717
import * as utils from "utils";
1818

1919
import "./styles.scss";
2020

2121
const UpdateGigProfile = ({
2222
profile,
23-
statuses,
2423
onSubmit,
2524
onClose,
2625
countries,
2726
getAllCountries,
2827
}) => {
28+
const statuses = values(GIG_STATUS);
2929
const countryOptions = useMemo(() => {
3030
const selectedCountry = countries.find(
3131
(country) => country.countryCode === profile.country
3232
);
33-
const selectedCountryName = _.get(selectedCountry, "name");
3433
return utils.createDropdownOptions(
3534
countries.map((country) => country.name),
36-
selectedCountryName
35+
selectedCountry
3736
);
3837
}, [profile, countries]);
3938

4039
const statusOptions = useMemo(() => {
4140
const selected = profile.status;
42-
const options = statuses.filter((s) => s !== constants.GIG_STATUS.PLACED);
41+
const options = statuses.filter((s) => s !== GIG_STATUS.PLACED);
4342
return utils.createDropdownOptions(options, selected);
4443
}, [profile, statuses]);
4544

@@ -278,7 +277,6 @@ const UpdateGigProfile = ({
278277

279278
UpdateGigProfile.propTypes = {
280279
profile: PT.shape(),
281-
statuses: PT.arrayOf(PT.string),
282280
onSubmit: PT.func,
283281
onClose: PT.func,
284282
};

src/reducers/lookup.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ const defaultState = {
88
tags: [],
99
subCommunities: [],
1010
isLoggedIn: null,
11-
gigPhases: [],
12-
gigStatuses: [],
11+
// gigStatuses: [],
1312
countries: [],
1413
};
1514

@@ -25,13 +24,9 @@ function onCheckIsLoggedInDone(state, { payload }) {
2524
return { ...state, isLoggedIn: payload };
2625
}
2726

28-
function onGetGigPhasesDone(state, { payload }) {
29-
return { ...state, gigPhases: payload };
30-
}
31-
32-
function onGetGigStatusesDone(state, { payload }) {
33-
return { ...state, gigStatuses: payload };
34-
}
27+
// function onGetGigStatusesDone(state, { payload }) {
28+
// return { ...state, gigStatuses: payload };
29+
// }
3530

3631
function onGetAllCountriesDone(state, { payload }) {
3732
return { ...state, countries: payload };
@@ -42,8 +37,7 @@ export default handleActions(
4237
GET_TAGS_DONE: onGetTagsDone,
4338
GET_COMMUNITY_LIST_DONE: onGetCommunityListDone,
4439
CHECK_IS_LOGGED_IN_DONE: onCheckIsLoggedInDone,
45-
GET_GIG_PHASES_DONE: onGetGigPhasesDone,
46-
GET_GIG_STATUSES_DONE: onGetGigStatusesDone,
40+
// GET_GIG_STATUSES_DONE: onGetGigStatusesDone,
4741
GET_ALL_COUNTRIES_DONE: onGetAllCountriesDone,
4842
},
4943
defaultState

src/services/lookup.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import api from "./api";
22
import qs from "qs";
33
import * as utils from "../utils";
4-
import myGigsData from "../assets/data/my-gigs.json";
54

65
async function getTags() {
76
const v3 = true;
@@ -54,13 +53,9 @@ async function getCommunityList() {
5453
);
5554
}
5655

57-
async function getGigPhases() {
58-
return Promise.resolve(myGigsData.phases);
59-
}
60-
61-
async function getGigStatuses() {
62-
return Promise.resolve(myGigsData.gigStatuses);
63-
}
56+
// async function getGigStatuses() {
57+
// return Promise.resolve(myGigsData.gigStatuses);
58+
// }
6459

6560
/**
6661
* Gets paginated countries
@@ -77,7 +72,6 @@ export default {
7772
getTags,
7873
getCommunityList,
7974
checkIsLoggedIn,
80-
getGigPhases,
81-
getGigStatuses,
75+
// getGigStatuses,
8276
getPaginatedCountries,
8377
};

src/utils/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ export * as myGig from "./myGig";
1010
export function createDropdownOptions(values, selectedValue) {
1111
return values.map((value) => ({
1212
label: `${value}`,
13-
selected: !!selectedValue && selectedValue === value,
13+
selected:
14+
!!selectedValue &&
15+
(selectedValue === value ||
16+
(selectedValue.name && selectedValue.name === value)),
1417
}));
1518
}
1619

webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ module.exports = (webpackConfigEnv) => {
124124
// Register routes
125125
require("./src/api/app-routes")(app);
126126
},
127+
hot: true,
127128
port: 8008,
128129
host: "0.0.0.0",
129130
},

0 commit comments

Comments
 (0)