<!doctype html>
<html lang="en">

<head>
    <title>goshorly</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" rel="stylesheet">
    <link href="https://bootswatch.com/4/darkly/bootstrap.min.css" rel="stylesheet">
</head>

<style>
    html {
        height: 100%;
    }

    body {
        height: 100%;
        display: grid;
        grid-template-rows: auto 1fr auto;
    }

    footer {
        background-color: #303030;
        padding: 10px;
    }
</style>

<body>
    <br><br>
    <div class="container">
        <div class="jumbotron">
            <h1>goshorly</h1>
            <p>An dead simple & fast URL shortener. <br>
                All shorten URLs will be available for 30days!
            </p>
            <hr>
            <form method="post" action="#">
                <fieldset>
                    <input type="text" class="form-control" id="surl" name="surl" placeholder="https://google.de"
                        required>
                    <br>
                    <center>
                        <button type="submit" class="btn btn-primary btn-lg">Submit</button>
                    </center>
                </fieldset>
            </form>
        </div>

        <!-- URL PASS CHECK -->
        {{ if .URL }}
        <div style="padding-right: 20px;" class="alert alert-dismissible alert-success">
            <input id="foo" class="form-control" value="{{ .URL }}" readonly>
            <br>
            <center>
                <button class="btn-copy btn btn-success" data-clipboard-target="#foo">
                    Copy to clipboard
                </button>
            </center>
        </div>
        {{ end }}

        <!-- URL FAIL CHECK -->
        {{ if .ERR }}
        <div style="padding-right: 20px;" class="alert alert-dismissible alert-danger">
            <p style="margin-bottom: 0px;">{{ .ERR }}</p>
        </div>
        {{ end }}

    </div>

    <!-- Footer with Build-Check -->
    <footer>
        <center>
            Made with <a href="https://git.ucode.space/Phil/goshorly"><i class="fas fa-code-branch"></i>
                Phil/goshorly</a>
                {{ if .GitBuild }}
                {{ .GitCommitShort }}/{{ .GitBranch }}
                {{ end }}
        </center>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
    <script>
        new ClipboardJS('body > div > div.alert.alert-dismissible.alert-success > center > button');
    </script>
</body>

</html>