Skip to content

improve buttons ui - #21

Merged
Catrya merged 2 commits into
mainfrom
botones
Apr 13, 2026
Merged

improve buttons ui#21
Catrya merged 2 commits into
mainfrom
botones

Conversation

@Catrya

@Catrya Catrya commented Apr 13, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • In-app guidance now prompts users to enter a relay before using Search or Stream, with contextual hints shown under the action buttons.
  • Bug Fixes

    • Search and Stream actions now prevent proceeding when no relays are configured, reducing confusing failures.
  • Documentation

    • Removed legacy “Vibed with MKStack” attribution and updated project attribution wording in the README.

@coderabbitai

coderabbitai Bot commented Apr 13, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4675d588-959b-438c-9044-4d6d2d3f2191

📥 Commits

Reviewing files that changed from the base of the PR and between f481c8a and 544315c.

📒 Files selected for processing (4)
  • .cursorrules
  • .github/copilot-instructions.md
  • .goosehints
  • README.md
💤 Files with no reviewable changes (3)
  • .github/copilot-instructions.md
  • .cursorrules
  • .goosehints
✅ Files skipped from review due to trivial changes (1)
  • README.md

📝 Walkthrough

Walkthrough

Add a noRelayHint state and early-return logic to EventMonitor.tsx so Search/Stream attempts with zero valid relays set a hint and display "Enter a relay first" instead of proceeding; several doc/instruction files had a small removal of an MKStack attribution section and README attribution text updated.

Changes

Cohort / File(s) Summary
EventMonitor UI & logic
src/pages/EventMonitor.tsx
Added noRelayHint state ('search' | 'stream' | null), effect to clear it when validRelays.length > 0, updated handleSearch/handleStream to set hint and return early if no relays, changed button label text to show "Enter a relay first" when hinted, and removed validRelays.length === 0 from Search disabling logic. Minor footer whitespace reformat.
Docs / build instructions
.cursorrules, .github/copilot-instructions.md, .goosehints, README.md
Removed the “Vibed with MKStack” UI/build-time instruction and link from three instruction files; updated README attribution line text. No functional code changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I sniffed the relays and tapped the key,
If none are present, I whisper, "Look, see?"
"Enter a relay first," I politely plea,
Then hop aside until one comes to tea. 🥕✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'improve buttons ui' is vague and does not specifically describe the main changes. While button UI improvements exist, the changes also include state management, relay validation logic, and removal of attribution references—none of which are conveyed by the generic title. Consider a more specific title such as 'Add relay validation hints to Search/Stream buttons' or 'Improve button UI with relay feedback' to better reflect the primary change.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch botones

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pages/EventMonitor.tsx (1)

895-926: ⚠️ Potential issue | 🟡 Minor

Make button helper feedback announceable for screen readers.

The text at Line 901 and Line 924 updates dynamically, but it is not exposed as a live status message. Add aria-describedby + aria-live so “Enter a relay first” is announced when it appears.

♿ Suggested accessibility patch
                   <Button
                     type="submit"
                     disabled={isLoading}
+                    aria-describedby="search-action-hint"
                     className="h-8 px-4 text-xs bg-accent/80 hover:bg-accent border-accent/50"
                   >
                     Search
                   </Button>
-                  <span className="text-[10px] text-muted-foreground">
+                  <span
+                    id="search-action-hint"
+                    role="status"
+                    aria-live="polite"
+                    className="text-[10px] text-muted-foreground"
+                  >
                     {noRelayHint === 'search' ? 'Enter a relay first' : 'Fetch once'}
                   </span>
@@
                     <Button
                       type="button"
                       variant="outline"
                       onClick={() => setIsStreaming(false)}
+                      aria-describedby="stream-action-hint"
                       className="h-8 px-4 text-xs bg-destructive/10 border-destructive/30 hover:bg-destructive/20"
                     >
                       Stop
@@
                     <Button
                       type="button"
                       onClick={handleStream}
+                      aria-describedby="stream-action-hint"
                       className="h-8 px-4 text-xs bg-accent/80 hover:bg-accent border-accent/50"
                     >
                       Stream
                     </Button>
