Toggle navigation
Toggle navigation
This project
Loading...
Sign in
정나리
/
Jaksimsamil
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
송용우
2020-06-23 13:15:13 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
93ed9711c4726a9b90503c361a6a9bdadbfa15bb
93ed9711
1 parent
59d30c0f
Update Home Layout
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
14 deletions
jaksimsamil-page/src/components/setting/BJIDForm.js
jaksimsamil-page/src/containers/home/HomeContainer.js
jaksimsamil-page/src/lib/util/analyzeBJ.js
jaksimsamil-page/src/lib/util/sendSlack.js
jaksimsamil-server/package-lock.json
jaksimsamil-server/package.json
jaksimsamil-page/src/components/setting/BJIDForm.js
View file @
93ed971
...
...
@@ -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"
>
...
...
jaksimsamil-page/src/containers/home/HomeContainer.js
View file @
93ed971
...
...
@@ -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
(()
=>
{
if
(
user
)
{
analyzeBJ
(
profile
.
solvedBJ
);
},
[
profile
.
solvedBJ
]);
useEffect
(()
=>
{
setLogin
(
true
);
if
(
user
)
{
let
username
=
user
.
username
;
dispatch
(
getPROFILE
({
username
}));
}
});
}
,
[
dispatch
,
user
]
);
return
<
HomeForm
/>
;
};
export
default
withRouter
(
HomeContainer
);
...
...
jaksimsamil-page/src/lib/util/analyzeBJ.js
View file @
93ed971
...
...
@@ -5,5 +5,15 @@
4. 추천 문제
*/
exports
.
analyzeBJ
=
function
(
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
);
}
};
...
...
jaksimsamil-page/src/lib/util/sendSlack.js
0 → 100644
View file @
93ed971
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
(
'안녕'
);
jaksimsamil-server/package-lock.json
View file @
93ed971
This diff is collapsed. Click to expand it.
jaksimsamil-server/package.json
View file @
93ed971
...
...
@@ -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"
:
{
...
...
Please
register
or
login
to post a comment