Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Merge pull request #28 from koreanbots/beta
Browse files Browse the repository at this point in the history
  • Loading branch information
wonderlandpark authored Aug 2, 2020
2 parents 3d211e8 + dfe58ba commit a67d3c4
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 20 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
on:
- push
- pull_request
pull_request:
push:
branches:
- master
- beta
jobs:
build:
name: Test Build
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"react-syntax-highlighter": "^12.2.1",
"react-with-important-style": "^0.2.2",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.88.2",
"semantic-ui-react": "^1.1.0",
"sha.js": "^2.4.11",
"typed.js": "^2.0.11"
},
Expand All @@ -45,6 +45,6 @@
]
},
"devDependencies": {
"react-git-info": "^1.1.0"
"react-git-info": "^2.0.0"
}
}
26 changes: 15 additions & 11 deletions src/routes/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ class Home extends React.Component {
<path fill="#7289DA" fill-opacity="1" d="M0,128L60,106.7C120,85,240,43,360,69.3C480,96,600,192,720,192C840,192,960,96,1080,69.3C1200,43,1320,85,1380,106.7L1440,128L1440,0L1380,0C1320,0,1200,0,1080,0C960,0,840,0,720,0C600,0,480,0,360,0C240,0,120,0,60,0L0,0Z"></path>
</svg>
<Container>
{this.state.message ? (
<Message
header={this.state.message.title}
onDismiss={this.handleDismiss}
className={this.state.message.level}
content={this.state.message.message}
/>
) : (
''
)}
{
ads.top && ( <a href={ads.top.link}>
<div class="ui fluid image">
Expand All @@ -154,17 +164,6 @@ class Home extends React.Component {
content="국내 디스코드봇들을 확인하고, 초대해보세요!"
/>
</Helmet>
{this.state.message ? (
<Message
header={this.state.message.title}
onDismiss={this.handleDismiss}
className={this.state.message.level}
content={this.state.message.message}
/>
) : (
''
)}

<h3 style={{ marginTop: '30px'}}>카테고리로 빠르게 찾아보기: </h3>
{cats.map(r => (
<>
Expand Down Expand Up @@ -412,6 +411,11 @@ const messages = {
level: 'success',
title: '봇 신고 성공!',
message: '신고 내용이 관리자에게 전달되었습니다.'
},
delete: {
level: 'success',
title: '봇 삭제 성공!',
message: '봇이 삭제처리되셨습니다.'
}
}

Expand Down
37 changes: 32 additions & 5 deletions src/routes/ManageBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
Image,
Button,
Popup,
Table
Table,
Modal
} from 'semantic-ui-react'
import Redirect from '../components/Redirect'
import ReactMarkdown from 'react-markdown/with-html'
Expand All @@ -36,6 +37,7 @@ class ManageBot extends Component {
token: '',
owners: '',
ownersError: '',
delete: '',
info: { code: 0 },
data: { state: 0, data: {} }
}
Expand Down Expand Up @@ -144,6 +146,21 @@ class ManageBot extends Component {
else window.location.reload()
})
}

removeBot = async() => {
const token = localStorage.token,
id = localStorage.id,
date = localStorage.date
await fetch(config.api + '/bots/' + this.state.info.data.id, {
method: 'DELETE',
headers: { token, id, time: date }
})
.then(r => r.json())
.then(res => {
if (res.code !== 200) alert(res.message)
else window.location.href = '/?message=delete'
})
}
async componentDidMount() {
const res = await fetch(
config.api + '/bots/completeInfo/' + this.props.match.params.id,
Expand Down Expand Up @@ -450,10 +467,20 @@ class ManageBot extends Component {

<h3>봇을 삭제합니다</h3>
<p>봇을 영구적으로 삭제합니다.</p>
<Popup
content="해당 기능은 사용하실 수 없습니다. 관리자에게 문의해주세요"
trigger={<Button color="red" content="삭제하기" icon="trash" />}
/>
<Modal className={localStorage.dark === 'true' ? 'darkmode' : 'lightmode'} trigger={<Button color="red" content="삭제하기" icon="trash" />} closeIcon>
<Modal.Header>
{bot.name} 삭제하기
</Modal.Header>
<Modal.Description>
<Container style={{ padding: '10px'}}>
<p>봇을 삭제하시려면 <strong>{bot.name}</strong> 을 입력해주세요.</p>
<Input name="delete" onChange={this.handleChange} value={this.state.delete} placeholder="봇 이름을 입력해주세요." />
<br/><br/>
봇을 삭제하시게되면 다시는 복구하실 수 없다는 점을 동의합니다.<br/>
<Button color="red" content="삭제하기" icon="trash" disabled={this.state.delete !== bot.name} onClick={this.removeBot}/>
</Container>
</Modal.Description>
</Modal>
</Segment>
</Container>
)
Expand Down

0 comments on commit a67d3c4

Please sign in to comment.