/*
 * @Description: 头部滚动提示条
 * @Author: taosu
 * @Date: 2021-11-10 14:36:09
 */
import React from 'react';
import { useSelector } from 'react-redux';
import { RootState } from 'models';
import AlertScroll from 'components/AlertScroll';

interface IProps {
  type?: 'layout' | 'all' | 'other'; //渲染类型，分为有左侧边栏和没有
}

const TransferScroll = (props: IProps) => {
  const { type = 'layout' } = props;
  const transfer = useSelector<RootState>((state) => state.transfer) as RootState['transfer'];
  const { deadline } = transfer;

  return (
    <div>
      {window.appConfig.LOCAL && deadline && (
        <AlertScroll data={`平台迁移中，请在 ${deadline} 前完成数据备份，到期后平台及数据将自动销毁`} closable={false} type={type} />
      )}
    </div>
  );
};

export default TransferScroll;
