Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into google-login-new-…
Browse files Browse the repository at this point in the history
…version
  • Loading branch information
mark86092 committed Sep 12, 2023
2 parents 242cb1f + 16ef498 commit b2f83b4
Show file tree
Hide file tree
Showing 71 changed files with 745 additions and 819 deletions.
1 change: 0 additions & 1 deletion .github/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ services:
- RAZZLE_GA_MEASUREMENT_ID=G-CYK1FN5G9P
- RAZZLE_GTM_ID=GTM-KVZ7DZQ
- RAZZLE_GOOGLE_APP_ID=879657963776-d8j1hq8dk38alp456ncvnq6mqh4f6bua.apps.googleusercontent.com
- RAZZLE_AMPLITUDE_API_KEY=d0b279a29601ca776f6557710220b79a
- RAZZLE_ENVIRONMENT=dev
- RAZZLE_TAP_PAY_APP_ID=125271
- RAZZLE_TAP_PAY_APP_KEY=app_WBWcR9mkiSMUQ3qZV5tUidkq7vfamUzmdWi5QR33ksT6ttbiZ9BJxbz5Fvma
Expand Down
18 changes: 0 additions & 18 deletions .github/docker-compose-dev2.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/docker-compose-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ services:
- RAZZLE_PIXEL_ID=603414113402034
- RAZZLE_GTM_ID=GTM-54PH93D
- RAZZLE_GOOGLE_APP_ID=879657963776-nb0kdpkb5sfdf0285ov9o353dnt0l5iq.apps.googleusercontent.com
- RAZZLE_AMPLITUDE_API_KEY=4d69f09de855a21f8790bf0f42c47cda
- RAZZLE_ENVIRONMENT=production
- RAZZLE_TAP_PAY_APP_ID=125271
- RAZZLE_TAP_PAY_APP_KEY=app_WBWcR9mkiSMUQ3qZV5tUidkq7vfamUzmdWi5QR33ksT6ttbiZ9BJxbz5Fvma
Expand Down
1 change: 0 additions & 1 deletion .github/docker-compose-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ services:
- RAZZLE_GA_MEASUREMENT_ID=G-CYK1FN5G9P
- RAZZLE_GTM_ID=GTM-KVZ7DZQ
- RAZZLE_GOOGLE_APP_ID=879657963776-nb0kdpkb5sfdf0285ov9o353dnt0l5iq.apps.googleusercontent.com
- RAZZLE_AMPLITUDE_API_KEY=d0b279a29601ca776f6557710220b79a
- RAZZLE_ENVIRONMENT=stage
3 changes: 0 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ jobs:
- run: docker-compose -f .github/docker-compose-dev.yml build
- run: docker tag ${IMAGE} ${REGISTRY}/${REPO}:dev
- run: docker push ${REGISTRY}/${REPO}:dev
- run: docker-compose -f .github/docker-compose-dev2.yml build
- run: docker tag ${IMAGE} ${REGISTRY}/${REPO}:dev2
- run: docker push ${REGISTRY}/${REPO}:dev2
deploy-stage:
if: github.repository == 'goodjoblife/GoodJobShare' && github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
Expand Down
2 changes: 0 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ ARG RAZZLE_GA_MEASUREMENT_ID
ARG RAZZLE_GTM_ID
ARG RAZZLE_PIXEL_ID
ARG RAZZLE_GOOGLE_APP_ID
ARG RAZZLE_AMPLITUDE_API_KEY
ARG RAZZLE_ENVIRONMENT
ARG RAZZLE_TAP_PAY_APP_ID
ARG RAZZLE_TAP_PAY_APP_KEY
Expand All @@ -22,7 +21,6 @@ ENV RAZZLE_API_HOST="${RAZZLE_API_HOST}" \
RAZZLE_GTM_ID="$RAZZLE_GTM_ID" \
RAZZLE_PIXEL_ID="$RAZZLE_PIXEL_ID" \
RAZZLE_GOOGLE_APP_ID="$RAZZLE_GOOGLE_APP_ID" \
RAZZLE_AMPLITUDE_API_KEY="$RAZZLE_AMPLITUDE_API_KEY" \
RAZZLE_ENVIRONMENT="$RAZZLE_ENVIRONMENT" \
RAZZLE_TAP_PAY_APP_ID="$RAZZLE_TAP_PAY_APP_ID" \
RAZZLE_TAP_PAY_APP_KEY="$RAZZLE_TAP_PAY_APP_KEY" \
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"airbnb-prop-types": "^2.15.0",
"classnames": "^2.2.5",
"date-fns": "^2.30.0",
"express": "^4.16.3",
"express": "^4.17.3",
"history": "^4.7.2",
"immutable": "^3.8.1",
"isomorphic-fetch": "^2.2.1",
Expand All @@ -72,7 +72,7 @@
"postcss-nested": "^3.0.0",
"postcss-simple-vars": "^4.1.0",
"prop-types": "^15.6.0",
"qs": "^6.4.0",
"qs": "^6.7.3",
"ramda": "^0.23.0",
"razzle": "^2.4.0",
"react": "^16.12.0",
Expand Down
5 changes: 0 additions & 5 deletions src/actions/auth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ReactGA from 'react-ga4';
import authStatus from '../constants/authStatus';
import { UserTracker } from '../utils/eventBasedTracking';

