Skip to content

Commit

Permalink
Merge pull request #103 from PoolC/pre-release
Browse files Browse the repository at this point in the history
신입 지원 배너 추가 및 travis.yml 변경
  • Loading branch information
mingd1023 authored Jul 2, 2021
2 parents dcd36ab + ea06847 commit 9332f5d
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ script:

after_success:
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- if [ -n "${TRAVIS_TAG}" ]; then
- if [ "${TRAVIS_BRANCH}" == "pre-release" ]; then
docker build -t poolchm/haribo:pre-release .;
docker push poolchm/haribo:pre-release;
elif [ -n "${TRAVIS_TAG}" ]; then
docker build -t poolchm/haribo:${TRAVIS_TAG} .;
docker push poolchm/haribo:${TRAVIS_TAG};
else
Expand Down
51 changes: 51 additions & 0 deletions src/components/home/ApplyBanner/ApplyBanner.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react';
import styled from 'styled-components';
import { MENU } from '../../../constants/menus';
import colors from '../../../lib/styles/colors';
import { withRouter } from 'react-router-dom';

const BannerBlock = styled.div`
display: flex;
justify-content: center;
align-items: center;
width: 95vw;
max-width: 1366px;
margin: 0px 0 10px 0;
`;

export const Banner = styled.div`
cursor: pointer;
display: flex;
color: white;
font-size: 0.9rem;
font-weight: 600;
justify-content: center;
align-items: center;
width: 95%;
border-radius: 10px;
box-shadow: ${colors.gray[1]};
height: 60px;
background-color: ${colors.mint[2]};
transition: 0.3s;
&:hover {
transition: 0.3s;
opacity: 0.75;
//background-color: ${colors.mint[1]};
}
`;

const ApplyBanner = ({ history }) => {
const redirectToApplyPage = () => {
history.push(`/${MENU.APPLY}`);
};
return (
<BannerBlock>
{/* eslint-disable-next-line jsx-a11y/accessible-emoji */}
<Banner onClick={redirectToApplyPage}>
PoolC 신입회원 지원하러 가기 ✨
</Banner>
</BannerBlock>
);
};

export default withRouter(ApplyBanner);
41 changes: 41 additions & 0 deletions src/containers/home/ApplyBannerContainer/ApplyBannerContainer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React, { useState, useEffect } from 'react';
import * as infoAPI from '../../../lib/api/info';
import Spinner from '../../../components/common/Spinner/Spinner';
import ApplyBanner from '../../../components/home/ApplyBanner/ApplyBanner';
import { useSelector } from 'react-redux';

const ApplyBannerContainer = () => {
const [loading, setLoading] = useState(true);
const [isSubscriptionPeriod, setIsSubscriptionPeriod] = useState(null);
const [applyUri, setApplyUri] = useState(null);
const member = useSelector((state) => state.auth);
const isLogin = member.status.isLogin;
const role = member.user.role;

useEffect(() => {
infoAPI.getPoolCInfo().then((res) => {
if (res.status === 200) {
setIsSubscriptionPeriod(res.data.isSubscriptionPeriod);
setApplyUri(res.data.applyUri);
setLoading(false);
}
});
});

if (
isSubscriptionPeriod == null ||
(isSubscriptionPeriod === true && applyUri == null) ||
isSubscriptionPeriod === false ||
(isLogin && role !== 'UNACCEPTED')
)
return null;

return (
<>
{loading && <Spinner />}
{!loading && <ApplyBanner />}
</>
);
};

export default ApplyBannerContainer;
3 changes: 3 additions & 0 deletions src/modules/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const initialState = {
name: '',
password: '',
isAdmin: false,
role: null,
},
};

Expand Down Expand Up @@ -177,6 +178,7 @@ const auth = handleActions(
memberId: data.loginID,
isAdmin: data.isAdmin,
name: data.name,
role: data.role,
},
};
},
Expand All @@ -198,6 +200,7 @@ const auth = handleActions(
password: '',
name: '',
isAdmin: false,
role: null,
},
}),
},
Expand Down
2 changes: 2 additions & 0 deletions src/pages/home/HomePage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import styled from 'styled-components';
import ApplyBannerContainer from '../../containers/home/ApplyBannerContainer/ApplyBannerContainer';
import CarouselContainer from '../../containers/home/CarouselContainer/CarouselContainer';
import RecentNoticeContainer from '../../containers/home/RecentNoticeContainer/RecentNoticeContainer';
import RecentProjectContainer from '../../containers/home/RecentProjectContainer/RecentProjectContainer';
Expand All @@ -15,6 +16,7 @@ const HomePage = () => {
return (
<HomePageBlock>
<CarouselContainer />
<ApplyBannerContainer />
<RecentNoticeContainer />
<RecentProjectContainer />
</HomePageBlock>
Expand Down

0 comments on commit 9332f5d

Please sign in to comment.