delphi.market/pages/market.html

110 lines
4.6 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<title>delphi.market</title>
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" />
<link rel="stylesheet" href="/index.css" />
<link rel="stylesheet" href="/market.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#091833" />
{{ if eq .ENV "development" }}
<script defer src="/hotreload.js"></script>
{{ end }}
</head>
<body>
<header class="flex flex-row text-center justify-center pt-1">
<nav>
<a href="/">home</a>
{{ if .session }}
2023-09-09 20:52:51 +00:00
<a href='/user'>user</a>
{{ else }} <a href="/login">login</a> {{ end }}
</nav>
</header>
<div class="container flex flex-column text-center">
<code>
<strong>
<pre>
_ _
_ __ ___ __ _ _ __| | _____| |_
| '_ ` _ \ / _` | '__| |/ / _ \ __|
| | | | | | (_| | | | < __/ |_
|_| |_| |_|\__,_|_| |_|\_\___|\__|</pre>
</strong>
</code>
<div class="font-mono mb-1">{{.Description}}</div>
2023-09-09 20:52:51 +00:00
<details open class="align-left">
<summary><span class="font-mono mb-1"><strong>Order Book</strong></span></summary>
<table class="w-100p mb-1">
<tr>
<th class="align-left">BUY YES</th>
<th class="align-center">SELL</th>
<th class="align-right">BUY NO</th>
</tr>
{{ range .Orders }}
<tr>
2023-09-09 20:52:51 +00:00
{{ if and (eq .Share.Description "YES") (eq .Side "BUY") }}
2023-09-09 20:52:51 +00:00
<td>
<div class="flex yes">
<span class="align-left">YES</span>
2023-09-09 20:52:51 +00:00
<span style="width: 100%" class="align-right">{{.Quantity}} @ {{.Price}} ⚡</span>
2023-09-09 20:52:51 +00:00
</div>
</td>
{{ else }}
<td></td>
{{ end }}
2023-09-09 20:52:51 +00:00
{{ if (eq .Side "SELL") }}
2023-09-09 20:52:51 +00:00
<td>
<div class="flex no" style="width: 100%">
2023-09-09 20:52:51 +00:00
<span class="align-left">{{.Share.Description}}</span>
2023-09-09 20:52:51 +00:00
<span style="width: 100%" class="align-right">{{.Quantity}} @ {{.Price}} ⚡</span>
2023-09-09 20:52:51 +00:00
</div>
</td>
{{ else }}
<td></td>
{{ end }}
2023-09-09 20:52:51 +00:00
{{ if and (eq .Share.Description "NO") (eq .Side "BUY") }}
2023-09-09 20:52:51 +00:00
<td>
<div class="flex yes">
2023-09-09 20:52:51 +00:00
<span class="align-left">NO</span>
2023-09-09 20:52:51 +00:00
<span style="width: 100%" class="align-right">{{.Quantity}} @ {{.Price}} ⚡</span>
2023-09-09 20:52:51 +00:00
</div>
</td>
{{ else }}
<td></td>
{{ end }}
</tr>
{{ end }}
2023-09-09 20:52:51 +00:00
</table>
</details>
<hr />
2023-09-09 20:52:51 +00:00
<details open class="align-left">
<summary><span class="font-mono mb-1"><strong>Order Form</strong></span></summary>
2023-09-09 20:52:51 +00:00
<form id="form" class="order-form" hidden action="/market/{{$.Id}}/order" method="post">
2023-09-09 20:52:51 +00:00
<button id="buy" type="button" class="order-button yes w-100p selected">BUY</button>
<button id="sell" type="button" class="order-button no w-100p">SELL</button>
<input id="market-id" hidden name="market_id" value="{{$.Id}}" />
<input id="side" hidden name="side" value="BUY" />
<label>share</label>
<select name="share_id">
<option value="{{.YesShare.Id}}">YES</option>
<option value="{{.NoShare.Id}}">NO</option>
</select>
<label>quantity</label>
<input id="quantity" type="number" name="quantity" placeholder="quantity" />
2023-09-09 20:52:51 +00:00
<label>price [sats ⚡]</label>
2023-09-09 20:52:51 +00:00
<input id="price" type="number" name="price" placeholder="price" />
<label id="submit-label"></label>
<button type="submit">SUBMIT</button>
</form>
</details>
</div>
</body>
<script src="/order.js"></script>
</html>