mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
feat: enhance index page with additional settings buttons and style adjustments
This commit is contained in:
parent
ba82d707d0
commit
e38a045de3
@ -9,13 +9,26 @@ templ InitialView() {
|
|||||||
@layout.Root("Sonr.ID") {
|
@layout.Root("Sonr.ID") {
|
||||||
@layout.Container() {
|
@layout.Container() {
|
||||||
@text.Header("Sonr.ID", "The decentralized identity layer for the web.")
|
@text.Header("Sonr.ID", "The decentralized identity layer for the web.")
|
||||||
<div class="pt-3 flex flex-col items-center justify-center h-full">
|
<div class="pt-1.5 flex flex-col items-center justify-center h-full">
|
||||||
<sl-button hx-target="#container" hx-get="/register" hx-push-url="/register" type="button">
|
<sl-button hx-target="#container" hx-get="/register" hx-push-url="/register" type="button">
|
||||||
<sl-icon slot="prefix" library="sonr" name="sonr"></sl-icon>
|
<sl-icon slot="prefix" library="sonr" name="sonr"></sl-icon>
|
||||||
Get Started
|
Get Started
|
||||||
<sl-icon slot="suffix" library="sonr" name="arrow-right"></sl-icon>
|
<sl-icon slot="suffix" library="sonr" name="arrow-right"></sl-icon>
|
||||||
</sl-button>
|
</sl-button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pt-1.5 flex flex-col items-center justify-center h-full">
|
||||||
|
<sl-button variant="default" size="small" circle>
|
||||||
|
<sl-icon name="gear" label="Settings"></sl-icon>
|
||||||
|
</sl-button>
|
||||||
|
|
||||||
|
<sl-button variant="default" size="medium" circle>
|
||||||
|
<sl-icon name="gear" label="Settings"></sl-icon>
|
||||||
|
</sl-button>
|
||||||
|
|
||||||
|
<sl-button variant="default" size="large" circle>
|
||||||
|
<sl-icon name="gear" label="Settings"></sl-icon>
|
||||||
|
</sl-button>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ func InitialView() templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <div class=\"pt-3 flex flex-col items-center justify-center h-full\"><sl-button hx-target=\"#container\" hx-get=\"/register\" hx-push-url=\"/register\" type=\"button\"><sl-icon slot=\"prefix\" library=\"sonr\" name=\"sonr\"></sl-icon> Get Started <sl-icon slot=\"suffix\" library=\"sonr\" name=\"arrow-right\"></sl-icon></sl-button></div>")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <div class=\"pt-1.5 flex flex-col items-center justify-center h-full\"><sl-button hx-target=\"#container\" hx-get=\"/register\" hx-push-url=\"/register\" type=\"button\"><sl-icon slot=\"prefix\" library=\"sonr\" name=\"sonr\"></sl-icon> Get Started <sl-icon slot=\"suffix\" library=\"sonr\" name=\"arrow-right\"></sl-icon></sl-button></div><div class=\"pt-1.5 flex flex-col items-center justify-center h-full\"><sl-button variant=\"default\" size=\"small\" circle><sl-icon name=\"gear\" label=\"Settings\"></sl-icon></sl-button> <sl-button variant=\"default\" size=\"medium\" circle><sl-icon name=\"gear\" label=\"Settings\"></sl-icon></sl-button> <sl-button variant=\"default\" size=\"large\" circle><sl-icon name=\"gear\" label=\"Settings\"></sl-icon></sl-button></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
package handlers
|
|
||||||
|
|
||||||
import "github.com/labstack/echo/v4"
|
|
||||||
|
|
||||||
func HandleLogin(c echo.Context) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// func LoginHandler(c echo.Context) error {
|
|
||||||
// options := PublicKeyCredentialRequestOptions{
|
|
||||||
// Challenge: "your-challenge-base64url",
|
|
||||||
// RpID: "yourdomain.com",
|
|
||||||
// Timeout: 60000,
|
|
||||||
// AllowCredentials: []CredentialDescriptor{
|
|
||||||
// {
|
|
||||||
// Type: "public-key",
|
|
||||||
// ID: "credential-id-base64url",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return GetCredentials(c, options)
|
|
||||||
// }
|
|
@ -124,66 +124,3 @@ templ formRegisterPasskey(action, method string, data RegisterPasskeyData) {
|
|||||||
</form>
|
</form>
|
||||||
}
|
}
|
||||||
|
|
||||||
templ formRegisterPasskey(action, method string, data RegisterPasskeyData) {
|
|
||||||
<form action={ templ.SafeURL(action) } method={ method } id="passkey-form">
|
|
||||||
<input type="hidden" name="credential" id="credential-data" required/>
|
|
||||||
<sl-card class="card-form gap-4 max-w-lg">
|
|
||||||
<div slot="header">
|
|
||||||
<div class="w-full py-2">
|
|
||||||
@sonrProfile(data.Address, data.Name, data.Handle, data.CreationBlock)
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<sl-select
|
|
||||||
label="Accounts"
|
|
||||||
value="SNR BTC ETH"
|
|
||||||
help-text="Select Blockchains to connect with your Vault"
|
|
||||||
multiple
|
|
||||||
class="custom-tag py-2"
|
|
||||||
>
|
|
||||||
@cryptoWalletOption("SNR", "Sonr", true)
|
|
||||||
@cryptoWalletOption("BTC", "Bitcoin", true)
|
|
||||||
@cryptoWalletOption("ETH", "Ethereum", true)
|
|
||||||
@cryptoWalletOption("SOL", "Solana", false)
|
|
||||||
@cryptoWalletOption("LTC", "Litecoin", false)
|
|
||||||
@cryptoWalletOption("DOGE", "Dogecoin", false)
|
|
||||||
@cryptoWalletOption("XRP", "Ripple", false)
|
|
||||||
@cryptoWalletOption("OSMO", "Osmosis", false)
|
|
||||||
@cryptoWalletOption("ATOM", "Cosmos", false)
|
|
||||||
@cryptoWalletOption("STARZ", "Stargaze", false)
|
|
||||||
@cryptoWalletOption("AKT", "Akash", false)
|
|
||||||
@cryptoWalletOption("EVMOS", "Evmos", false)
|
|
||||||
@cryptoWalletOption("FIL", "Filecoin", false)
|
|
||||||
@cryptoWalletOption("AXL", "Axelar", false)
|
|
||||||
</sl-select>
|
|
||||||
<script type="module">
|
|
||||||
const select = document.querySelector('.custom-tag');
|
|
||||||
|
|
||||||
select.getTag = (option, index) => {
|
|
||||||
// Use the same icon used in the <sl-option>
|
|
||||||
const name = option.querySelector('sl-icon[slot="prefix"]').name;
|
|
||||||
|
|
||||||
// You can return a string, a Lit Template, or an HTMLElement here
|
|
||||||
return `
|
|
||||||
<sl-tag removable>
|
|
||||||
<sl-icon name="${name}" library="crypto" style="padding-inline-end: .5rem;"></sl-icon>
|
|
||||||
${option.getTextLabel()}
|
|
||||||
</sl-tag>
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<div slot="footer" class="space-y-2">
|
|
||||||
@passkeyDropzone(data.Address, data.Handle, data.Challenge)
|
|
||||||
<sl-button href="/" style="width: 100%;" outline>
|
|
||||||
<sl-icon slot="prefix" name="x-lg"></sl-icon>
|
|
||||||
Cancel
|
|
||||||
</sl-button>
|
|
||||||
</div>
|
|
||||||
<style>
|
|
||||||
.card-form [slot='footer'] {
|
|
||||||
justify-content: space-evenly;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</sl-card>
|
|
||||||
</form>
|
|
||||||
}
|
|
||||||
|
@ -239,131 +239,4 @@ func formRegisterPasskey(action, method string, data RegisterPasskeyData) templ.
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func formRegisterPasskey(action, method string, data RegisterPasskeyData) templ.Component {
|
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
|
||||||
return templ_7745c5c3_CtxErr
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
|
||||||
if !templ_7745c5c3_IsBuffer {
|
|
||||||
defer func() {
|
|
||||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err == nil {
|
|
||||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
ctx = templ.InitializeContext(ctx)
|
|
||||||
templ_7745c5c3_Var9 := templ.GetChildren(ctx)
|
|
||||||
if templ_7745c5c3_Var9 == nil {
|
|
||||||
templ_7745c5c3_Var9 = templ.NopComponent
|
|
||||||
}
|
|
||||||
ctx = templ.ClearChildren(ctx)
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<form action=\"")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var10 templ.SafeURL = templ.SafeURL(action)
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var10)))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" method=\"")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var11 string
|
|
||||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(method)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/handlers/register/forms.templ`, Line: 128, Col: 55}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" id=\"passkey-form\"><input type=\"hidden\" name=\"credential\" id=\"credential-data\" required> <sl-card class=\"card-form gap-4 max-w-lg\"><div slot=\"header\"><div class=\"w-full py-2\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = sonrProfile(data.Address, data.Name, data.Handle, data.CreationBlock).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div><sl-select label=\"Accounts\" value=\"SNR BTC ETH\" help-text=\"Select Blockchains to connect with your Vault\" multiple class=\"custom-tag py-2\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("SNR", "Sonr", true).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("BTC", "Bitcoin", true).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("ETH", "Ethereum", true).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("SOL", "Solana", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("LTC", "Litecoin", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("DOGE", "Dogecoin", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("XRP", "Ripple", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("OSMO", "Osmosis", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("ATOM", "Cosmos", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("STARZ", "Stargaze", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("AKT", "Akash", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("EVMOS", "Evmos", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("FIL", "Filecoin", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = cryptoWalletOption("AXL", "Axelar", false).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</sl-select><script type=\"module\">\n const select = document.querySelector('.custom-tag');\n\n select.getTag = (option, index) => {\n // Use the same icon used in the <sl-option>\n const name = option.querySelector('sl-icon[slot=\"prefix\"]').name;\n\n // You can return a string, a Lit Template, or an HTMLElement here\n return `\n <sl-tag removable>\n <sl-icon name=\"${name}\" library=\"crypto\" style=\"padding-inline-end: .5rem;\"></sl-icon>\n ${option.getTextLabel()}\n </sl-tag>\n `;\n };\n </script><div slot=\"footer\" class=\"space-y-2\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = passkeyDropzone(data.Address, data.Handle, data.Challenge).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-button href=\"/\" style=\"width: 100%;\" outline><sl-icon slot=\"prefix\" name=\"x-lg\"></sl-icon> Cancel</sl-button></div><style>\n \t\t.card-form [slot='footer'] {\n \t\tjustify-content: space-evenly;\n \t\talign-items: center;\n \t\t}\n\t\t</style></sl-card></form>")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ = templruntime.GeneratedTemplate
|
var _ = templruntime.GeneratedTemplate
|
||||||
|
19
internal/gateway/session/checks.go
Normal file
19
internal/gateway/session/checks.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package session
|
||||||
|
|
||||||
|
import "github.com/labstack/echo/v4"
|
||||||
|
|
||||||
|
func IsUniqueHandle(c echo.Context, handle string) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsValidFirstName(c echo.Context, firstName string) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsValidLastInitial(c echo.Context, lastInitial string) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsHuman(c echo.Context, sum int) bool {
|
||||||
|
return true
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
package session
|
|
Loading…
x
Reference in New Issue
Block a user