panel-visual-badges
यह क्या करती है
यह स्किल डैशबोर्ड पैनलों में दृश्य तत्व जोड़ती है, जैसे स्टेटस बैज, छोटे थंबनेल और रंग-कोडित लेबल। यह रीट्राई और सहेजी सेटिंग वाले पैनल पैटर्न पर बनती है। यह उन लोगों के लिए है जो ऐसे डेटा डैशबोर्ड बना रहे हैं जिन्हें जल्दी पढ़ा जा सके।
कब इस्तेमाल करें
- ✓जब आप चाहते हैं कि डैशबोर्ड का कोई आइटम अपना स्रोत या स्टेटस रंगीन बैज से दिखाए।
- ✓जब आप डैशबोर्ड सूची के आइटम के साथ छोटे थंबनेल दिखाना चाहते हैं।
- ✓जब आप चाहते हैं कि रंग डेटा के आधार पर बदलें, जैसे स्टेटस या स्रोत के अनुसार।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/panel-visual-badges/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“क्या आप मेरे डैशबोर्ड के समाचार पैनल में रंगीन स्टेटस बैज और छोटे थंबनेल जोड़ सकते हैं?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
बैज के रंग और स्रोत की सेटिंग एक ही जगह रखी जाती हैं। पैनल उस डेटा को पढ़ता है और हर आइटम में बैज या इमेज जोड़ता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Robust UI Panel Components
Build visually rich, robust TypeScript UI components using a panel architecture pattern. This skill combines enhanced panel features (retry logic, state persistence) with a systematic workflow for adding visual enhancements (badges, thumbnails, dynamic styling).
Architecture Overview
Core Panel Features
- Retry Logic: Automatically retries failed data fetches with exponential backoff.
- State Persistence: Saves panel state (expanded/collapsed, size) to localStorage.
- Detailed Error Handling: Provides granular error messages and recovery options.
- Visual Enhancements: Systematic approach for adding badges, thumbnails, and dynamic styling.
Panel (base class)
├── element: HTMLElement (outer container, .panel)
│ ├── header: HTMLElement (.panel-header)
│ │ ├── headerLeft (.panel-header-left)
│ │ │ ├── title (.panel-title)
│ │ │ └── newBadge (.panel-new-badge) [optional]
│ │ ├── statusBadge (.panel-data-badge) [optional]
│ │ └── countEl (.panel-count) [optional]
│ ├── content: HTMLElement (.panel-content)
│ └── resizeHandle (.panel-resize-handle)
Implementation Workflow
1. Define Constants and Configuration
// Panel configuration
const PANEL_DEFAULTS = {
maxRetries: 3,
initialRetryDelay: 1000, // 1s
};
// Visual configuration
const SOURCE_COLORS: { [key: string]: string } = {
'Category A': '#FF6B6B',
'Category B': '#4ECDC4',
'default': '#95A5A6'
};
const THUMBNAIL_SIZE = 48; // pixels
2. Base Panel Class with Enhanced Features
export class Panel {
protected element: HTMLElement;
protected content: HTMLElement;
protected panelId: string;
private retryAttempts = 0;
private retryDelay = PANEL_DEFAULTS.initialRetryDelay;
constructor(options: PanelOptions) {
// ... existing constructor code ...
this.loadState();
}
protected async fetchWithRetry(url: string):<any> {
while (this.retryAttempts < PANEL_DEFAULTS.maxRetries) {
try {
const response = await fetch(url);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return await response.json();
} catch (error) {
this.retryAttempts++;
if (this.retryAttempts >= PANEL_DEFAULTS.maxRetries) {
throw new Error(`Failed after ${PANEL_DEFAULTS.maxRetries} attempts: ${error.message}`);
}
await new Promise(resolve => setTimeout(resolve, this.retryDelay));
this.retryDelay *= 2;
}
}
}
public saveState(): void {
localStorage.setItem(`panelState_${this.panelId}`, JSON.stringify({
isExpanded: !this.element.classList.contains('collapsed'),
width: this.element.style.width,
height: this.element.style.height
}));
}
public loadState(): void {
const savedState = localStorage.getItem(`panelState_${this.panelId}`);
if (savedState) {
const { isExpanded, width, height } = JSON.parse(savedState);
if (!isExpanded) this.element.classList.add('collapsed');
if (width) this.element.style.width = width;
if (height) this.element.style.height = height;
}
}
// Visual enhancement helpers
protected getColorForSource(source: string): string {
return SOURCE_COLORS[source] || SOURCE_COLORS['default'];
}
protected getThumbnailUrl(imageUrl?: string): string {
return imageUrl || `https://via.placeholder.com/${THUMBNAIL_SIZE}`;
}
}
3. Creating Enhanced Components
export class NewsPanel extends Panel {
private refreshTimer: ReturnType<typeof setInterval> | null = null;
constructor() {
super({ id: 'news', title: 'News Feed', showCount: true });
this.fetchData();
this.refreshTimer = setInterval(() => this.fetchData(), 60_000);
}
private async fetchData(): Promise<void> {
try {
const newsItems = await this.fetchWithRetry('/api/news');
this.render(newsItems);
this.setCount(newsItems.length);
this.saveState();
} catch (err) {
this.showError(`Failed to load news: ${err.message}`, () => {
this.retryAttempts = 0;
this.retryDelay = PANEL_DEFAULTS.initialRetryDelay;
this.fetchData();
});
}
}
private render(items: NewsItem[]): void {
const html = items.map(item => `
<div class="news-item">
<img src="${this.getThumbnailUrl(item.imageUrl)}" class="news-thumbnail">
<div class="news-content">
<h3>${item.tit
अक्सर पूछे जाने वाले सवाल
बैज के रंग कहां तय करें?
रंग एक ही कॉन्फ़िगरेशन ऑब्जेक्ट में सूचीबद्ध हैं, इसलिए आप उन्हें वहीं बदल सकते हैं।
क्या इसके लिए रीट्राई और सेटिंग वाला पैटर्न चाहिए?
बैज अकेले भी काम करते हैं, पर यह स्किल रीट्राई और सहेजी सेटिंग वाले पैनल पैटर्न पर बनने के लिए लिखी गई है।
क्या आप अपने बैज प्रकार जोड़ सकते हैं?
हां। कॉन्फ़िगरेशन में नई प्रविष्टि जोड़िए और फिर उसे पैनल में इस्तेमाल कीजिए।
जानकारी
लेखक का मूल विवरण
Create visually rich, robust TypeScript UI components with panel architecture, combining enhanced features like retry logic, state persistence, and dynamic styling with a systematic workflow for visual enhancements.
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #13075
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
agentpilot
7.8kआपके एजेंट को AgentPilot से प्रोजेक्ट को चरण-दर-चरण सुधारने में मदद करती है, जिसमें बदलाव सुझाए, परखे और स्कोर किए जाते हैं।
openspace
7.8kआपके एजेंट को OpenSpace सेट करने में मदद करती है, जो एजेंट स्किल्स सहेजता और वापस लाता है, और MCP के ज़रिए आपके AI ऐप से जुड़ता है।
rsi-arena
7.8kआपके एजेंट को AIME और Terminal-Bench जैसे मानक AI बेंचमार्क टेस्ट सेट करने और चलाने में मदद करती है, ताकि सुधार के तरीकों की तुलना हो सके।
experiment-guide
7.8kआपके एजेंट को छोटे प्रयोग बनाने, उनके नतीजे पढ़ने और जाँच के दौरान उपयोगी निष्कर्ष लिखने में मदद करती है।
मिलती-जुलती skills
canvas
394kयह आपके एजेंट को जुड़े Mac पैनल पर होस्टेड विज़ुअल विजेट दिखाने, पैनल छिपाने या उसे दूसरे पेज पर ले जाने देती है।
control-ui
394kयह आपके एजेंट को OpenClaw Control UI को व्यवस्थित करने और उसमें आने वाली दिक्कतें सुलझाने में मदद करती है, जिसमें सेशन, डैशबोर्ड और जुड़े Gateway शामिल हैं।
diagram-maker
394kयह आपके एजेंट को प्रक्रियाओं, सिस्टम आर्किटेक्चर और व्हाइटबोर्ड स्केच के लिए SVG, HTML या संपादन योग्य Excalidraw फ़ाइलों में साफ़ डायग्राम बनाने में मदद करती है।