<!DOCTYPE html>
<html>

<head>
    <style>
        body {
            background-color: aquamarine;
        }

        header,
        article {
            margin-left: calc(50% - 350px);
            width: 700px;
            background-color: white;
            color: black;
            border: 2px black solid;
            padding: 10px;
        }

        article {
            margin-top: 20px;
        }

        div.date {
            text-align: right;
            font-size: small;
            font-weight: bold;
        }

        table {
            width: 100%;
        }

        th {
            text-align: left;
        }

        th[colspan] {
            padding-top: 20px;
            text-align: center;
        }
    </style>
    <script>
        function copyToClipboard(e) {
            navigator.clipboard.writeText(e.getAttribute("data-value"));
        }
    </script>
    <title>@{{ name }}</title>
</head>

<body>
    <header>
        <h1>@{{ name }}</h1>
        <table>
            <tr>
                <th>Fediverse Handles</th>
                <td>
                    {% for handle in profile.fediverse_handles %}
                    {{ handle }} <button title="copy to clipboard" data-value="{{ handle }}"
                        onclick="copyToClipboard(this)">⿻</button><br>
                    {% endfor %}
                </td>
            </tr>
            {% if profile.summary %}
            <tr>
                <td colspan=2>{{ profile.summary }}</td>
            </tr>
            {% endif %}
            {% if profile.property_values %}
            <tr>
                <th colspan="2">Property Values</th>
            </tr>
            {% for propety in profile.property_values %}
            <tr>
                <th>{{ propety.name }}</th>
                <td>{{ propety.value}}</td>
            </tr>
            {% endfor %}
            {% endif %}
        </table>
    </header>
    {% for post in posts %}
    <article>
        <div class="date"><a href="/@{{ name }}/{{ post.id }}">{{ post.date }}</a></div>
        {{ post.body }}
    </article>
    {% endfor %}
</body>

</html>