import { useEffect } from 'react'; import { isEmpty, values } from 'ramda'; import { Link, RouteChildrenProps } from 'react-router-dom'; import { Card, Row } from 'reactstrap'; import { ExternalLink } from 'react-external-link'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faExternalLinkAlt, faPlus } from '@fortawesome/free-solid-svg-icons'; import ServersListGroup from '../servers/ServersListGroup'; import { ServersMap } from '../servers/data'; import { ShlinkLogo } from './img/ShlinkLogo'; import './Home.scss'; export interface HomeProps extends RouteChildrenProps { servers: ServersMap; } const Home = ({ servers, history }: HomeProps) => { const serversList = values(servers); const hasServers = !isEmpty(serversList); useEffect(() => { // Try to redirect to the first server marked as auto-connect const autoConnectServer = serversList.find(({ autoConnect }) => autoConnect); autoConnectServer && history.push(`/server/${autoConnectServer.id}`); }, []); return (

Welcome!

{!hasServers && (

This application will help you manage your Shlink servers.

Add a server

Learn more about Shlink

)}
); }; export default Home;