Skip to content

Commit

Permalink
Sunrise data page (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellemaxwell authored Nov 1, 2024
1 parent a6b43b8 commit 2d8eb1b
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 3 deletions.
6 changes: 5 additions & 1 deletion pkg/web/pages.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ func (s *Server) SendMessageForm(c *gin.Context) {
c.HTML(http.StatusOK, "send_message.html", scene.New(c))
}

func (s *Server) Verify(c *gin.Context) {
func (s *Server) VerifySunriseUser(c *gin.Context) {
c.HTML(http.StatusOK, "verify.html", scene.New(c))
}

func (s *Server) SunriseMessagePreview(c *gin.Context) {
c.HTML(http.StatusOK, "view_message.html", scene.New(c))
}

func (s *Server) TravelAddressUtility(c *gin.Context) {
c.HTML(http.StatusOK, "traveladdress.html", scene.New(c))
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/web/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ func (s *Server) setupRoutes() (err error) {
s.router.GET("/transactions/:id/info", authenticate, s.TransactionsInfo)
s.router.GET("/send-envelope", authenticate, s.SendEnvelopeForm)
s.router.GET("/send-message", authenticate, s.SendMessageForm)
s.router.GET("/verify", authenticate, s.Verify)
s.router.GET("/verify", s.VerifySunriseUser)
s.router.GET("/sunrise-accept", s.SunriseMessagePreview)
s.router.GET("/accounts", authenticate, s.Accounts)
s.router.GET("/counterparty", authenticate, s.CounterpartyVasps)
s.router.GET("/users", authenticate, s.UsersManagement)
Expand Down
15 changes: 15 additions & 0 deletions pkg/web/templates/components/sunrise_header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{ define "sunrise_header" }}
<header>
<nav class="navbar shadow-md">
<div class="navbar-start my-2">
<!-- TODO: Add copy about joining the TRISA network to the login page? -->
<a href="/">
<img src="/static/envoy-logo.webp" alt="Envoy Logo" class="w-48" />
</a>
</div>
<div class="navbar-end">
<a href="https://vaspdirectory.net/guide" target="_blank" class="mr-4 px-6 py-2 rounded-md bg-primary text-white font-semibold hover:bg-primary/90">Join TRISA Network</a>
</div>
</nav>
</header>
{{ end }}
6 changes: 5 additions & 1 deletion pkg/web/templates/components/transaction_rejection.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ define "transaction_rejection" }}

<dialog id="transaction_rejection_modal" class="modal">
<div class="modal-box">
<div class="flex justify-between items-center">
Expand Down Expand Up @@ -61,4 +63,6 @@ <h3 class="font-bold text-xl">Reject Transaction</h3>
</form>
</div>
</div>
</dialog>
</dialog>

{{ end }}
19 changes: 19 additions & 0 deletions pkg/web/templates/layouts/sunrise.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{ define "sunrise" }}
<!DOCTYPE html>
<html lang="en">
{{ template "head" . }}
<body>

{{ template "sunrise_header" . }}

<main>
{{ block "content" . }}{{ end }}
</main>
<script src="https://unpkg.com/htmx.org@1.9.10" integrity="sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC" crossorigin="anonymous"></script>
<script src="https://unpkg.com/htmx.org@1.9.11/dist/ext/json-enc.js"></script>
<script src="https://unpkg.com/slim-select@latest/dist/slimselect.min.js"></script>
<script type="module" src="/static/js/main.js"></script>
{{ block "appcode" . }}{{ end }}
</body>
</html>
{{ end }}
128 changes: 128 additions & 0 deletions pkg/web/templates/partials/sunrise/message_accept.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<div class="grid md:grid-cols-2 py-2 border-t border-t-black">
<section>
<h2 class="my-4 font-bold">TRANSACTION DETAILS</h2>
<!-- TODO: Range transaction details and display in the data list -->
<dl>
<div class="grid grid-cols-2">
<dt class="font-semibold">Amount</dt>
<dd>1.045</dd>
</div>
</dl>
</section>
<section>
<h2 class="my-4 font-bold">ORIGINATOR DETAILS</h2>
<!-- TODO: Range originator details and display in the data list -->
<dl>
<div class="grid grid-cols-2">
<dt class="font-semibold">First Name</dt>
<dd>James</dd>
</div>
</dl>
</section>
</div>

