{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "quote-dialog",
  "type": "registry:block",
  "title": "Lens Quote Post Dialog",
  "description": "A dialog component for quoting Lens Posts, allowing users to add their own commentary while sharing the original post.",
  "dependencies": [
    "@lens-protocol/react@0.0.0-canary-20250820102520",
    "@lens-protocol/client@0.0.0-canary-20250820102520",
    "lucide-react",
    "wagmi@2.15.3"
  ],
  "registryDependencies": [
    "avatar",
    "button",
    "dialog",
    "spinner",
    "skeleton",
    "https://lensblocks.com/r/text-editor.json",
    "https://lensblocks.com/r/post-provider.json",
    "https://lensblocks.com/r/post.json",
    "https://lensblocks.com/r/use-authenticated-account.json",
    "https://lensblocks.com/r/use-post-context.json",
    "https://lensblocks.com/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/new-york/blocks/feed/lens-quote-dialog.tsx",
      "content": "\"use client\";\n\nimport { TxHash, useSessionClient } from \"@lens-protocol/react\";\nimport { forwardRef, useImperativeHandle, useRef, useState } from \"react\";\nimport { LensTextEditor, TextEditorRef } from \"@/registry/new-york/components/common/editor/lens-text-editor\";\nimport { LensPostProvider } from \"@/registry/new-york/lib/lens-post-provider\";\nimport { LensPost } from \"@/registry/new-york/blocks/feed/lens-post\";\nimport { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from \"@/registry/new-york/ui/dialog\";\nimport { Avatar, AvatarFallback, AvatarImage } from \"@/registry/new-york/ui/avatar\";\nimport { parseUri } from \"@/registry/new-york/lib/lens-utils\";\nimport { UserCircle2 } from \"lucide-react\";\nimport { useAuthenticatedLensAccount } from \"@/registry/new-york/hooks/use-authenticated-lens-account\";\nimport { Button } from \"@/registry/new-york/ui/button\";\nimport { useLensPostContext } from \"@/registry/new-york/hooks/use-lens-post-context\";\nimport { Spinner } from \"@/registry/new-york/ui/spinner\";\n\nexport interface QuoteDialogRef {\n  open: () => void;\n  close: () => void;\n  isOpen: boolean;\n}\n\nexport interface QuoteDialogProps {\n  onQuoteCreated?: (txHash: TxHash) => void;\n  onError?: (error: Error) => void;\n}\n\nexport const LensQuoteDialog = forwardRef<QuoteDialogRef, QuoteDialogProps>((props, ref) => {\n  const { onQuoteCreated, onError } = props;\n  const [dialogOpen, setDialogOpen] = useState(false);\n  const [isSubmitting, setIsSubmitting] = useState(false);\n\n  const session = useSessionClient();\n  const { data: account, loading: accountLoading } = useAuthenticatedLensAccount();\n  const { post, quote, sessionClient } = useLensPostContext();\n\n  const textEditor = useRef<TextEditorRef>(null);\n\n  useImperativeHandle(ref, () => ({\n    open: () => setDialogOpen(true),\n    close: () => setDialogOpen(false),\n    isOpen: dialogOpen,\n  }));\n\n  const handleSubmit = async () => {\n    if (isSubmitting) return;\n    setIsSubmitting(true);\n    try {\n      const content = textEditor.current?.getContent() || \"\";\n      const txHash = await quote(content);\n      if (txHash) {\n        onQuoteCreated?.(txHash);\n        setDialogOpen(false);\n      }\n    } catch (error) {\n      if (error instanceof Error) {\n        onError?.(error);\n      }\n    } finally {\n      setIsSubmitting(false);\n    }\n  };\n\n  return (\n    <Dialog open={dialogOpen} onOpenChange={setDialogOpen}>\n      <DialogContent className=\"sm:max-w-2xl\">\n        <DialogHeader className=\"text-left border-b\">\n          <DialogTitle>Create a post</DialogTitle>\n        </DialogHeader>\n        <div className=\"flex flex-col px-4\">\n          <div className=\"flex gap-4\">\n            <div className=\"flex-none\">\n              {accountLoading ? (\n                <div className=\"w-10 h-10 border rounded-full flex items-center justify-center\">\n                  <Spinner />\n                </div>\n              ) : (\n                <Avatar className=\"flex-none w-10 h-10\">\n                  <AvatarImage src={parseUri(account?.metadata?.picture)} alt={`${account?.address}'s avatar`} />\n                  <AvatarFallback>\n                    <UserCircle2 className=\"w-10 h-10 opacity-45\" />\n                  </AvatarFallback>\n                </Avatar>\n              )}\n            </div>\n            <div className=\"flex-grow mt-2 pb-7\">\n              <LensTextEditor ref={textEditor} lensClient={sessionClient} className=\"p-0 min-h-20\" />\n            </div>\n          </div>\n          {post && (\n            <LensPostProvider session={session} postId={post.id}>\n              <div className=\"md:pl-14\">\n                <LensPost showActions={false} className=\"border rounded-xl\" contentClassName=\"md:text-sm\" />\n              </div>\n            </LensPostProvider>\n          )}\n        </div>\n        <DialogFooter className=\"justify-end border-t\">\n          <Button onClick={handleSubmit} disabled={isSubmitting}>\n            {isSubmitting ? (\n              <>\n                <Spinner /> Posting...\n              </>\n            ) : (\n              \"Post\"\n            )}\n          </Button>\n        </DialogFooter>\n      </DialogContent>\n    </Dialog>\n  );\n});\n",
      "type": "registry:block"
    }
  ]
}
