{{define "title"}}{{end}}

{{define "body"}}

{{range .Flashes}}
  {{template "flash" .}}
{{end}}

<p>
  Signed in as
  <a href="https://github.com/{{.User.Login}}"
     title="{{.User.Name}}">
    <img src="{{.User.AvatarURL}}"
         width="20"
         height="20"
         border="0">{{.User.Login}}
  </a>.
  <form method="POST" action="{{routeUrl "sign-out"}}">
    <input type="submit" value="Sign Out">
  </form>
</p>

<div id="primary-actions">
  <a href="{{routeUrl "view-digest"}}">View Digest</a>
  -
  <form id="send-form" method="POST" action="{{routeUrl "send-digest"}}">
    <input type="submit" value="Email Digest">
  </form>
</div>

<p>
  You'll be getting a {{.SettingsSummary.Frequency}} digest of your past
  past activity in {{.SettingsSummary.RepositoryCount}} repositories sent to
  <code>{{.SettingsSummary.EmailAddress}}</code>.
  <a href="{{routeUrl "settings"}}">Change settings</a>
<p>

{{if .DetectTimezone }}

<script src="//cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js"></script>
<script>
  var timezoneName = jstz.determine().name();
  var preferredTimezoneNames = {
    "America/Santa_Isabel": "America/Los_Angeles"
  };
  if (timezoneName in preferredTimezoneNames) {
    timezoneName = preferredTimezoneNames[timezoneName]
  }
  var formData = new FormData();
  formData.append("timezone_name", timezoneName);
  var xhr = new XMLHttpRequest();
  xhr.open("POST", "{{routeUrl "set-initial-timezone"}}", true);
  xhr.send(formData);
</script>

{{end}}

{{end}}
