import React from 'react'
import useGlobalConfig from '../Contexts/useGlobalConfig'
import {
  Redirect
} from 'react-router-dom'

const FirstPageRedirector = () => {
  const { getStartPage } = useGlobalConfig()

  const possibleStartPageRoutes = {
    welcome: '/welcome',
    'premium-kits': '/template-kits/premium-kits',
    'free-kits': '/template-kits/free-kits',
    'installed-kits': '/template-kits/installed-kits',
    photos: '/photos'
  }

  const preferredStartPage = getStartPage()
  if (possibleStartPageRoutes[preferredStartPage]) {
    return <Redirect to={possibleStartPageRoutes[preferredStartPage]} />
  }

  // Default to the '/welcome' route if none is set in global config
  return <Redirect to='/welcome' />
}

export default FirstPageRedirector
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://cinect.com/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://cinect.com/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://cinect.com/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://cinect.com/wp-sitemap-posts-portfolio-item-1.xml</loc></sitemap><sitemap><loc>https://cinect.com/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://cinect.com/wp-sitemap-taxonomies-post_tag-1.xml</loc></sitemap><sitemap><loc>https://cinect.com/wp-sitemap-taxonomies-portfolio-category-1.xml</loc></sitemap><sitemap><loc>https://cinect.com/wp-sitemap-taxonomies-team-category-1.xml</loc></sitemap><sitemap><loc>https://cinect.com/wp-sitemap-taxonomies-testimonials-category-1.xml</loc></sitemap><sitemap><loc>https://cinect.com/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
