import React from 'react';
import { Box, Button, Icon, Icons, Text, config, toRem } from 'folds';
import { Page, PageHero, PageHeroSection } from '../../components/page';
import pkg from '../../../../package.json';
import { getOriginBaseUrl, withOriginBaseUrl } from '../pathUtils';

const LotusLogo = withOriginBaseUrl(getOriginBaseUrl(), '/Lotus.png');

export function WelcomePage() {
  return (
    <Page>
      <Box
        grow="Yes"
        style={{ padding: config.space.S400, paddingBottom: config.space.S700 }}
        alignItems="Center"
        justifyContent="Center"
      >
        <PageHeroSection>
          <PageHero
            icon={
              <img
                width="70"
                height="70"
                src={LotusLogo}
                alt="Lotus Chat"
                style={{ objectFit: 'contain' }}
              />
            }
            title="Welcome to Lotus Chat"
            subTitle={
              <span>
                A Matrix client for Lotus Guild.{' '}
                <a
                  href="https://code.lotusguild.org/LotusGuild/cinny/releases"
                  target="_blank"
                  rel="noreferrer noopener"
                >
                  v{pkg.version}
                </a>
              </span>
            }
          >
            <Box justifyContent="Center">
              <Box grow="Yes" style={{ maxWidth: toRem(300) }} direction="Column" gap="300">
                <Button
                  as="a"
                  href="https://code.lotusguild.org/LotusGuild/cinny"
                  target="_blank"
                  rel="noreferrer noopener"
                  before={<Icon size="200" src={Icons.Code} />}
                >
                  <Text as="span" size="B400" truncate>
                    Source Code
                  </Text>
                </Button>
                <Button
                  as="a"
                  href="https://matrix.lotusguild.org"
                  target="_blank"
                  rel="noreferrer noopener"
                  fill="Soft"
                  before={<Icon size="200" src={Icons.Heart} />}
                >
                  <Text as="span" size="B400" truncate>
                    Lotus Matrix Guide
                  </Text>
                </Button>
              </Box>
            </Box>
          </PageHero>
        </PageHeroSection>
      </Box>
    </Page>
  );
}
