diff --git a/components/ipns-inspector.tsx b/components/ipns-inspector.tsx index 511e5f2..5882e8e 100644 --- a/components/ipns-inspector.tsx +++ b/components/ipns-inspector.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react' +import React, { useState, useEffect } from 'react' import { useMachine } from '@xstate/react' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Button } from '@/components/ui/button' @@ -63,6 +63,16 @@ export default function IPNSInspector() { : 'inspect' const { error } = state.context + // Prefill IPNS Name from URL fragment on mount to support sharing/bookmarking + useEffect(() => { + if (typeof window !== 'undefined' && window.location.hash) { + const fragment = window.location.hash.substring(1) // Remove the # prefix + if (fragment) { + send({ type: 'UPDATE_NAME', value: fragment }) + } + } + }, [send]) + return ( @@ -89,7 +99,13 @@ export default function IPNSInspector() { placeholder="k51... or 12D..." />