mirror of
https://github.com/hoornet/vega.git
synced 2026-05-13 08:08:36 -07:00
Fix read-only mode: hide write actions when no signer
- ComposeBox, action row (reply/like/zap), and write article button all gated on getNDK().signer in addition to loggedIn - Prevents read-only (npub-only) users from seeing actions they can't use - Found during browser testing of the login path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useFeedStore } from "../../stores/feed";
|
import { useFeedStore } from "../../stores/feed";
|
||||||
import { useUserStore } from "../../stores/user";
|
import { useUserStore } from "../../stores/user";
|
||||||
import { fetchFollowFeed } from "../../lib/nostr";
|
import { fetchFollowFeed, getNDK } from "../../lib/nostr";
|
||||||
import { NoteCard } from "./NoteCard";
|
import { NoteCard } from "./NoteCard";
|
||||||
import { ComposeBox } from "./ComposeBox";
|
import { ComposeBox } from "./ComposeBox";
|
||||||
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
||||||
@@ -95,7 +95,7 @@ export function Feed() {
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
{/* Compose */}
|
{/* Compose */}
|
||||||
{loggedIn && <ComposeBox onPublished={loadFeed} />}
|
{loggedIn && !!getNDK().signer && <ComposeBox onPublished={loadFeed} />}
|
||||||
|
|
||||||
{/* Feed */}
|
{/* Feed */}
|
||||||
<div className="flex-1 overflow-y-auto">
|
<div className="flex-1 overflow-y-auto">
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useReactionCount } from "../../hooks/useReactionCount";
|
|||||||
import { useUserStore } from "../../stores/user";
|
import { useUserStore } from "../../stores/user";
|
||||||
import { useUIStore } from "../../stores/ui";
|
import { useUIStore } from "../../stores/ui";
|
||||||
import { timeAgo, shortenPubkey } from "../../lib/utils";
|
import { timeAgo, shortenPubkey } from "../../lib/utils";
|
||||||
import { publishReaction, publishReply } from "../../lib/nostr";
|
import { publishReaction, publishReply, getNDK } from "../../lib/nostr";
|
||||||
import { NoteContent } from "./NoteContent";
|
import { NoteContent } from "./NoteContent";
|
||||||
import { ZapModal } from "../zap/ZapModal";
|
import { ZapModal } from "../zap/ZapModal";
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ export function NoteCard({ event }: NoteCardProps) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Actions */}
|
{/* Actions */}
|
||||||
{loggedIn && (
|
{loggedIn && !!getNDK().signer && (
|
||||||
<div className="flex items-center gap-4 mt-2">
|
<div className="flex items-center gap-4 mt-2">
|
||||||
<button
|
<button
|
||||||
onClick={handleReply}
|
onClick={handleReply}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useState } from "react";
|
|||||||
import { useUIStore } from "../../stores/ui";
|
import { useUIStore } from "../../stores/ui";
|
||||||
import { useFeedStore } from "../../stores/feed";
|
import { useFeedStore } from "../../stores/feed";
|
||||||
import { useUserStore } from "../../stores/user";
|
import { useUserStore } from "../../stores/user";
|
||||||
|
import { getNDK } from "../../lib/nostr";
|
||||||
import { LoginModal } from "../shared/LoginModal";
|
import { LoginModal } from "../shared/LoginModal";
|
||||||
import { shortenPubkey } from "../../lib/utils";
|
import { shortenPubkey } from "../../lib/utils";
|
||||||
|
|
||||||
@@ -44,7 +45,7 @@ export function Sidebar() {
|
|||||||
|
|
||||||
{/* Nav */}
|
{/* Nav */}
|
||||||
<nav className="flex-1 overflow-y-auto py-2">
|
<nav className="flex-1 overflow-y-auto py-2">
|
||||||
{loggedIn && !sidebarCollapsed && (
|
{loggedIn && !!getNDK().signer && !sidebarCollapsed && (
|
||||||
<button
|
<button
|
||||||
onClick={() => setView("article-editor")}
|
onClick={() => setView("article-editor")}
|
||||||
className={`w-full text-left px-3 py-1.5 flex items-center gap-2 text-[12px] transition-colors mb-1 ${
|
className={`w-full text-left px-3 py-1.5 flex items-center gap-2 text-[12px] transition-colors mb-1 ${
|
||||||
|
|||||||
Reference in New Issue
Block a user