import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { HelpDocumentLink, Platfrom } from '../common';
import { PlatformCard } from './platformCard';

interface HomeProps {
    rpc: any;
    tencentOnly: boolean;
    selectPlatform: (type: Platfrom) => Promise<void>;
}
export const HomeStep = (props: HomeProps) => {
    const { rpc } = props;

    const openLink = (link: string) => {
        rpc.invoke('openWebLink', [link]);
    };

    return (
        <>
            <div className='step-title'>
                <FormattedMessage id='home.welcome.title' />
            </div>
            <div className='step-desc'>
                <FormattedMessage id='home.welcome.desc' />
            </div>
            <div className='link' onClick={() => openLink(HelpDocumentLink.platformDiff)}>
                <FormattedMessage id='home.welcome.link' />
            </div>
            <div className='platform-title'>
                <FormattedMessage id='home.platform.title' />
            </div>

            <PlatformCard {...props} />
        </>
    );
};
