惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
Google DeepMind News
Google DeepMind News
G
Google Developers Blog
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
月光博客
月光博客
Jina AI
Jina AI
宝玉的分享
宝玉的分享
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net
V
V2EX
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
B
Blog
博客园 - 叶小钗
小众软件
小众软件
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
A
About on SuperTechFans
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Designing an AI Diagnosis Overlay — Why I Replaced the Fi...
hiyoyo · 2026-05-01 · via DEV Community
Cover image for Designing an AI Diagnosis Overlay — Why I Replaced the Fixed Panel With ESC-to-Close

hiyoyo

All tests run on an 8-year-old MacBook Air.

The first version of HiyokoLogcat's AI diagnosis UI was a fixed panel at the bottom of the screen.

It took up 30% of the vertical space — permanently. Even when you weren't using AI. Users hated it.

The second version: a full-screen overlay that appears on demand and disappears with ESC. Here's why it works better and how I built it.


The problem with fixed panels

A fixed AI panel makes a promise: "AI is always here." But most of the time, you're reading logs, not diagnosing them.

30% of screen space dedicated to a feature you use 10% of the time is a bad trade.

The overlay model makes a different promise: "AI appears when you need it and gets out of the way when you don't."


The React overlay

interface DiagnosisOverlayProps {
  isVisible: boolean;
  result: string;
  isLoading: boolean;
  onClose: () => void;
}

export function DiagnosisOverlay({
  isVisible, result, isLoading, onClose
}: DiagnosisOverlayProps) {
  // Close on ESC key
  useEffect(() => {
    const handleKey = (e: KeyboardEvent) => {
      if (e.key === 'Escape') onClose();
    };
    if (isVisible) {
      window.addEventListener('keydown', handleKey);
    }
    return () => window.removeEventListener('keydown', handleKey);
  }, [isVisible, onClose]);

  if (!isVisible) return null;

  return (

 {
        if (e.target === e.currentTarget) onClose();
      }}
    >


        
        {isLoading ? (

🐥 診断中...

        ) : (

{result}

        )}




  );
}

Enter fullscreen mode Exit fullscreen mode

Click the backdrop → close. Press ESC → close. Click X → close. Three ways out, none of them surprising.


The loading state

Gemini takes 2–6 seconds. The overlay needs to communicate that something is happening:

.loading {
  display: flex;
  align-items: center;
  gap: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

Enter fullscreen mode Exit fullscreen mode

A pulsing "diagnosing..." indicator. Simple. Users know the app is working.


Preserving the last result

Don't clear the diagnosis when the overlay closes. If the user closes it and re-opens it, they should see the same result without waiting for another API call:

const [lastResult, setLastResult] = useState('');
const [isOverlayOpen, setIsOverlayOpen] = useState(false);

const handleDiagnose = async (logLine: LogLine) => {
  setIsOverlayOpen(true);
  setIsLoading(true);
  const result = await diagnose(logLine);
  setLastResult(result);
  setIsLoading(false);
};

Enter fullscreen mode Exit fullscreen mode

The result persists until a new diagnosis is requested. Closes and reopens instantly.


The lesson

UI for AI features should follow the same principles as any other UI: take up space proportional to how often the feature is used, and get out of the way when it's not.

An overlay that appears on demand beats a permanent panel every time.


HiyokoLogcat is free and open source → github.com/hiyoyok/HiyokoLogcat
X → @hiyoyok