From ba76e1fb40f9e9f07c115befc18440dbee1cb3e4 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Tue, 13 Aug 2024 17:02:08 +0300 Subject: [PATCH 1/6] login: only enable once initialized! --- kinode/src/http/login.html | 43 +++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/kinode/src/http/login.html b/kinode/src/http/login.html index 9a5ff601e..0e5481b54 100644 --- a/kinode/src/http/login.html +++ b/kinode/src/http/login.html @@ -143,7 +143,7 @@

oninput="document.getElementById('password-err').style.display = 'none';" value="" class="self-stretch mb-2">
- +
@@ -156,20 +156,27 @@

Logging in...

From 36a33f5108a2b7d41574311dffd41c5c65ae25fc Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Tue, 13 Aug 2024 20:05:31 +0300 Subject: [PATCH 2/6] wallet-using pages: show connect popup, render page content regardless --- .../src/register-ui/src/pages/CommitDotOsName.tsx | 10 ++++++++-- kinode/src/register-ui/src/pages/MintCustom.tsx | 10 ++++++++-- kinode/src/register-ui/src/pages/MintDotOsName.tsx | 10 ++++++++-- .../src/register-ui/src/pages/ResetDotOsName.tsx | 14 +++++++------- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/kinode/src/register-ui/src/pages/CommitDotOsName.tsx b/kinode/src/register-ui/src/pages/CommitDotOsName.tsx index 8b09ce24b..d63381e8c 100644 --- a/kinode/src/register-ui/src/pages/CommitDotOsName.tsx +++ b/kinode/src/register-ui/src/pages/CommitDotOsName.tsx @@ -53,6 +53,12 @@ function CommitDotOsName({ const enterOsNameProps = { name, setName, nameValidities, setNameValidities, triggerNameCheck } + useEffect(() => { + if (!address) { + openConnectModal?.(); + } + }, [address, openConnectModal]); + let handleCommit = useCallback(async (e: FormEvent) => { e.preventDefault() e.stopPropagation() @@ -88,7 +94,7 @@ function CommitDotOsName({ return (
- {Boolean(address) && ( + {
{isPending || isConfirming ? ( @@ -121,7 +127,7 @@ function CommitDotOsName({

)} - )} + }
); diff --git a/kinode/src/register-ui/src/pages/MintCustom.tsx b/kinode/src/register-ui/src/pages/MintCustom.tsx index 7c2754a9b..b2580f623 100644 --- a/kinode/src/register-ui/src/pages/MintCustom.tsx +++ b/kinode/src/register-ui/src/pages/MintCustom.tsx @@ -48,6 +48,12 @@ function MintCustom({ useEffect(() => setTriggerNameCheck(!triggerNameCheck), [address]) + useEffect(() => { + if (!address) { + openConnectModal?.(); + } + }, [address, openConnectModal]); + let handleMint = useCallback(async (e: FormEvent) => { e.preventDefault() e.stopPropagation() @@ -113,7 +119,7 @@ function MintCustom({ return (
- {Boolean(address) && ( + {
{isPending || isConfirming ? ( @@ -136,7 +142,7 @@ function MintCustom({

)} - )} + }
); diff --git a/kinode/src/register-ui/src/pages/MintDotOsName.tsx b/kinode/src/register-ui/src/pages/MintDotOsName.tsx index daf94befe..c95c8362c 100644 --- a/kinode/src/register-ui/src/pages/MintDotOsName.tsx +++ b/kinode/src/register-ui/src/pages/MintDotOsName.tsx @@ -44,6 +44,12 @@ function MintDotOsName({ useEffect(() => setTriggerNameCheck(!triggerNameCheck), [address]) + useEffect(() => { + if (!address) { + openConnectModal?.(); + } + }, [address, openConnectModal]); + let handleMint = useCallback(async (e: FormEvent) => { e.preventDefault() e.stopPropagation() @@ -107,7 +113,7 @@ function MintDotOsName({ return (
- {Boolean(address) && ( + {
{isPending || isConfirming ? ( @@ -126,7 +132,7 @@ function MintDotOsName({

)} - )} + }
); diff --git a/kinode/src/register-ui/src/pages/ResetDotOsName.tsx b/kinode/src/register-ui/src/pages/ResetDotOsName.tsx index fa926b2fb..698eb9385 100644 --- a/kinode/src/register-ui/src/pages/ResetDotOsName.tsx +++ b/kinode/src/register-ui/src/pages/ResetDotOsName.tsx @@ -67,9 +67,11 @@ function ResetKnsName({ // so inputs will validate once wallet is connected useEffect(() => setTriggerNameCheck(!triggerNameCheck), [address]); // eslint-disable-line react-hooks/exhaustive-deps - - // TODO: separate this whole namechecking thing into helper function - // boolean to branch whether to check for occupied or to match against our_address. + useEffect(() => { + if (!address) { + openConnectModal?.(); + } + }, [address, openConnectModal]); const nameDebouncer = useRef(null); useEffect(() => { @@ -152,8 +154,6 @@ function ResetKnsName({ return; } - - try { const data = await generateNetworkingKeys({ direct, @@ -202,7 +202,7 @@ function ResetKnsName({ return (
- {Boolean(address) && ( + {
{isPending || isConfirming ? ( @@ -230,7 +230,7 @@ function ResetKnsName({

)} - )} + }
); From 3ba1a2e53d596f165fae026ef35241707910e45b Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Tue, 13 Aug 2024 21:15:58 +0300 Subject: [PATCH 3/6] styling fixes, kinode.css and register-ui --- css/kinode.css | 14 +++++++++++--- kinode/src/register-ui/index.html | 1 + .../register-ui/src/components/DirectTooltip.tsx | 4 +++- kinode/src/register-ui/src/index.css | 8 ++++++++ kinode/src/register-ui/src/pages/Login.tsx | 6 ++++-- .../src/register-ui/src/pages/ResetDotOsName.tsx | 7 +++++-- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/css/kinode.css b/css/kinode.css index d2370582a..9c61482dd 100644 --- a/css/kinode.css +++ b/css/kinode.css @@ -20,7 +20,7 @@ input, button, textarea, select { - font: inherit; + font-family: var(--font-family-main); } /* Variables */ @@ -38,6 +38,8 @@ select { --maroon: #4f0000; --gray: #657b83; --tasteful-dark: #1f1f1f; + + --font-family-main: 'Kode Mono', monospace; } /* Typography */ @@ -49,10 +51,16 @@ h5, h6, p, label, -li { +li, +span { + font-family: var(--font-family-main); color: light-dark(var(--off-black), var(--off-white)); } +p { + font-size: 0.8em; +} + h1 { font-size: 2em; } @@ -78,6 +86,7 @@ h6 { } a { + font-family: var(--font-family-main); color: light-dark(var(--blue), var(--orange)); text-decoration: none; } @@ -89,7 +98,6 @@ a:hover { /* Layout */ body { - font-family: var(--font-family-main, sans-serif); line-height: 1.6; -webkit-font-smoothing: antialiased; background-color: light-dark(var(--tan), var(--tasteful-dark)); diff --git a/kinode/src/register-ui/index.html b/kinode/src/register-ui/index.html index ad784d8a0..c31db166e 100644 --- a/kinode/src/register-ui/index.html +++ b/kinode/src/register-ui/index.html @@ -11,6 +11,7 @@ + diff --git a/kinode/src/register-ui/src/components/DirectTooltip.tsx b/kinode/src/register-ui/src/components/DirectTooltip.tsx index 4958e7c74..f41cb7252 100644 --- a/kinode/src/register-ui/src/components/DirectTooltip.tsx +++ b/kinode/src/register-ui/src/components/DirectTooltip.tsx @@ -1,3 +1,5 @@ import { Tooltip } from "./Tooltip"; -export const DirectTooltip: React.FC = () => \ No newline at end of file +export const DirectTooltip: React.FC = () => + + \ No newline at end of file diff --git a/kinode/src/register-ui/src/index.css b/kinode/src/register-ui/src/index.css index ae0dbf510..0439292f2 100644 --- a/kinode/src/register-ui/src/index.css +++ b/kinode/src/register-ui/src/index.css @@ -29,6 +29,7 @@ } .tooltip-text { + font-size: 0.8em; visibility: hidden; width: 200px; background-color: #555; @@ -127,6 +128,7 @@ .kns-input { flex-grow: 1; padding: 0.5rem; + font-size: 1.2em; border: 1px solid var(--gray); border-radius: 4px 0 0 4px; } @@ -215,6 +217,7 @@ .checkbox-label { margin-left: 10px; + font-size: 0.9em; } .file-input-label { @@ -235,4 +238,9 @@ .file-input-label:hover .button { background-color: var(--dark-orange); color: var(--off-white); +} + +button.clear { + width: 100%; + background-color: var(--ansi-red); } \ No newline at end of file diff --git a/kinode/src/register-ui/src/pages/Login.tsx b/kinode/src/register-ui/src/pages/Login.tsx index e4f021e09..482887f06 100644 --- a/kinode/src/register-ui/src/pages/Login.tsx +++ b/kinode/src/register-ui/src/pages/Login.tsx @@ -3,6 +3,7 @@ import { PageProps, UnencryptedIdentity } from "../lib/types"; import Loader from "../components/Loader"; import { useNavigate } from "react-router-dom"; import { sha256, toBytes } from "viem"; +import { Tooltip } from "../components/Tooltip"; interface LoginProps extends PageProps { } @@ -89,8 +90,9 @@ function Login({ >
-

{knsName}

- ({isDirect ? "direct" : "indirect"} node) + +

{knsName}

+

- - Specify the node ID to reset + + Node ID to reset:

+

+ A reset will not delete any data. It only updates the networking information that your node publishes onchain. +

@@ -132,7 +132,7 @@ function ImportKeyfile({ {keyErrs.map((x, i) => (

{x}

))} - +

Please note: if the original node was booted as a direct node diff --git a/kinode/src/register-ui/src/pages/KinodeHome.tsx b/kinode/src/register-ui/src/pages/KinodeHome.tsx index 172909f7a..621cef203 100644 --- a/kinode/src/register-ui/src/pages/KinodeHome.tsx +++ b/kinode/src/register-ui/src/pages/KinodeHome.tsx @@ -27,12 +27,12 @@ function KinodeHome({ knsName }: OsHomeProps) { {previouslyBooted ? (

Welcome back!

- +
) : ( <>

Welcome to Kinode

-

New here? Register a username to get started

+

New here? Register a name to get started

Other options

- +
diff --git a/kinode/src/register-ui/src/pages/Login.tsx b/kinode/src/register-ui/src/pages/Login.tsx index 719b05140..f8a22c8dc 100644 --- a/kinode/src/register-ui/src/pages/Login.tsx +++ b/kinode/src/register-ui/src/pages/Login.tsx @@ -115,14 +115,14 @@ function Login({ )} - +
diff --git a/kinode/src/register-ui/src/pages/MintCustom.tsx b/kinode/src/register-ui/src/pages/MintCustom.tsx index b2580f623..6ab4b9f46 100644 --- a/kinode/src/register-ui/src/pages/MintCustom.tsx +++ b/kinode/src/register-ui/src/pages/MintCustom.tsx @@ -125,6 +125,9 @@ function MintCustom({ ) : ( <> +

+ Register a name on a different top-level zone -- this will likely fail if that zone's requirements are not met +

diff --git a/kinode/src/register-ui/src/pages/MintDotOsName.tsx b/kinode/src/register-ui/src/pages/MintDotOsName.tsx index c95c8362c..246521725 100644 --- a/kinode/src/register-ui/src/pages/MintDotOsName.tsx +++ b/kinode/src/register-ui/src/pages/MintDotOsName.tsx @@ -116,19 +116,19 @@ function MintDotOsName({ {
{isPending || isConfirming ? ( - + ) : ( <>
)} {isError && (

- Error: {error?.message || 'There was an error minting your dot-os-name, please try again.'} + Error: {error?.message || 'There was an error minting your name, please try again.'}

)} diff --git a/kinode/src/register-ui/src/pages/SetPassword.tsx b/kinode/src/register-ui/src/pages/SetPassword.tsx index 285e3536b..279a1732a 100644 --- a/kinode/src/register-ui/src/pages/SetPassword.tsx +++ b/kinode/src/register-ui/src/pages/SetPassword.tsx @@ -4,7 +4,7 @@ import { downloadKeyfile } from "../utils/download-keyfile"; import { Tooltip } from "../components/Tooltip"; import { sha256, toBytes } from "viem"; import { useSignTypedData, useAccount, useChainId } from 'wagmi' -import { KINOMAP } from "../abis"; +import { KIMAP } from "../abis"; type SetPasswordProps = { direct: boolean; @@ -61,7 +61,7 @@ function SetPassword({ name: "Kimap", version: "1", chainId: chainId, - verifyingContract: KINOMAP, + verifyingContract: KIMAP, }, types: { Boot: [ @@ -131,8 +131,8 @@ function SetPassword({ ) : (
- - + + setPw(e.target.value)} autoFocus @@ -154,7 +154,7 @@ function SetPassword({ required minLength={6} name="confirm-password" - placeholder="Min 6 characters" + placeholder="6 characters minimum" value={pw2} onChange={(e) => setPw2(e.target.value)} /> From 50c752455a70d56108494695196b26fa3fd04cfb Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Wed, 14 Aug 2024 00:07:37 +0300 Subject: [PATCH 6/6] style fixes --- kinode/src/register-ui/src/index.css | 1 + kinode/src/register-ui/src/pages/CommitDotOsName.tsx | 9 +++++---- kinode/src/register-ui/src/pages/MintDotOsName.tsx | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/kinode/src/register-ui/src/index.css b/kinode/src/register-ui/src/index.css index e6fad2cae..6a14edeb7 100644 --- a/kinode/src/register-ui/src/index.css +++ b/kinode/src/register-ui/src/index.css @@ -150,6 +150,7 @@ .error-message { color: var(--ansi-red); margin-top: 0.5rem; + overflow-wrap: break-word; } .direct-checkbox { diff --git a/kinode/src/register-ui/src/pages/CommitDotOsName.tsx b/kinode/src/register-ui/src/pages/CommitDotOsName.tsx index f6c8ee24d..8cb8b97ef 100644 --- a/kinode/src/register-ui/src/pages/CommitDotOsName.tsx +++ b/kinode/src/register-ui/src/pages/CommitDotOsName.tsx @@ -97,7 +97,7 @@ function CommitDotOsName({ { {isPending || isConfirming ? ( - + ) : ( <>

@@ -113,17 +113,18 @@ function CommitDotOsName({ type="submit" className="button" > - Register .os name + Register name +

This will confirm availability of the name and reserve it, then on the next screen you will be prompted to mint.

- Already have a dot-os-name? + Already have a node?

)} {isError && (

- Error: {error?.message || 'There was an error registering your dot-os-name, please try again.'} + Error: {error?.message || 'There was an error registering your name, please try again.'}

)}
diff --git a/kinode/src/register-ui/src/pages/MintDotOsName.tsx b/kinode/src/register-ui/src/pages/MintDotOsName.tsx index 246521725..a60e14bb0 100644 --- a/kinode/src/register-ui/src/pages/MintDotOsName.tsx +++ b/kinode/src/register-ui/src/pages/MintDotOsName.tsx @@ -121,7 +121,7 @@ function MintDotOsName({ <>