<!--
Copyright 2025 XTX Markets Technologies Limited

SPDX-License-Identifier: GPL-2.0-or-later
-->

{{define "body"}}
    <table class="table">
        <tbody>
            {{if .Path}}
                <tr>
                    <th>Path</th>
                    <td>
                        <code>
                            <a href="/browse">/</a>
                            {{range $segment := .PathSegments}}
                                <a href="/browse{{$segment.PathSoFar}}">{{$segment.Segment}}</a> /
                            {{end}}
                        </code>
                    </td>
                </tr>
            {{end}}
            <tr>
                <th>Id</th>
                <td><code>{{.Id}}</code></td>
            </tr>
            <tr>
                <th>Owner</th>
                <td>
                    {{if eq .Owner "0x0"}}
                        <code>NONE</code>
                    {{else}}
                        <a href="/browse?id={{.Owner}}"><code>{{.Owner}}</code></a>
                    {{end}}
                </td>
            </tr>
            <tr>
                <th>Mtime</th>
                <td><code>{{.Mtime}}</code></td>
            </tr>
            <tr>
                <th>Info</th>
                <td>
                    <table class="table table-sm mb-0">
                        <thead>
                            <tr>
                                <td></td>
                                <th>Inherited from</th>
                                <th>Body</th>
                            </tr>
                        </thead>
                        <tbody>
                            {{range $entry := .Info}}
                                <tr>
                                    <td>{{$entry.Tag}}</td> 
                                    <td>
                                        {{if $entry.InheritedFrom}}
                                            <a href="/browse?id={{$entry.InheritedFrom}}"><code>{{$entry.InheritedFrom}}</code></a>
                                        {{end}}
                                    </td>
                                    <td>{{$entry.Body}}</td>
                                </tr>
                            {{end}}
                        </tbody>
                    </table>    
                </td>
            </tr>
        </tbody>
    </table>
    <div id="edges-table"><em>Loading...</em></div>
    <script type="module">
        import { renderDirectoryEdges } from '/static/scripts.js';
        renderDirectoryEdges({{.Id}}, {{.Path}});
    </script>
{{end}}