송용우

Update Home Layout

......@@ -4,15 +4,6 @@ import styled from 'styled-components';
import palette from '../../lib/styles/palette';
import Button from '@material-ui/core/Button';
import TextField from '@material-ui/core/TextField';
const BJIDFormBlock = styled.div`
width: 100%;
padding-top: 2rem;
h4 {
color: ${palette.gray[8]};
margin-top: 0;
margin-bottom: 0.5rem;
}
`;
const useStyles = makeStyles((theme) => ({
root: {
......@@ -32,7 +23,6 @@ const BJIDForm = ({ onChange, onBJIDSubmit, profile, onSyncBJIDSubmit }) => {
onChange={onChange}
value={profile.userBJID}
placeholder="백준 아이디"
id="standard-basic"
label="백준 아이디"
/>
<Button variant="outlined" type="submit">
......
......@@ -2,19 +2,25 @@ import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { withRouter } from 'react-router-dom';
import HomeForm from '../../components/home/HomeForm';
const HomeContainer = ({ histroy }) => {
import { getPROFILE } from '../../modules/profile';
import { analyzeBJ } from '../../lib/util/analyzeBJ';
const HomeContainer = ({ history }) => {
const dispatch = useDispatch();
const [isLogin, setLogin] = useState(false);
const { user, profile } = useSelector(({ user, profile }) => ({
user: user.user,
profile: profile,
}));
useEffect(() => {
analyzeBJ(profile.solvedBJ);
}, [profile.solvedBJ]);
useEffect(() => {
setLogin(true);
if (user) {
setLogin(true);
let username = user.username;
dispatch(getPROFILE({ username }));
}
});
}, [dispatch, user]);
return <HomeForm />;
};
export default withRouter(HomeContainer);
......
......@@ -5,5 +5,15 @@
4. 추천 문제
*/
exports.analyzeBJ = function (solvedBJ) {
console.log(solvedBJ);
console.log(typeof solvedBJ);
if (solvedBJ) {
solvedBJ.sort(function (a, b) {
return a.solvedDate > b.solvedDate
? -1
: a.solvedDate < b.solvedDate
? 1
: 0;
});
console.log(solvedBJ);
}
};
......
const webhookUri =
'https://hooks.slack.com/services/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';
const slack = new Slack();
slack.setWebhook(webhookUri);
const send = async (message) => {
slack.webhook(
{
channel: '#general', // 전송될 슬랙 채널
username: 'webhookbot', //슬랙에 표시될 이름
text: message,
},
function (err, response) {
console.log(response);
},
);
};
send('안녕');
This diff is collapsed. Click to expand it.
......@@ -22,6 +22,7 @@
"mongoose": "^5.9.17",
"morgan": "^1.10.0",
"path": "^0.12.7",
"slack-node": "^0.1.8",
"voca": "^1.4.0"
},
"devDependencies": {
......