/* eslint-disable react/jsx-props-no-spreading */
import React from 'react';
import { GetServerSideProps } from 'next';
import generateRandomRanking from '../../../src/utils/generateRandomRanking';
import Layout from '../../../src/components/layout/Layout';
import DynamicRanking from '../../../src/components/pages/ranking/DynamicRanking';
import { RankingTrackProps } from '../../../src/model/rankingTrack';

const index: React.FC<RankingTrackProps> = (rankingProps) => {
  return (
    <Layout title="Inicio" mainClassName="homePage">
      <section className="home">
        <DynamicRanking {...rankingProps} />
      </section>
    </Layout>
  );
};

export const getServerSideProps: GetServerSideProps<RankingTrackProps> =
  async () => ({
    props: generateRandomRanking(),
  });

export default index;
