- provide(:page_name, 'landing_page full individual_jamtrack betadownload')
- provide(:description, @description)
- provide(:title, @title)

= react_component 'BetaDownloadLandingPage', @page_data.to_json

- content_for :after_black_bar do
  .row.cta-row
    h2 DOWNLOAD THE BETA NOW!
    p
      .cta-buttons
        a#dl-windows.cta-button.hidden Download for Windows
        a#dl-mac-intel.cta-button.hidden Download for Mac OS (Intel)
        a#dl-mac-m.cta-button.hidden Download Mac OS (M1/M2)

      a#other-select.hidden href='#' Looking for other OS downloads?
- content_for :white_bar do
  = react_component 'BetaDownloadLandingBottomPage', @page_data.to_json

- content_for :red_bar do
  .full-row
    | Thank you for your continued support of JamKazam!

div#client_holder *{ "data-client-downloads" => @page_data.to_json }
javascript:
    function selectPlatform(selectedPlatform) {
        console.log("selectedPlatform", selectedPlatform);


        var platform = selectedPlatform; //MacOSX, Win32, Unix

        var otherPlatform = "MacOSX"
        if(platform == "MacOSX") {
            otherPlatform = "Win32"
        }
        $('#other-select').data('platform', otherPlatform)

        if(platform == 'MacOSX') {
            $('#dl-windows').hide();
            $('#dl-mac-intel').show();
            $('#dl-mac-m').show();
        }
        else {
            $('#dl-mac-intel').hide();
            $('#dl-mac-m').hide();
            $('#dl-windows').show();
        }
        $('#other-select').show();
    }

  $(document).on('JAMKAZAM_READY', function(e, data) {
    var currentOS = window.JK.detectOS();

    gon.clients.forEach(function(item){
       console.log("item", item)
        if(item.product == "JamClientModern/Win32") {
            $('#dl-windows').attr('href', item.uri.url)
        }
        else if(item.product == "JamClientModern/MacOSX-Intel") {
            $('#dl-mac-intel').attr('href', item.uri.url)
        }
        else if(item.product == "JamClientModern/MacOSX-M") {
            $('#dl-mac-m').attr('href', item.uri.url)
        }
      });

    $('#other-select').click(function(e) {
        e.preventDefault();

        var platform = $(this).data('platform')
        selectPlatform(platform);

        return false;
    })

    selectPlatform(currentOS == null || currentOS == "Unix" ? 'Win32' : currentOS);
  })
