diff --git a/src/components/NetworkIcon/NetworkIcon.tsx b/src/components/NetworkIcon/NetworkIcon.tsx index aed3dac..4b62669 100644 --- a/src/components/NetworkIcon/NetworkIcon.tsx +++ b/src/components/NetworkIcon/NetworkIcon.tsx @@ -1,4 +1,11 @@ -export function NetworkIcon() { +type Props = { + active?: boolean; +}; + +export function NetworkIcon({ active }: Props) { + const stroke = active + ? "var(--codex-color-primary)" + : "rgb(var(--codex-color-error))"; return ( - + ); } diff --git a/src/components/OnBoarding/OnBoardingStepThree.css b/src/components/OnBoarding/OnBoardingStepThree.css index 7818412..f3bdc05 100644 --- a/src/components/OnBoarding/OnBoardingStepThree.css +++ b/src/components/OnBoarding/OnBoardingStepThree.css @@ -27,6 +27,13 @@ animation: rotateAnimation 2s linear infinite; } +.onboarding-group { + display: flex; + align-items: center; + gap: 1rem; + margin-bottom: 0.5rem; +} + @keyframes rotate { from { transform: rotate(0deg); /* Start at 0 degrees */ diff --git a/src/components/OnBoarding/OnBoardingStepThree.tsx b/src/components/OnBoarding/OnBoardingStepThree.tsx index 216ce6c..5f682f9 100644 --- a/src/components/OnBoarding/OnBoardingStepThree.tsx +++ b/src/components/OnBoarding/OnBoardingStepThree.tsx @@ -1,10 +1,17 @@ -import { CheckIcon, RefreshCcw, X } from "lucide-react"; +import { CheckIcon, RefreshCcw, Save, X } from "lucide-react"; import { classnames } from "../../utils/classnames"; import "./OnBoardingStepThree.css"; import { usePortForwarding } from "../../hooks/usePortForwarding"; import { useCodexConnection } from "../../hooks/useCodexConnection"; -import { SimpleText } from "@codex-storage/marketplace-ui-components"; -import { useEffect } from "react"; +import { + Button, + ButtonIcon, + Input, + SimpleText, +} from "@codex-storage/marketplace-ui-components"; +import { useEffect, useState } from "react"; +import { CodexSdk } from "../../sdk/codex"; +import { useQueryClient } from "@tanstack/react-query"; type Props = { online: boolean; @@ -14,17 +21,43 @@ type Props = { export function OnBoardingStepThree({ online, onStepValid }: Props) { const portForwarding = usePortForwarding(online); const codex = useCodexConnection(); + const [url, setUrl] = useState(CodexSdk.url); + const queryClient = useQueryClient(); useEffect(() => { onStepValid(online && portForwarding.enabled && codex.enabled); }, [portForwarding.enabled, codex.enabled, onStepValid, online]); + const onChange = (e: React.FormEvent) => { + const value = e.currentTarget.value; + if (value) { + setUrl(value); + } + }; + + const onSave = () => + CodexSdk.updateURL(url) + .then(() => queryClient.invalidateQueries()) + .then(() => codex.refetch()); + const InternetIcon = online ? CheckIcon : X; const PortForWarningIcon = portForwarding.enabled ? CheckIcon : X; const CodexIcon = codex.enabled ? CheckIcon : X; return (
+
+
+ +
+ + +

{text}

- +