@@
-                  <span className="text-[10px] text-muted-foreground">
+                  <span
+                    id="stream-action-hint"
+                    role="status"
+                    aria-live="polite"
+                    className="text-[10px] text-muted-foreground"
+                  >
                     {noRelayHint === 'stream' ? 'Enter a relay first' : isStreaming ? 'Stop streaming' : 'Real-time'}
                   </span>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/EventMonitor.tsx` around lines 895 - 926, The dynamic helper text
next to the Search and Stream/Stop buttons (driven by noRelayHint and
isStreaming) isn't exposed to screen readers; update the Button elements and
their helper spans so the spans have an id (e.g., searchHelperId and
streamHelperId), add aria-describedby on the corresponding Button components
referencing those ids, and mark the helper spans with aria-live="polite" (or
"assertive" if needed) so the messages like "Enter a relay first" are announced
when noRelayHint changes; ensure the Stop/Stream button toggle uses the same
streamHelperId and aria-describedby tied to isStreaming state.
🧹 Nitpick comments (1)
src/pages/EventMonitor.tsx (1)

461-481: Deduplicate the no-relay guard used by Search and Stream handlers.

Lines 461-476 repeat the same relay check/reset logic. Extracting a shared helper will keep both actions aligned and reduce drift risk.

♻️ Proposed refactor
+  const ensureRelayOrHint = useCallback((hint: 'search' | 'stream') => {
+    if (validRelays.length === 0) {
+      setNoRelayHint(hint);
+      return false;
+    }
+    setNoRelayHint(null);
+    return true;
+  }, [validRelays.length]);
+
   const handleSearch = useCallback(() => {
-    if (validRelays.length === 0) {
-      setNoRelayHint('search');
-      return;
-    }
-    setNoRelayHint(null);
+    if (!ensureRelayOrHint('search')) return;
     setIsStreaming(false);
     setError(null);
     refetch();
-  }, [validRelays.length, refetch]);
+  }, [ensureRelayOrHint, refetch]);
 
   const handleStream = useCallback(() => {
-    if (validRelays.length === 0) {
-      setNoRelayHint('stream');
-      return;
-    }
-    setNoRelayHint(null);
+    if (!ensureRelayOrHint('stream')) return;
     setError(null);
     setIsStreaming(false);
     // Re-trigger the streaming effect
     setTimeout(() => setIsStreaming(true), 0);
-  }, [validRelays.length]);
+  }, [ensureRelayOrHint]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/EventMonitor.tsx` around lines 461 - 481, Extract the duplicated
relay-check/reset logic into a small helper (e.g., ensureRelaysAvailable or
checkRelaysAndReset) that accepts a hint type ('search' | 'stream') and returns
a boolean indicating whether it short-circuited; inside it perform the existing
check on validRelays.length, call setNoRelayHint(hint) and return true if no
relays, otherwise call setNoRelayHint(null), setError(null) and
setIsStreaming(false) and return false; then replace the duplicated blocks in
the search/refetch block (the block that currently does if (validRelays.length
=== 0) { setNoRelayHint('search'); return; ... refetch(); }) and in handleStream
to call the helper (if helper('search') return; ... refetch(); and if
helper('stream') return; ... setTimeout(() => setIsStreaming(true), 0);) so both
flows use the same guard.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/EventMonitor.tsx`:
- Around line 1260-1269: The footer attribution is missing the required "Vibed
with MKStack" link; update the JSX in the EventMonitor component near the
existing "Vibed by" block (the anchor currently linking to Catrya) to include an
additional anchor element that reads "Vibed with MKStack" and links to
https://soapbox.pub/mkstack (open in new tab with rel="noopener noreferrer"),
placing it adjacent to the existing attribution so both appear in the footer on
first site build.

---

Outside diff comments:
In `@src/pages/EventMonitor.tsx`:
- Around line 895-926: The dynamic helper text next to the Search and
Stream/Stop buttons (driven by noRelayHint and isStreaming) isn't exposed to
screen readers; update the Button elements and their helper spans so the spans
have an id (e.g., searchHelperId and streamHelperId), add aria-describedby on
the corresponding Button components referencing those ids, and mark the helper
spans with aria-live="polite" (or "assertive" if needed) so the messages like
"Enter a relay first" are announced when noRelayHint changes; ensure the
Stop/Stream button toggle uses the same streamHelperId and aria-describedby tied
to isStreaming state.

---

Nitpick comments:
In `@src/pages/EventMonitor.tsx`:
- Around line 461-481: Extract the duplicated relay-check/reset logic into a
small helper (e.g., ensureRelaysAvailable or checkRelaysAndReset) that accepts a
hint type ('search' | 'stream') and returns a boolean indicating whether it
short-circuited; inside it perform the existing check on validRelays.length,
call setNoRelayHint(hint) and return true if no relays, otherwise call
setNoRelayHint(null), setError(null) and setIsStreaming(false) and return false;
then replace the duplicated blocks in the search/refetch block (the block that
currently does if (validRelays.length === 0) { setNoRelayHint('search'); return;
... refetch(); }) and in handleStream to call the helper (if helper('search')
return; ... refetch(); and if helper('stream') return; ... setTimeout(() =>
setIsStreaming(true), 0);) so both flows use the same guard.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fc0bb996-50c5-4ea7-8a94-a1e73365349d

📥 Commits

Reviewing files that changed from the base of the PR and between 13fc07a and f481c8a.

📒 Files selected for processing (1)
  • src/pages/EventMonitor.tsx

Comment thread src/pages/EventMonitor.tsx
@Catrya

Catrya commented Apr 13, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 13, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Catrya
Catrya merged commit 5f5ce46 into main Apr 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant