blob: 14ba7c0c1613335b80b67ed2be20a983af38fe6f [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { memo, FC } from 'react';
import { Button } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import classnames from 'classnames';
import {
getTransNs,
getTransKeyPrefix,
PluginInfo,
} from '@/utils/pluginKit/utils';
import { SvgIcon } from '@/components';
import info from './info.yaml';
import { useGetStartUseOauthConnector } from './services';
import './i18n';
const pluginInfo: PluginInfo = {
slug_name: info.slug_name,
type: info.type,
};
interface Props {
className?: string;
}
const Index: FC<Props> = ({ className }) => {
const { t } = useTranslation(getTransNs(), {
keyPrefix: getTransKeyPrefix(pluginInfo),
});
const { data } = useGetStartUseOauthConnector();
if (!data?.length) return null;
return (
<div className={classnames('d-grid gap-2', className)}>
{data?.map((item) => {
return (
<Button variant="outline-secondary" href={item.link} key={item.name}>
<SvgIcon base64={item.icon} svgClassName="btnSvg me-2" />
<span>{t('connect', { auth_name: item.name })}</span>
</Button>
);
})}
</div>
);
};
export default {
info: pluginInfo,
component: memo(Index),
};