2024-07-15 10:57:51 +00:00
|
|
|
package pages
|
|
|
|
|
|
|
|
import (
|
2024-09-05 21:11:29 +00:00
|
|
|
"git.ekzyis.com/ekzyis/delphi.market/server/router/pages/components"
|
2024-07-15 10:57:51 +00:00
|
|
|
"git.ekzyis.com/ekzyis/delphi.market/types"
|
|
|
|
"github.com/dustin/go-humanize"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TODO: Add countdown? Use or at least show somewhere precise timestamps?
|
2024-08-26 11:15:33 +00:00
|
|
|
templ Market(m types.Market, q0 types.MarketQuote, q1 types.MarketQuote, uQ0 int, uQ1 int) {
|
2024-09-05 21:11:29 +00:00
|
|
|
<html>
|
2024-07-15 10:57:51 +00:00
|
|
|
@components.Head()
|
2024-08-25 23:51:10 +00:00
|
|
|
<body
|
|
|
|
x-data="{ outcome: undefined }"
|
|
|
|
class="container"
|
2024-09-05 21:11:29 +00:00
|
|
|
hx-preserve
|
|
|
|
>
|
2024-07-15 10:57:51 +00:00
|
|
|
@components.Nav()
|
|
|
|
<div id="content" class="flex flex-col">
|
2024-09-08 15:16:08 +00:00
|
|
|
<div class="text-center font-bold my-1 mt-3">{ m.Question }</div>
|
2024-09-05 21:11:29 +00:00
|
|
|
<div class="text-center text-muted my-1">{ humanize.Time(m.EndDate) }</div>
|
2024-07-15 10:57:51 +00:00
|
|
|
<div class="text-center text-muted my-1"></div>
|
2024-09-08 15:16:08 +00:00
|
|
|
<div class="flex justify-center w-full max-h-64 my-3"><canvas id="chart"></canvas></div>
|
|
|
|
<script src="/js/bundle.min.js"></script>
|
2024-09-05 21:07:44 +00:00
|
|
|
<blockquote class="p-4 mb-4 border-s-4 border-muted">
|
2024-08-25 23:51:10 +00:00
|
|
|
if m.Description != "" {
|
2024-08-26 21:26:54 +00:00
|
|
|
{ m.Description }
|
2024-08-25 23:51:10 +00:00
|
|
|
} else {
|
|
|
|
<empty>
|
|
|
|
}
|
2024-09-05 21:11:29 +00:00
|
|
|
<div class="text-muted text-right pt-4">― { m.User.Name }, { humanize.Time(m.CreatedAt) }</div>
|
2024-07-15 10:57:51 +00:00
|
|
|
</blockquote>
|
2024-08-25 23:51:10 +00:00
|
|
|
<div class="flex flex-col justify-center my-1">
|
|
|
|
<div class="flex flex-row justify-center">
|
|
|
|
<button
|
|
|
|
class="neon success mx-1"
|
|
|
|
x-on:click="outcome = outcome === 1 ? undefined : 1"
|
|
|
|
:class="{ 'active' : outcome === 1 }"
|
|
|
|
>
|
|
|
|
BET YES
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
class="neon error mx-1"
|
|
|
|
x-on:click="outcome = outcome === 0 ? undefined : 0"
|
|
|
|
:class="{ 'active' : outcome === 0 }"
|
|
|
|
>
|
|
|
|
BET NO
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="mx-auto my-5" x-show="outcome === 1">
|
2024-08-26 11:15:33 +00:00
|
|
|
@components.MarketForm(m, 1, q1, uQ1)
|
2024-08-25 23:51:10 +00:00
|
|
|
</div>
|
|
|
|
<div class="mx-auto my-5" x-show="outcome === 0">
|
2024-08-26 11:15:33 +00:00
|
|
|
@components.MarketForm(m, 0, q0, uQ0)
|
2024-08-25 23:51:10 +00:00
|
|
|
</div>
|
2024-07-15 10:57:51 +00:00
|
|
|
</div>
|
2024-09-05 21:11:29 +00:00
|
|
|
</div>
|
2024-07-15 10:57:51 +00:00
|
|
|
@components.Modal(nil)
|
|
|
|
@components.Footer()
|
|
|
|
</body>
|
|
|
|
</html>
|
2024-08-25 05:48:00 +00:00
|
|
|
}
|