Skip to content

Commit

Permalink
feat: nwc connection page ui (#151)
Browse files Browse the repository at this point in the history
* feat: nwc connection page ui

* feat: add new app creation ui

* chore: small fixes

* chore: refactor code

* chore: use readonly instead of disabled

* feat: new ui

* fix: styles, darkmode, descriptions

* chore: further changes

* ⚠️chore: remove support for query params

* chore: ignore don't remove

* fix: dark mode styling

* fix: copy & smaller style fixes

---------

Co-authored-by: im-adithya <[email protected]>
Co-authored-by: René Aaron <[email protected]>
  • Loading branch information
3 people authored Nov 1, 2023
1 parent 0cca7d3 commit 82dafa2
Show file tree
Hide file tree
Showing 18 changed files with 374 additions and 304 deletions.
4 changes: 2 additions & 2 deletions echo_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ func (svc *Service) AppsNewHandler(c echo.Context) error {

requestMethods = strings.Join(keys, " ")
}
budgetEnabled := maxAmount != "" || budgetRenewal != ""
csrf, _ := c.Get(middleware.DefaultCSRFConfig.ContextKey).(string)

user, err := svc.GetUser(c)
Expand All @@ -280,13 +279,15 @@ func (svc *Service) AppsNewHandler(c echo.Context) error {
//and indicate which ones are checked by default in the front-end
type RequestMethodHelper struct {
Description string
Icon string
Checked bool
}

requestMethodHelper := map[string]*RequestMethodHelper{}
for k, v := range nip47MethodDescriptions {
requestMethodHelper[k] = &RequestMethodHelper{
Description: v,
Icon: nip47MethodIcons[k],
}
}

Expand All @@ -304,7 +305,6 @@ func (svc *Service) AppsNewHandler(c echo.Context) error {
"MaxAmount": maxAmount,
"BudgetRenewal": budgetRenewal,
"ExpiresAt": expiresAt,
"BudgetEnabled": budgetEnabled,
"RequestMethods": requestMethods,
"RequestMethodHelper": requestMethodHelper,
"Disabled": disabled,
Expand Down
21 changes: 14 additions & 7 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,17 @@ const (
)

var nip47MethodDescriptions = map[string]string{
NIP_47_GET_BALANCE_METHOD: "Read your balance.",
NIP_47_PAY_INVOICE_METHOD: "Send payments from your wallet.",
NIP_47_MAKE_INVOICE_METHOD: "Create invoices on your behalf.",
NIP_47_LOOKUP_INVOICE_METHOD: "Lookup status of created invoices.",
NIP_47_GET_BALANCE_METHOD: "Read your balance",
NIP_47_PAY_INVOICE_METHOD: "Send payments",
NIP_47_MAKE_INVOICE_METHOD: "Create invoices",
NIP_47_LOOKUP_INVOICE_METHOD: "Lookup status of invoices",
}

var nip47MethodIcons = map[string]string{
NIP_47_GET_BALANCE_METHOD: "wallet",
NIP_47_PAY_INVOICE_METHOD: "lightning",
NIP_47_MAKE_INVOICE_METHOD: "invoice",
NIP_47_LOOKUP_INVOICE_METHOD: "search",
}

type AlbyMe struct {
Expand Down Expand Up @@ -197,6 +204,6 @@ type Nip47LookupInvoiceParams struct {
}

type Nip47LookupInvoiceResponse struct {
Invoice string `json:"invoice"`
Paid bool `json:"paid"`
}
Invoice string `json:"invoice"`
Paid bool `json:"paid"`
}
Loading

0 comments on commit 82dafa2

Please sign in to comment.