Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into move-reply-to-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mark86092 committed Sep 10, 2023
2 parents 9ca0c37 + 65170af commit d5e8ff2
Show file tree
Hide file tree
Showing 57 changed files with 177 additions and 238 deletions.
9 changes: 5 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ module.exports = {
config: {
resolve: {
alias: {
actions: path.resolve('./src/actions'),
apis: path.resolve('./src/apis'),
common: path.resolve('./src/components/common'),
utils: path.resolve('./src/utils'),
constants: path.resolve('./src/constants'),
contexts: path.resolve('./src/contexts'),
graphql: path.resolve('./src/graphql'),
hooks: path.resolve('./src/hooks'),
contexts: path.resolve('./src/contexts'),
constants: path.resolve('./src/constants'),
actions: path.resolve('./src/actions'),
selectors: path.resolve('./src/selectors'),
utils: path.resolve('./src/utils'),
},
},
},
Expand Down
11 changes: 6 additions & 5 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"compilerOptions": {
"baseUrl": "./",
"paths": {
"actions/*": ["src/actions/*"],
"apis/*": ["src/apis/*"],
"common/*": ["src/components/common/*"],
"utils/*": ["src/utils/*"],
"constants/*": ["src/constants/*"],
"contexts/*": ["src/contexts/*"],
"graphql/*": ["src/graphql/*"],
"hooks/*": ["src/hooks/*"],
"contexts/*": ["src/contexts/*"],
"constants/*": ["src/constants/*"],
"actions/*": ["src/actions/*"],
"selectors/*": ["src/selectors/*"]
"selectors/*": ["src/selectors/*"],
"utils/*": ["src/utils/*"]
}
},
"exclude": ["node_modules", "dist"]
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
},
"jest": {
"moduleNameMapper": {
"^actions(.*)": "<rootDir>/src/actions$1",
"^apis(.*)": "<rootDir>/src/apis$1",
"^common(.*)": "<rootDir>/src/components/common$1",
"^utils(.*)": "<rootDir>/src/utils$1",
"^constants(.*)": "<rootDir>/src/constants$1",
"^contexts(.*)": "<rootDir>/src/contexts$1",
"^graphql(.*)": "<rootDir>/src/graphql$1",
"^hooks(.*)": "<rootDir>/src/hooks$1",
"^contexts(.*)": "<rootDir>/src/contexts$1",
"^constants(.*)": "<rootDir>/src/constants$1",
"^actions(.*)": "<rootDir>/src/actions$1",
"^selectors(.*)": "<rootDir>/src/selectors$1"
"^selectors(.*)": "<rootDir>/src/selectors$1",
"^utils(.*)": "<rootDir>/src/utils$1"
}
},
"devDependencies": {
Expand Down
21 changes: 0 additions & 21 deletions src/actions/viewLog.js

This file was deleted.

9 changes: 3 additions & 6 deletions src/components/App/Header/Top/EmailVerificationTop.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ import { connect } from 'react-redux';
import cls from 'classnames';

import { Wrapper } from 'common/base';
import Modal from 'common/Modal';

import { getUserName, getUserEmail } from 'selectors/authSelector';
import { sendVerifyEmail } from 'actions/emailVerify';
import topStyles from './Top.module.css';
import styles from './EmailVerificationTop.module.css';

import Modal from '../../../common/Modal';
import VerifyEmailForm from '../../../EmailVerification/VerifyEmailForm';

import { getUserName, getUserEmail } from '../../../../selectors/authSelector';

import { sendVerifyEmail } from '../../../../actions/emailVerify';

const EmailVerificationTop = ({
isSentVerificationEmail,
userName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ import AboutThisJobModal from '../../TimeAndSalary/common/AboutThisJobModal';
import timeAndSalaryBoardStyles from '../../TimeAndSalary/TimeAndSalaryBoard/TimeAndSalaryBoard.module.css';
import timeAndSalaryBannerStyles from '../../TimeAndSalary/Banner.module.css';
import timeAndSalaryCommonStyles from '../../TimeAndSalary/views/view.module.css';
import fetchingStatus, { isFetched } from '../../../constants/status';
import { MAX_ROWS_IF_HIDDEN } from '../../../constants/hideContent';
import fetchingStatus, { isFetched } from 'constants/status';
import { MAX_ROWS_IF_HIDDEN } from 'constants/hideContent';
import { BasicPermissionBlock } from 'common/PermissionBlock';
import styles from '../CampaignTimeAndSalary.module.css';

import { queryCampaignInfoList } from '../../../actions/campaignInfo';
import { queryCampaignTimeAndSalary } from '../../../actions/campaignTimeAndSalaryBoard';
import GradientMask from '../../common/GradientMask';
import { queryCampaignInfoList } from 'actions/campaignInfo';
import { queryCampaignTimeAndSalary } from 'actions/campaignTimeAndSalaryBoard';
import GradientMask from 'common/GradientMask';

import DashBoardTable from '../../TimeAndSalary/common/DashBoardTable';
import { campaignEntriesSelector } from '../../../selectors/campaignSelector';
import { campaignEntriesSelector } from 'selectors/campaignSelector';

import {
pathSelector,
Expand Down
4 changes: 2 additions & 2 deletions src/components/CampaignTimeAndSalary/NotFound.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import CommonNotFound from 'common/NotFound';
import Redirect from 'common/routing/Redirect';
import { queryCampaignInfoList } from '../../actions/campaignInfo';
import { isFetched } from '../../constants/status';
import { queryCampaignInfoList } from 'actions/campaignInfo';
import { isFetched } from 'constants/status';

class NotFound extends Component {
static fetchData({ store: { dispatch } }) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CampaignTimeAndSalary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import InfoSalaryModal from '../TimeAndSalary/common/InfoSalaryModal';
import withModal from '../TimeAndSalary/common/withModal';
import styles from './CampaignTimeAndSalary.module.css';

import { queryCampaignInfoList } from '../../actions/campaignInfo';
import { queryCampaignInfoList } from 'actions/campaignInfo';

const campaignListFromEntries = campaignEntries =>
campaignEntries
Expand Down
6 changes: 3 additions & 3 deletions src/components/Company/CompanyIndexProvider.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import CompanyAndJobTitleIndexPage from '../CompanyAndJobTitle/IndexPage';
import { pageType } from '../../constants/companyJobTitle';
import { fetchCompanyNames } from '../../actions/company';
import { pageType } from 'constants/companyJobTitle';
import { fetchCompanyNames } from 'actions/company';
import {
companyNames as companyNamesSelector,
companyNamesStatus as companyNamesStatusSelector,
} from '../../selectors/companyAndJobTitle';
} from 'selectors/companyAndJobTitle';

const CompanyIndexProvider = () => {
const status = useSelector(companyNamesStatusSelector);
Expand Down
6 changes: 3 additions & 3 deletions src/components/Company/CompanyPageProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import Overview from '../CompanyAndJobTitle/Overview';
import InterviewExperiences from '../CompanyAndJobTitle/InterviewExperiences';
import WorkExperiences from '../CompanyAndJobTitle/WorkExperiences';
import CompanyJobTitleTimeAndSalary from '../CompanyAndJobTitle/TimeAndSalary';
import NotFound from '../common/NotFound';
import NotFound from 'common/NotFound';
import { withPermission } from 'common/permission-context';

import { tabType, pageType } from '../../constants/companyJobTitle';
import companyActions from '../../actions/company';
import { tabType, pageType } from 'constants/companyJobTitle';
import companyActions from 'actions/company';
import {
interviewExperiences,
workExperiences,
Expand Down
53 changes: 12 additions & 41 deletions src/components/CompanyAndJobTitle/TimeAndSalary/ViewLog.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,25 @@
import { Component } from 'react';
import { useEffect } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { useViewSalaryWorkTimes } from 'hooks/viewLog';

import { viewSalaryWorkTimes } from '../../../actions/viewLog';

class ViewLog extends Component {
componentDidMount() {
const { contentIds } = this.props;
const ViewLog = ({ pageName, page, contentIds }) => {
// Send view to backend
const viewSalaryWorkTimes = useViewSalaryWorkTimes();
useEffect(() => {
const referrer = window.location.href;
viewSalaryWorkTimes({ contentIds, referrer });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pageName, page, viewSalaryWorkTimes]);

this.props.viewSalaryWorkTimes({ contentIds, referrer });
}

componentDidUpdate(prevProps) {
const prevPageName = prevProps.pageName;
const prevPage = prevProps.page;
const pageName = this.props.pageName;
const page = this.props.page;

if (prevPageName !== pageName || prevPage !== page) {
const { contentIds } = this.props;
const referrer = window.location.href;

this.props.viewSalaryWorkTimes({ contentIds, referrer });
}
}

render() {
return null;
}
}
return null;
};

ViewLog.propTypes = {
// key
pageName: PropTypes.string.isRequired,
page: PropTypes.number.isRequired,

contentIds: PropTypes.arrayOf(PropTypes.string).isRequired,

// method
viewSalaryWorkTimes: PropTypes.func.isRequired,
};

const mapStateToProps = state => ({});

const mapDispatchToProps = dispatch =>
bindActionCreators({ viewSalaryWorkTimes }, dispatch);

export default connect(
mapStateToProps,
mapDispatchToProps,
)(ViewLog);
export default ViewLog;
2 changes: 1 addition & 1 deletion src/components/EmailVerification/VerificationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import GjLogo from 'common/icons/GjLogo.svg';
import Heading from 'common/base/Heading';
import P from 'common/base/P';

import { verifyEmail } from '../../actions/emailVerify';
import { verifyEmail } from 'actions/emailVerify';

import VerificationSuccess from './VerificationSuccess';
import VerificationFailure from './VerificationFailure';
Expand Down
24 changes: 6 additions & 18 deletions src/components/ExperienceDetail/hooks/useTrace.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
import { useEffect, useCallback } from 'react';
import { useDispatch } from 'react-redux';
import { useEffect } from 'react';
import ReactPixel from 'react-facebook-pixel';
import PIXEL_CONTENT_CATEGORY from '../../../constants/pixelConstants';
import { viewExperiences as viewExperiencesAction } from '../../../actions/viewLog';

const useView = experienceId => {
const dispatch = useDispatch();
const viewExperiences = useCallback(
({ contentIds, referrer }) => {
dispatch(viewExperiencesAction({ contentIds, referrer }));
},
[dispatch],
);
import PIXEL_CONTENT_CATEGORY from 'constants/pixelConstants';
import { useViewExperiences } from 'hooks/viewLog';

const useTrace = experienceId => {
// Send view to backend
const viewExperiences = useViewExperiences();
useEffect(() => {
const contentIds = [experienceId];
const referrer = window.location.href;
viewExperiences({ contentIds, referrer });
}, [experienceId, viewExperiences]);
};

const useTrace = experienceId => {
// Send view to backend
useView(experienceId);

// send Facebook Pixel 'ViewContent' event
useEffect(() => {
Expand Down
12 changes: 6 additions & 6 deletions src/components/ExperienceSearch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import Pagination from 'common/Pagination';
import { pathnameSelector, querySelector } from 'common/routing/selectors';
import getScale from 'utils/numberUtils';
import { formatTitle, formatCanonicalPath } from 'utils/helmetHelper';
import { fetchExperiences as fetchExperiencesAction } from '../../actions/experienceSearch';
import { IMG_HOST, SITE_NAME } from '../../constants/helmetData';
import PIXEL_CONTENT_CATEGORY from '../../constants/pixelConstants';
import { PAGE_COUNT } from '../../constants/experienceSearch';
import status from '../../constants/status';
import { GA_CATEGORY, GA_ACTION } from '../../constants/gaConstants';
import { fetchExperiences as fetchExperiencesAction } from 'actions/experienceSearch';
import { IMG_HOST, SITE_NAME } from 'constants/helmetData';
import PIXEL_CONTENT_CATEGORY from 'constants/pixelConstants';
import { PAGE_COUNT } from 'constants/experienceSearch';
import status from 'constants/status';
import { GA_CATEGORY, GA_ACTION } from 'constants/gaConstants';
import styles from './ExperienceSearch.module.css';
import Searchbar from './Searchbar';
import ExperienceBlock from './ExperienceBlock';
Expand Down
4 changes: 2 additions & 2 deletions src/components/JobTitle/JobTitleIndexProvider.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import CompanyAndJobTitleIndexPage from '../CompanyAndJobTitle/IndexPage';
import { pageType } from '../../constants/companyJobTitle';
import { fetchJobTitles } from '../../actions/jobTitle';
import { pageType } from 'constants/companyJobTitle';
import { fetchJobTitles } from 'actions/jobTitle';
import {
jobTitlesStatus as jobTitlesStatusSelector,
jobTitles as jobTitlesSelector,
Expand Down
8 changes: 4 additions & 4 deletions src/components/JobTitle/JobTitlePageProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import Overview from '../CompanyAndJobTitle/Overview';
import InterviewExperiences from '../CompanyAndJobTitle/InterviewExperiences';
import WorkExperiences from '../CompanyAndJobTitle/WorkExperiences';
import CompanyJobTitleTimeAndSalary from '../CompanyAndJobTitle/TimeAndSalary';
import NotFound from '../common/NotFound';
import NotFound from 'common/NotFound';
import { withPermission } from 'common/permission-context';

import { tabType, pageType } from '../../constants/companyJobTitle';
import jobTitleActions from '../../actions/jobTitle';
import { tabType, pageType } from 'constants/companyJobTitle';
import jobTitleActions from 'actions/jobTitle';
import {
interviewExperiences,
workExperiences,
Expand All @@ -25,7 +25,7 @@ import {
overtimeFrequencyCount,
status,
jobTitle as jobTitleSelector,
} from '../../selectors/companyAndJobTitle';
} from 'selectors/companyAndJobTitle';
import { paramsSelector } from 'common/routing/selectors';
import withRouteParameter from '../ExperienceSearch/withRouteParameter';

Expand Down
4 changes: 2 additions & 2 deletions src/components/LaborRightsMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Columns from 'common/Columns';
import { Section, Wrapper, Heading } from 'common/base';
import FanPageBlock from 'common/FanPageBlock';
import { useShareLink } from 'hooks/experiments';
import { queryMenu } from '../../actions/laborRights';
import { isFetching, isError, isFetched } from '../../constants/status';
import { queryMenu } from 'actions/laborRights';
import { isFetching, isError, isFetched } from 'constants/status';
import LaborRightsEntry from './LaborRightsEntry';
import StaticHelmet from 'common/StaticHelmet';
import styles from './LaborRightsEntry.module.css';
Expand Down
2 changes: 1 addition & 1 deletion src/components/LaborRightsSingle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
queryEntry,
queryMenuIfUnfetched,
queryEntryIfUnfetched,
} from '../../actions/laborRights';
} from 'actions/laborRights';
import useEntry, { useNeighborEntry } from './useEntry';
import useTracking from './useTracking';
import Body from './Body';
Expand Down
4 changes: 2 additions & 2 deletions src/components/LandingPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { compose, setStatic, lifecycle } from 'recompose';
import { Section, Wrapper, Heading } from 'common/base';
import Columns from 'common/Columns';
import ExperienceBlock from '../ExperienceSearch/ExperienceBlock';
import { queryPopularExperiences } from '../../actions/popularExperiences';
import { queryMenu } from '../../actions/laborRights';
import { queryPopularExperiences } from 'actions/popularExperiences';
import { queryMenu } from 'actions/laborRights';
import LaborRightsEntry from '../LaborRightsMenu/LaborRightsEntry';
import Banner from './Banner';
import StaticHelmet from 'common/StaticHelmet';
Expand Down
2 changes: 1 addition & 1 deletion src/components/PlanPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { isUnfetched, isFetched } from 'utils/fetchBox';
import Loading from 'common/Loader';
import { subscriptionType } from 'constants/subscription';

import { fetchSubscriptionPlans } from '../../actions/payment';
import { fetchSubscriptionPlans } from 'actions/payment';
import styles from './PlanPage.module.css';
import CardSection from './CardSection';

Expand Down
Loading

0 comments on commit d5e8ff2

Please sign in to comment.