Skip to main content
Glama
login-modal.tsx1.36 kB
"use client" import { Button } from "@repo/ui/components/ui/button" import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger } from "@repo/ui/components/ui/dialog" import type React from "react" import { useState } from "react" import { LoginForm } from "./signin-form" interface LoginModalProps { trigger?: React.ReactNode onSuccess?: () => void open?: boolean onOpenChange?: (open: boolean) => void } export function LoginModal({ trigger, onSuccess, open, onOpenChange }: LoginModalProps) { const [internalOpen, setInternalOpen] = useState(false) const isControlled = open !== undefined && onOpenChange !== undefined const isOpen = isControlled ? open : internalOpen const setIsOpen = isControlled ? onOpenChange : setInternalOpen const handleSuccess = () => { setIsOpen(false) onSuccess?.() } return ( <Dialog open={isOpen} onOpenChange={setIsOpen}> <DialogTrigger asChild>{trigger || <Button>登录</Button>}</DialogTrigger> <DialogContent className="sm:max-w-md p-0 border-none"> <DialogTitle className="sr-only"> 登录 </DialogTitle> <DialogDescription className="sr-only">请登录</DialogDescription> <LoginForm onSuccess={handleSuccess} onCancel={() => setIsOpen(false)} isModal={true} /> </DialogContent> </Dialog> ) }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/metacode0602/open-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server