<section>
<form>
<div class="mt-4"></div>
<section class="py-2 border-t border-t-black">
<h2 class="my-4 font-bold">BENEFICIARY DETAILS</h2>
<div class="my-5">
<label for="benf_crypto_address" class="label-style">Crypto Address</label>
<input type="text" id="benf_crypto_address" name="benf_crypto_address"
placeholder="Enter beneficiary's crypto address" class="input-style" />
</div>
<div class="grid gap-6 my-4 md:grid-cols-2">
<div>
<label for="benf_first_name" class="label-style">Legal First or Given Name</label>
<input type="text" id="benf_first_name" name="benf_first_name"
placeholder="Enter beneficiary's first or given name" class="input-style" />
</div>
<div>
<label for="benf_last_name" class="label-style">Legal Last or Family Name</label>
<input type="text" id="benf_last_name" name="benf_last_name"
placeholder="Enter beneficiary's last or family name" class="input-style" />
</div>
</div>
<div class="grid gap-6 my-4 md:grid-cols-2">
<div>
<label for="bf_id_dob" class="label-style">Date of Birth</label>
<input type="date" id="bf_id_dob" name="bf_id_dob" placeholder="Enter beneficiary's date of birth"
class="input-style" />
</div>
<div>
<label for="bf_id_birth_place" class="label-style">Place of Birth</label>
<input type="text" id="bf_id_birth_place" name="bf_id_birth_place"
placeholder="Enter the beneficiary's place of birth" class="input-style" />
</div>
</div>
<div class="my-4">
<label for="benf_customer_id" class="label-style">Internal Customer Identifier</label>
<input type="text" id="benf_customer_id" name="benf_customer_id"
placeholder="Enter customer's internal identification number" class="input-style" />
</div>
<div class="grid gap-6 my-4 md:grid-cols-2">
<div>
<label for="benf_addr_line_1" class="label-style">Street Address - Line 1</label>
<input type="text" id="benf_addr_line_1" name="benf_addr_line_1"
placeholder="Enter beneficiary's street address" class="input-style" />
</div>
<div>
<label for="benf_addr_line_2" class="label-style">Street Address - Line 2 (optional) eg. apartment or
suite number</label>
<input type="text" id="benf_addr_line_2" name="benf_addr_line_2"
placeholder="Enter beneficiary's unit or building number" class="input-style" />
</div>
<div>
<label for="benf_city" class="label-style">City/Municipality</label>
<input type="text" id="benf_city" name="benf_city" placeholder="Enter beneficiary's city or municipality"
class="input-style" />
</div>
<div>
<label for="benf_state" class="label-style">Region/Province/State</label>
<input type="text" id="benf_state" name="benf_state"
placeholder="Enter beneficiary's region, province, or state" class="input-style" />
</div>
<div>
<label for="benf_post_code" class="label-style">Postal Code</label>
<input type="text" id="benf_post_code" name="benf_post_code" placeholder="Enter beneficiary's postal code"
class="input-style" />
</div>
<div>
<label for="benf_countries" class="label-style">Country</label>
<select id="benf_countries" name="benf_country"></select>
</div>
</div>
<div class="grid gap-6 my-6 md:grid-cols-2">
<div>
<label for="bf_id_number" class="label-style">National Identification Number</label>
<input type="text" id="bf_id_number" name="bf_id_number"
placeholder="Enter beneficiary's national identification number" class="input-style" />
</div>
<div>
<label for="bf_id_type_code" class="label-style">National Identification Type</label>
<select id="bf_id_type_code" name="bf_id_type_code"></select>
</div>
</div>
<div class="my-6">
<label for="bf_id_country" class="label-style">Country of Issue</label>
<select id="bf_id_country" name="bf_id_country"></select>
</div>
</section>

<!-- TODO: Add htmx attributes to buttons -->
<div class="py-4 flex justify-center items-center gap-x-2">
<button
type="button"
onclick="transaction_rejection_modal.showModal()"
class="p-1 btn w-36 bg-warning font-semibold text-lg text-white text-center md:p-2 hover:bg-warning/80">
Reject
</button>
<button
type="submit"
class="submit-btn w-36 btn p-1 bg-success font-semibold text-lg text-white md:p-2 hover:bg-success/80">
<span class="submit-btn-text">Accept</span>
<span id="loader" class="htmx-indicator loading loading-spinner loading-md"></span>
</button>
</div>
</form>
</section>
26 changes: 26 additions & 0 deletions pkg/web/templates/view_message.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{ template "sunrise" . }}
{{ define "content" }}

<section class="mx-8 py-14">
<h1 class="pb-4 text-2xl md:text-3xl font-semibold text-center text-balance">
Welcome to the Secure Travel Rule Data Exchange
</h1>
<p class="py-4 text-lg">
Review the travel rule data and provide the required beneficiary information to accept the
transaction. If you're not yet part of the TRISA network, <a href="https://vaspdirectory.net/" target="_blank" class="underline text-blue-700">consider joining</a>
to streamline future Travel Rule compliance and secure data exchanges.
</p>

<!-- TODO: Add htmx attributes -->
<div id="sunrise-transaction"></div>

</section>

<!-- Reject modal -->
{{ template "transaction_rejection" . }}

{{ end }}

{{ define "appcode" }}
<script type="module" src="/static/js/msgSelElements.js"></script>
{{ end }}

0 comments on commit 2d8eb1b

Please sign in to comment.