export const SET_LOGIN = '@@auth/SET_LOGIN';
export const SET_USER = '@@auth/SET_USER';
Expand All @@ -24,8 +23,6 @@ const logOutAction = () => ({
export const logout = () => (dispatch, getState, { history }) => {
dispatch(logOutAction());
history.push('/');
// reset user for Amplitude
UserTracker.resetUser();
};

/**
Expand Down Expand Up @@ -94,8 +91,6 @@ export const loginWithToken = token => (dispatch, getState, { api }) => {
.then(user => {
dispatch(setUser(user));
dispatch(setLogin(authStatus.CONNECTED, token));
// identify user for Amplitude
UserTracker.identifyUser(user._id);
// identify user for Google Analytics
ReactGA.set({ userId: user._id });
})
Expand Down
132 changes: 132 additions & 0 deletions src/actions/experience.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import { concat } from 'ramda';
import { getError, getFetched, toFetching, isFetching } from 'utils/fetchBox';
import { relatedExperiencesStateSelector } from 'selectors/experienceSelector';

export const SET_RELATED_EXPERIENCES = '@@EXPERIENCE/SET_RELATED_EXPERIENCES';

const setRelatedExperiencesState = relatedExperiencesState => ({
type: SET_RELATED_EXPERIENCES,
relatedExperiencesState,
});

export const queryRelatedExperiencesOnExperience = experienceId => async (
dispatch,
getState,
{ api },
) => {
const page = 0;

dispatch(
setRelatedExperiencesState(
// this is an work around
toFetching({
data: {
experienceId,
page,
relatedExperiences: [],
hasMore: false,
},
}),
),
);

try {
const relatedExperiences = await api.experiences.queryRelatedExperiences({
id: experienceId,
start: page * 5,
limit: 5,
});

const previousState = relatedExperiencesStateSelector(getState()); // FetchBox

if (
experienceId === previousState.data.experienceId &&
page === previousState.data.page
) {
const hasMore = relatedExperiences.length < 5 ? false : true;

dispatch(
setRelatedExperiencesState(
getFetched({
experienceId,
page,
relatedExperiences,
hasMore,
}),
),
);
}
} catch (error) {
dispatch(setRelatedExperiencesState(getError(error)));
}
};

export const loadMoreRelatedExperiences = () => async (
dispatch,
getState,
{ api },
) => {
const state = relatedExperiencesStateSelector(getState()); // FetchBox

// 判斷 isFetching
if (isFetching(state)) {
return;
}

const experienceId = state.data.experienceId;
const page = state.data.page + 1;

dispatch(
setRelatedExperiencesState(
// this is an work around
toFetching({
data: {
experienceId,
page,
relatedExperiences: state.data.relatedExperiences,
hasMore: false,
},
}),
),
);

try {
const relatedExperiences = await api.experiences.queryRelatedExperiences({
id: experienceId,
start: page * 5,
limit: 5,
});

const previousState = relatedExperiencesStateSelector(getState()); // FetchBox

if (
experienceId === previousState.data.experienceId &&
page === previousState.data.page
) {
const hasMore = relatedExperiences.length < 5 ? false : true;

dispatch(
setRelatedExperiencesState(
getFetched({
experienceId,
page,
relatedExperiences: concat(
previousState.data.relatedExperiences,
relatedExperiences,
),
hasMore,
}),
),
);
}
} catch (error) {
const previousState = relatedExperiencesStateSelector(getState()); // FetchBox

if (
experienceId === previousState.data.experienceId &&
page === previousState.data.page
) {
dispatch(setRelatedExperiencesState(getError(error)));
}
}
};
14 changes: 13 additions & 1 deletion src/apis/experiencesApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import R from 'ramda';
import fetchUtil from 'utils/fetchUtil';

import graphqlClient from 'utils/graphqlClient';
import { getExperienceQuery } from 'graphql/experience';
import {
getExperienceQuery,
queryRelatedExperiencesGql,
} from 'graphql/experience';
import { getPopularExperiencesQuery } from 'graphql/popularExperience';
import { deleteReplyLike, createReplyLike } from 'graphql/reply';

Expand Down Expand Up @@ -120,6 +123,14 @@ const patchExperience = ({ id, status, token }) =>
token,
});

export const queryRelatedExperiences = async ({ id, start, limit }) => {
const data = await graphqlClient({
query: queryRelatedExperiencesGql,
variables: { id, start, limit },
});
return data.experience.relatedExperiences;
};

export default {
getExperience,
getPopularExperiences,
Expand All @@ -134,4 +145,5 @@ export default {
newExperienceSearchBy,
patchExperience,
patchReply,
queryRelatedExperiences,
};
8 changes: 8 additions & 0 deletions src/apis/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
checkoutSubscriptionWithPrimeMutation,
paymentRecord,
myCurrentSubscription as myCurrentSubscriptionQuery,
mySubscriptions as mySubscriptionsQuery,
} from 'graphql/payment';

const getSubscriptionPlans = () =>
Expand Down Expand Up @@ -54,9 +55,16 @@ const getMyCurrentSubscription = token => () =>
token,
}).then(({ myCurrentSubscription }) => myCurrentSubscription);

const getMySubscriptions = token => () =>
graphqlClient({
query: mySubscriptionsQuery,
token,
}).then(({ mySubscriptions }) => mySubscriptions);

export default {
checkoutSubscriptionWithPrime,
getSubscriptionPlans,
getPaymentRecord,
getMyCurrentSubscription,
getMySubscriptions,
};
2 changes: 1 addition & 1 deletion src/components/App/Footer/Footer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}

.logo {
fill: #fff;
filter: invert(1);
width: 120px;
margin-right: 8px;
}
Expand Down
16 changes: 6 additions & 10 deletions src/components/App/Footer/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react';
import { Link } from 'react-router-dom';
import cn from 'classnames';
import i from 'common/icons';
import GjLogo from 'common/icons/GjLogo.svg';
import { Wrapper, P } from 'common/base';
import LinkItem from './LinkItem';
import styles from './Footer.module.css';
import MediasImg from './medias.jpg';
import LogoG0vImg from './logo-g0v-white.svg';

const link1 = [
{ to: '/salary-work-times/latest', text: '薪資工時' },
Expand All @@ -29,7 +31,7 @@ const Footer = () => (
<footer className={styles.wrapper}>
<section className={styles.header}>
<Wrapper size="l" className={styles.inner}>
<i.GjLogo className={styles.logo} />
<img src={GjLogo} className={styles.logo} alt="GoodJob" />
<h1 className={styles.heading}>職場透明化運動</h1>
<h5 className={styles.subheading}>
—— 共享薪水、面試情報,求職不再面議!
Expand All @@ -54,10 +56,7 @@ const Footer = () => (
<section className={styles.medias}>
<h4 className={styles.heading}>\ 感謝各大媒體採訪報導 /</h4>
<Link to="/about">
<img
src="https://image.goodjob.life/medias.jpg"
alt="cheers yahoo 蘋果日報 數位時代"
/>
<img src={MediasImg} alt="cheers yahoo 蘋果日報 數位時代" />
</Link>
</section>
</Wrapper>
Expand All @@ -66,10 +65,7 @@ const Footer = () => (
<P size="s">Copyright © GoodJob.life team 2019</P>
<div className={styles.g0v}>
<a href="https://grants.g0v.tw/power/" alt="power by g0v">
<img
src="https://image.goodjob.life/logo-g0v-white.svg"
alt="g0v"
/>
<img src={LogoG0vImg} alt="g0v" />
</a>
</div>
</Wrapper>
Expand Down
Loading

0 comments on commit b2f83b4

Please sign in to comment.