|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
|
|
|
import { SlackbotType } from '@growi/slack';
|
|
|
import { useTranslation } from 'next-i18next';
|
|
|
-import Image from 'next/image';
|
|
|
+import PropTypes from 'prop-types';
|
|
|
|
|
|
const botDetails = {
|
|
|
officialBot: {
|
|
|
@@ -30,33 +30,25 @@ const botDetails = {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-type BotTypeCardProps = {
|
|
|
- isActive: boolean,
|
|
|
- botType: string,
|
|
|
- onBotTypeSelectHandler: (botType: SlackbotType) => void,
|
|
|
-};
|
|
|
-
|
|
|
-export const BotTypeCard = (props: BotTypeCardProps): JSX.Element => {
|
|
|
+const BotTypeCard = (props) => {
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
- const { isActive, botType, onBotTypeSelectHandler } = props;
|
|
|
-
|
|
|
- const isBotTypeOfficial = botType === SlackbotType.OFFICIAL;
|
|
|
+ const isBotTypeOfficial = props.botType === SlackbotType.OFFICIAL;
|
|
|
|
|
|
return (
|
|
|
<div
|
|
|
- className={`card admin-bot-card rounded border-radius-sm shadow ${isActive ? 'border-primary' : ''}`}
|
|
|
- onClick={() => onBotTypeSelectHandler(botDetails[botType].botType)}
|
|
|
+ className={`card admin-bot-card rounded border-radius-sm shadow ${props.isActive ? 'border-primary' : ''}`}
|
|
|
+ onClick={() => props.onBotTypeSelectHandler(botDetails[props.botType].botType)}
|
|
|
role="button"
|
|
|
- key={botType}
|
|
|
+ key={props.botType}
|
|
|
>
|
|
|
<div>
|
|
|
<h3 className={`card-header mb-0 py-3
|
|
|
${isBotTypeOfficial ? 'd-flex align-items-center justify-content-center' : 'text-center'}
|
|
|
- ${isActive ? 'bg-primary grw-botcard-title-active' : ''}`}
|
|
|
+ ${props.isActive ? 'bg-primary grw-botcard-title-active' : ''}`}
|
|
|
>
|
|
|
<span className="me-2">
|
|
|
- {t(`admin:slack_integration.selecting_bot_types.${botDetails[botType].botTypeCategory}`)}
|
|
|
+ {t(`admin:slack_integration.selecting_bot_types.${botDetails[props.botType].botTypeCategory}`)}
|
|
|
</span>
|
|
|
|
|
|
{/* A recommended badge is shown on official bot card, supplementary names are shown on Custom bot cards */}
|
|
|
@@ -67,48 +59,40 @@ export const BotTypeCard = (props: BotTypeCardProps): JSX.Element => {
|
|
|
</span>
|
|
|
) : (
|
|
|
<span className="supplementary-bot-name me-2">
|
|
|
- {t(`admin:slack_integration.selecting_bot_types.${botDetails[botType].supplementaryBotName}`)}
|
|
|
+ {t(`admin:slack_integration.selecting_bot_types.${botDetails[props.botType].supplementaryBotName}`)}
|
|
|
</span>
|
|
|
)}
|
|
|
|
|
|
- <i className={isActive ? 'grw-botcard-title-active' : ''} aria-hidden="true"></i>
|
|
|
+ <i className={props.isActive ? 'grw-botcard-title-active' : ''} aria-hidden="true"></i>
|
|
|
</h3>
|
|
|
</div>
|
|
|
<div className="card-body p-4">
|
|
|
<div className="card-text">
|
|
|
<div className="my-2">
|
|
|
- <Image
|
|
|
+ <img
|
|
|
className="bot-difficulty-icon d-block mx-auto mb-4"
|
|
|
- src={`/images/slack-integration/slackbot-difficulty-level-${botDetails[botType].setUp}.svg`}
|
|
|
- alt=""
|
|
|
- width={60}
|
|
|
- height={60}
|
|
|
+ src={`/images/slack-integration/slackbot-difficulty-level-${botDetails[props.botType].setUp}.svg`}
|
|
|
/>
|
|
|
- <div className="d-flex justify-content-between mb-3 align-items-center">
|
|
|
+ <div className="d-flex justify-content-between mb-3">
|
|
|
<span>{t('admin:slack_integration.selecting_bot_types.multiple_workspaces_integration')}</span>
|
|
|
- <Image
|
|
|
- className="bot-type-disc"
|
|
|
- src={`/images/slack-integration/${botDetails[botType].multiWSIntegration}.png`}
|
|
|
- alt=""
|
|
|
- width={20}
|
|
|
- height={20}
|
|
|
- />
|
|
|
+ <img className="bot-type-disc" src={`/images/slack-integration/${botDetails[props.botType].multiWSIntegration}.png`} alt="" />
|
|
|
</div>
|
|
|
- <div className="d-flex justify-content-between align-items-center">
|
|
|
+ <div className="d-flex justify-content-between">
|
|
|
<span>{t('admin:slack_integration.selecting_bot_types.security_control')}</span>
|
|
|
- <Image
|
|
|
- className="bot-type-disc"
|
|
|
- src={`/images/slack-integration/${botDetails[botType].securityControl}.png`}
|
|
|
- alt=""
|
|
|
- width={20}
|
|
|
- height={20}
|
|
|
- />
|
|
|
+ <img className="bot-type-disc" src={`/images/slack-integration/${botDetails[props.botType].securityControl}.png`} alt="" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
+BotTypeCard.propTypes = {
|
|
|
+ isActive: PropTypes.bool.isRequired,
|
|
|
+ botType: PropTypes.string.isRequired,
|
|
|
+ onBotTypeSelectHandler: PropTypes.func.isRequired,
|
|
|
};
|
|
|
|
|
|
-BotTypeCard.displayName = 'BotTypeCard';
|
|
|
+export default BotTypeCard;
|