<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8" />
    <title><%= image.title %></title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@1/css/pico.min.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<main class="container">
    <h2><%= image.title %></h2>
    <p><%= image.description %></p>
    <img src="/uploads/<%= image.filename %>" alt="" style="max-width: 100%;" />
    <p>Hochgeladen von <strong><%= image.uploader %></strong></p>

    <hr />

    <h3>Kommentare</h3>
    <ul>
        <% comments.forEach(comment => { %>
            <li><strong><%= comment.author %></strong>: <%= comment.content %></li>
        <% }) %>
    </ul>

    <% if (user) { %>
        <form method="POST" action="/image/<%= image.id %>/comment">
            <input type="text" name="content" placeholder="Kommentar schreiben..." required />
            <button type="submit">Senden</button>
        </form>
    <% } else { %>
        <p>Bitte <a href="/auth/google">einloggen</a>, um zu kommentieren.</p>
    <% } %>

    <a href="/" role="button">Zurück zur Galerie</a>
</main>
</body>
</html>
