mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-10 15:36:53 +02:00
feat: make sign-in message clickable to open login dialog
Add clickable 'Sign in' link to the logged-out message composer: - Import LoginDialog component - Add showLogin state management - Make 'Sign in' text an underlined button that opens the login dialog - Add LoginDialog component with controlled state This provides a better UX by allowing users to quickly sign in directly from the chat interface.
This commit is contained in:
@@ -43,6 +43,7 @@ import { StatusBadge } from "./live/StatusBadge";
|
||||
import { ChatMessageContextMenu } from "./chat/ChatMessageContextMenu";
|
||||
import { useGrimoire } from "@/core/state";
|
||||
import { Button } from "./ui/button";
|
||||
import LoginDialog from "./nostr/LoginDialog";
|
||||
import {
|
||||
MentionEditor,
|
||||
type MentionEditorHandle,
|
||||
@@ -591,6 +592,9 @@ export function ChatViewer({
|
||||
// State for tooltip open (for mobile tap support)
|
||||
const [tooltipOpen, setTooltipOpen] = useState(false);
|
||||
|
||||
// State for login dialog
|
||||
const [showLogin, setShowLogin] = useState(false);
|
||||
|
||||
// Handle sending messages with error handling
|
||||
const handleSend = async (
|
||||
content: string,
|
||||
@@ -1104,9 +1108,18 @@ export function ChatViewer({
|
||||
</div>
|
||||
) : (
|
||||
<div className="border-t px-2 py-1 text-center text-sm text-muted-foreground">
|
||||
Sign in to send messages
|
||||
<button
|
||||
onClick={() => setShowLogin(true)}
|
||||
className="hover:text-foreground transition-colors underline"
|
||||
>
|
||||
Sign in
|
||||
</button>{" "}
|
||||
to send messages
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Login dialog */}
|
||||
<LoginDialog open={showLogin} onOpenChange={setShowLogin} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user