{{/*
  Copyright 2025-2026 Eugene Petrenko (mcp@jonnyzzz.com)

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/}}
{{ define "main" }}
<div class="docs-header">
    <h1>Releases</h1>
    <p>Download and changelog for each MCP Steroid release.</p>
</div>

<div class="page-content">
    <div class="success">
        <p><strong>Custom Plugin Repository:</strong> Add <code>https://mcp-steroid.jonnyzzz.com/updatePlugins.xml</code> in <strong>Settings &rarr; Plugins &rarr; &#x2699; &rarr; Manage Plugin Repositories...</strong> for automatic updates.</p>
    </div>
</div>

{{ $releases := site.GetPage "section" "releases" }}
{{ $all := $releases.Pages.ByTitle.Reverse }}
{{ $latest := index $all 0 }}
{{ $older := after 1 $all }}

<div class="docs-grid">
    <a href="{{ $latest.RelPermalink }}" class="doc-card">
        <h2>{{ $latest.Title }} <span style="color: #28a745; font-size: 0.6em; vertical-align: middle;">Latest</span></h2>
        {{ $desc := $latest.Description | plainify }}
        {{ if not $desc }}{{ $desc = $latest.Summary | plainify }}{{ end }}
        {{ if not $desc }}{{ $desc = $latest.Plain | truncate 160 }}{{ end }}
        <p>{{ $desc }}</p>
        <span class="arrow">View release &rarr;</span>
    </a>
</div>

{{ if $older }}
<h2 style="margin-top: 2rem;">Older Releases</h2>
<div class="docs-grid">
    {{ range $older }}
    <a href="{{ .RelPermalink }}" class="doc-card">
        <h2>{{ .Title }}</h2>
        {{ $desc := .Description | plainify }}
        {{ if not $desc }}{{ $desc = .Summary | plainify }}{{ end }}
        {{ if not $desc }}{{ $desc = .Plain | truncate 160 }}{{ end }}
        <p>{{ $desc }}</p>
        <span class="arrow">View release &rarr;</span>
    </a>
    {{ end }}
</div>
{{ end }}

<section class="releases-footer">
    <h2 class="releases-footer-title">More Ways to Get Started</h2>
    <div class="docs-grid releases-footer-grid">
        <a href="https://mcp-steroid.jonnyzzz.com/updatePlugins.xml" class="doc-card" target="_blank" rel="noopener">
            <h2>Automatic Updates</h2>
            <p>Use the custom plugin repository URL in IntelliJ to receive update notifications automatically.</p>
            <span class="arrow">Open updatePlugins.xml &rarr;</span>
        </a>
        <a href="{{ $latest.RelPermalink }}" class="doc-card">
            <h2>Download Latest</h2>
            <p>Open the newest release page to get the ZIP, checksum, and the latest changelog.</p>
            <span class="arrow">View {{ $latest.Title }} &rarr;</span>
        </a>
        <div class="doc-card">
            <h2>Share Feedback with Eugene</h2>
            <p>Tell Eugene what works and what should improve in early access releases.</p>
            <p>Connect on <a href="https://linkedin.com/in/jonnyzzz" target="_blank" rel="noopener">LinkedIn</a> or <a href="https://x.com/jonnyzzz" target="_blank" rel="noopener">X</a>.</p>
        </div>
    </div>
</section>
{{ end }}
