-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3599 from weseek/feat/5569-without-proxy-accordion
Added accordion for Without Proxy section
- Loading branch information
Showing
5 changed files
with
146 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
src/client/js/components/Admin/SlackIntegration/CustomBotWithoutProxySettingsAccordion.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import React, { useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Collapse } from 'reactstrap'; | ||
|
||
const CustomBotWithoutSettingsAccordion = () => { | ||
const { t } = useTranslation('admin'); | ||
const [openAccordionIndexes, setOpenAccordionIndexes] = useState(new Set()); | ||
|
||
const onToggleAccordionHandler = (i) => { | ||
const accordionIndexes = new Set(openAccordionIndexes); | ||
if (accordionIndexes.has(i)) { | ||
accordionIndexes.delete(i); | ||
} | ||
else { | ||
accordionIndexes.add(i); | ||
} | ||
setOpenAccordionIndexes(accordionIndexes); | ||
}; | ||
|
||
return ( | ||
<div className="card border-0 rounded-lg shadow overflow-hidden"> | ||
|
||
<div className="card border-0 rounded-lg mb-0"> | ||
<div | ||
className="card-header font-weight-normal py-3 d-flex justify-content-between" | ||
role="button" | ||
onClick={() => onToggleAccordionHandler(0)} | ||
> | ||
<p className="mb-0 text-primary"><span className="mr-2">①</span>{t('slack_integration.without_proxy.create_bot')}</p> | ||
{openAccordionIndexes.has(0) | ||
? <i className="fa fa-chevron-up" /> | ||
: <i className="fa fa-chevron-down" /> | ||
} | ||
</div> | ||
<Collapse isOpen={openAccordionIndexes.has(0)}> | ||
<div className="card-body"> | ||
|
||
<div className="row my-5"> | ||
<div className="mx-auto"> | ||
<div> | ||
<button type="button" className="btn btn-primary text-nowrap mx-1" onClick={() => window.open('https://api.slack.com/apps', '_blank')}> | ||
{t('slack_integration.without_proxy.create_bot')} | ||
<i className="fa fa-external-link ml-2" aria-hidden="true" /> | ||
</button> | ||
</div> | ||
{/* TODO: Insert DOCS link */} | ||
<a href="#"> | ||
<p className="text-center mt-1"> | ||
<small> | ||
{t('slack_integration.without_proxy.how_to_create_a_bot')} | ||
<i className="fa fa-external-link ml-2" aria-hidden="true" /> | ||
</small> | ||
</p> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</Collapse> | ||
</div> | ||
|
||
<div className="card border-0 rounded-lg mb-0"> | ||
<div | ||
className="card-header font-weight-normal py-3 d-flex justify-content-between" | ||
role="button" | ||
onClick={() => onToggleAccordionHandler(1)} | ||
> | ||
<p className="mb-0 text-primary"><span className="mr-2">②</span>{t('slack_integration.without_proxy.install_bot_to_slack')}</p> | ||
{openAccordionIndexes.has(1) | ||
? <i className="fa fa-chevron-up" /> | ||
: <i className="fa fa-chevron-down" /> | ||
} | ||
</div> | ||
<Collapse isOpen={openAccordionIndexes.has(1)}> | ||
<div className="card-body"> | ||
BODY2 | ||
</div> | ||
</Collapse> | ||
</div> | ||
|
||
<div className="card border-0 rounded-lg mb-0"> | ||
<div | ||
className="card-header font-weight-normal py-3 d-flex justify-content-between" | ||
role="button" | ||
onClick={() => onToggleAccordionHandler(2)} | ||
> | ||
<p className="mb-0 text-primary"><span className="mr-2">③</span>{t('slack_integration.without_proxy.register_secret_and_token')}</p> | ||
{openAccordionIndexes.has(2) | ||
? <i className="fa fa-chevron-up" /> | ||
: <i className="fa fa-chevron-down" /> | ||
} | ||
</div> | ||
<Collapse isOpen={openAccordionIndexes.has(2)}> | ||
<div className="card-body"> | ||
BODY 3 | ||
</div> | ||
</Collapse> | ||
</div> | ||
|
||
<div className="card border-0 rounded-lg mb-0"> | ||
<div | ||
className="card-header font-weight-normal py-3 d-flex justify-content-between" | ||
role="button" | ||
onClick={() => onToggleAccordionHandler(3)} | ||
> | ||
<p className="mb-0 text-primary"><span className="mr-2">④</span>{t('slack_integration.without_proxy.test_connection')}</p> | ||
{openAccordionIndexes.has(3) | ||
? <i className="fa fa-chevron-up" /> | ||
: <i className="fa fa-chevron-down" /> | ||
} | ||
</div> | ||
<Collapse isOpen={openAccordionIndexes.has(3)}> | ||
<div className="card-body"> | ||
BODY 4 | ||
</div> | ||
</Collapse> | ||
</div> | ||
|
||
</div> | ||
|
||
); | ||
|
||
}; | ||
|
||
|
||
export default CustomBotWithoutSettingsAccordion; |