import React from "react";
import { Link } from "react-router-dom";
// import Banner from "./banner";
import Lightspot from './lightspot';
import TimerShaft from './timerShaft';
import Award from "./award";
import News from './news';
import Partner from "./partner";
import Contact from "./contact";
import banner from "../img/banner.png";
import introduce from "../img/introduce.png";
import apply1 from "../img/apply1.png";
import apply2 from "../img/apply2.png";
import './index.scss';

export default (props) => {
  const { current_user, isGlccApplyDate, showNotification, studentApplyStart,history } = props;
  function goToApply() {
    if (isGlccApplyDate) {
      if (current_user && current_user.login) {
        window.location.href = "https://wj.qq.com/s2/10175205/e8df/";
      } else {
        window.location.href = "/login?go_page=https://wj.qq.com/s2/10175205/e8df/";
      }
    } else {
      showNotification("不在报名时间，报名时间为4月15日~5月20日");
      window.location.href = "/glcc";
    }
  }

  function goToStudent(){
    // 学生报名时间
    if(!studentApplyStart){
      showNotification("不在报名时间，报名开始时间为5月26日");
    }else{
      history.push("/glcc/subjects");
    }
  }

  return (
    <div className="glcc">
      {/* <Banner /> */}
      <img className="glcc-banner" src={banner} alt=""></img>
      {/* <div > */}
      {/* <Link className="apply-btn" to={isGlccApplyDate ? current_user && current_user.login ? 'https://wj.qq.com/s2/10175205/e8df/' : '/login?go_page=/glcc/apply' : '/glcc'} onClick={()=>{!isGlccApplyDate && showNotification("不在报名时间，报名时间为4月15日~5月20日")}}> */}
      {/* <div className="apply-btn" onClick={goToApply}>
          <div className="apply-text">立即报名</div>
          <div className="apply-icon"><i className="font-14 iconfont icon-xiangyoujiantou "></i></div>
        </div> */}
      {/* 报名入口 */}
      <div className="applyBox">
        {/* 项目报名 */}
        <Link to="/glcc/projects" className="apply project" >
          <div>
            <img src={apply1} alt="" className="applyIcon"/>
            <span className="hover-none"><span className="til">查看项目</span> </span>
            {/* <span className="hover-show">项目报名已截止</span> */}
          </div>
          <div className="pt6">查看夏令营各项目，掌握项目课题详细信息</div>
        </Link>
        {/* 学生报名 */}
        <div className="apply" onClick={goToStudent}>
          <div>
            <img src={apply2} alt="" className="applyIcon"/>
            <span className="til">学生报名</span> 
          </div>
          <div className="pt6">选择感兴趣的课题，开启您的开源之旅</div>
        </div>
      </div>
      {/* </div> */}
      <div className="introduce">
        <div className="glcc-content">
          <div className="glcc-tit">活动简介</div>
          <div className="introduceBox">
            <div className="introduce-content">GitLink编程夏令营（GLCC），是在CCF中国计算机学会指导下，由CCF开源发展委员会（CCF ODC）举办的面向全国高校学生的暑期编程活动。活动将覆盖近千所高校，并联合各大开源基金会、开源企业、开源社区、开源专家，旨在鼓励青年学生通过参加真实的开源软件开发，提升自身技术能力，为开源社区输送优秀人才。为青年学生提供开放友好的交流平台，希望进一步推动国内开源社区的繁荣发展。</div>
            <img src={introduce} alt="" className="introduceImg" />
          </div>
        </div>
      </div>
      <Lightspot isGlccApplyDate={isGlccApplyDate} current_user={current_user} showNotification={showNotification} studentApplyStart={studentApplyStart}/>
      <TimerShaft />
      <Award />
      <News />
      <Partner />
      <Contact />
    </div>
  )
}