gostart/templates/main.html

183 lines
5.8 KiB
HTML

<html lang="en">
<head>
<style>
html {
background-color: #ffffea;
}
.icon {
cursor: pointer;
padding: 10px;
margin: 10px;
width: 100px;
height: 100px;
border-radius: 10px;
border: 1px solid black;
list-style-type: none;
text-align: center;
}
.icon img {
width: 50px;
height: 50px;
}
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 5px;
}
.col {
border: 1px solid black;
border-radius: 10px;
}
.icon-grid {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 3px;
}
header {
padding: 0 !important;
}
main {
padding: 5px !important;
}
ul li span {
cursor: pointer;
}
</style>
<title>{{.Title}}::{{.Node.ComputedName}}</title>
</head>
<body>
<header>
<h1>{{.Title}} for {{.Node.ComputedName}}</h1>
{{if .System.ShowShared}}Showing shared links.{{end}}
<p>
Remaining queries: <b>{{.CurrentLimits.Remaining}}</b><br />
Limit resets in <b>{{remaining .CurrentLimits.ResetAt}}</b> minutes.
</p>
</header>
<main>
<div class="grid">
<div class="col">
{{ $len := len .PullRequests }}{{if ne $len 0}}
<h3>Pull Requests</h3>
<ul>
{{range .PullRequests}}
<li><b><a href="{{.Url}}">{{.Repo}} {{.Number}}</a></b> :: {{.Description}}</li>
{{end}}
</ul>
{{end}}
</div>
<div class="col">
{{ $len := len .Watches }}{{if ne $len 0}}
<h3>Watch Items</h3>
<ul class="">
{{range .Watches}}
<li><b>{{.Repo}} :: {{.Name}}</b>
<ul>
{{range .Data.Search.Edges}}
{{if includeWatch .Node.Repository.NameWithOwner .Node.Number $.Ignores}}
<li>
<b>
<a href="{{.Node.URL}}">{{.Node.Number}}</a>
</b> ::
<span onclick="addPR({{.Node.Number}}, '{{.Node.Repository.NameWithOwner}}', '{{.Node.Title}}', '{{.Node.URL}}')"></span>
<span onclick="addIgnore({{.Node.Number}}, '{{.Node.Repository.NameWithOwner}}')"></span> ::
{{.Node.Title}}
</li>
{{end}}
{{end}}
</ul>
</li>
{{end}}
</ul>
{{end}}
</div>
<div class="col">
{{ $len := len .Links }}{{if ne $len 0}}
<div class="icon-grid">
{{range .Links}}
<div>
<a href="{{.Url}}">
<div class="icon">
<header>
<!-- TODO: make this not ghetto -->
<img src="/icons/{{.ID}}"/>
</header>
{{.Name}}
</div>
</a>
</div>
{{end}}
</div>
{{end}}
</div>
</div>
</main>
<footer>
<div>
<details>
<summary>Add Link</summary>
<div class="icon-grid">
<label for="name">
Link Name
<input id="linkname" type="text" name="name" required>
</label>
<label for="url">
URL
<input id="linkurl" type="text" name="url" placeholder="https://..." required>
</label>
<label for="shared">
Shared
<input id="linkshared" type="checkbox" required>
</label>
<label for="logourl">
Logo URL
<input id="logourl" type="text" name="logourl" placeholder="https://..." required>
</label>
</div>
<button onclick="sendLinkData(); return false;">Add</button>
</details>
<details>
<summary>Add Watch Item</summary>
<div class="icon-grid">
<label for="watchname">
Name to watch for
<input id="watchname" type="text" name="name" required>
</label>
<label for="watchrepo">
Repository
<input id="watchrepo" type="text" name="repo" placeholder="NixOS/nixpkgs" required>
</label>
</div>
<button onclick="sendWatchData(); return false;">Add</button>
</details>
<details>
<summary>Add Pull Request</summary>
<div class="icon-grid">
<label for="number">
Number
<input id="number" type="text" name="number" required>
</label>
<label for="watchrepo">
Repository
<input id="repo" type="text" name="repo" placeholder="NixOS/nixpkgs" required>
</label>
<label for="descr">
Description
<input id="descr" type="text" name="descr" placeholder="..." required>
</label>
</div>
<button onclick="sendPRData(); return false;">Add</button>
</details>
</div>
</footer>
<script src="assets/main.js" type="application/javascript"></script>
</body>
</html>