1- import { Avatar , Button , Tag } from "antd"
2- import moment from "moment"
31import { useEffect } from "react"
42import { shallowEqual } from "react-redux"
53import { Helmet } from "react-helmet"
4+ import { Button , Tag , Descriptions , Input } from "antd"
65
76import { useAppSelector , useAppDispatch } from "../redux/hooks"
8- import { fetchMe , fetchRateLimit , checkSlack } from "../redux/settings"
7+ import { fetchMe , checkSlack } from "../redux/settings"
98
109import Main from "./Main"
1110
1211export default function Settings ( ) : JSX . Element {
13- const { user, rateLimit , isSlackEnabled } = useAppSelector ( state => state . settings , shallowEqual )
12+ const { user, isSlackEnabled } = useAppSelector ( state => state . settings , shallowEqual )
1413 const dispatch = useAppDispatch ( )
1514
1615 useEffect ( ( ) => {
1716 dispatch ( fetchMe ( ) )
18- dispatch ( fetchRateLimit ( ) )
1917 dispatch ( checkSlack ( ) )
2018 } , [ dispatch ] )
2119
@@ -27,30 +25,33 @@ export default function Settings(): JSX.Element {
2725 < Helmet >
2826 < title > Settings</ title >
2927 </ Helmet >
30- < div >
31- < h1 > Settings </ h1 >
32- </ div >
33- < div style = { { marginTop : "40px" } } >
34- < h2 > User </ h2 >
35- < p >
36- Login: < Avatar src = { user ?. avatar } /> < b > { user ?. login } </ b >
37- </ p >
38- < p >
39- Role: { ( user ?. admin ) ? < Tag color = "purple" > Admin </ Tag > : < Tag color = "purple" > Member </ Tag > }
40- </ p >
41- </ div >
42- < div style = { { marginTop : "40px" } } >
43- < h2 > Rate Limit </ h2 >
44- < p > Limit: { rateLimit ?. limit } </ p >
45- < p > Remaining: { rateLimit ?. remaining } </ p >
46- < p > Reset: { moment ( rateLimit ?. reset ) . fromNow ( ) } </ p >
47- </ div >
28+ < h1 > Settings </ h1 >
29+ < Descriptions title = "User Info" column = { 2 } style = { { marginTop : "40px" } } layout = "vertical" >
30+ < Descriptions . Item label = "Login" > { user ?. login } </ Descriptions . Item >
31+ < Descriptions . Item label = "Role" >
32+ { ( user ?. admin ) ?
33+ < Tag color = "purple" > Admin </ Tag >
34+ :
35+ < Tag color = "purple" > Member </ Tag > }
36+ </ Descriptions . Item >
37+ < Descriptions . Item label = "Token" >
38+ < Input . Password
39+ value = { user ?. hash }
40+ style = { { width : 200 , padding : 0 } }
41+ readOnly
42+ bordered = { false }
43+ / >
44+ </ Descriptions . Item >
45+ </ Descriptions >
4846 { ( isSlackEnabled ) ?
4947 < div style = { { marginTop : "40px" , marginBottom : "20px" } } >
50- < h2 > Slack</ h2 >
51- { ( connected ) ?
52- < Button href = "/slack/signout" type = "primary" danger > DISCONNECTED</ Button > :
53- < Button href = "/slack/" type = "primary" > CONNECT</ Button > }
48+ < Descriptions title = "Slack" >
49+ < Descriptions . Item >
50+ { ( connected ) ?
51+ < Button href = "/slack/signout" type = "primary" danger > DISCONNECTED</ Button > :
52+ < Button href = "/slack/" type = "primary" > CONNECT</ Button > }
53+ </ Descriptions . Item >
54+ </ Descriptions >
5455 </ div > :
5556 null }
5657 </ Main >
0 commit comments