Files
plugin-manager/test/electron/index.html

380 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>@paarrot/plugin-manager — Electron Test</title>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', system-ui, sans-serif;
font-size: 13px;
background: #1a1a2e;
color: #e0e0e0;
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
}
header {
padding: 10px 16px;
background: #16213e;
border-bottom: 1px solid #0f3460;
display: flex;
align-items: center;
gap: 12px;
}
header h1 { font-size: 14px; font-weight: 600; color: #e94560; }
#status-badge {
font-size: 11px;
padding: 2px 8px;
border-radius: 10px;
background: #333;
color: #888;
}
#status-badge.loaded { background: #1a4a2e; color: #4caf50; }
main {
flex: 1;
display: grid;
/* left: plugin manager, center: commands+interceptor, right: settings+log */
grid-template-columns: 280px 1fr 1fr;
grid-template-rows: 1fr 1fr;
gap: 1px;
background: #0f3460;
overflow: hidden;
}
/* Plugin manager spans both rows */
#panel-manager {
grid-row: 1 / 3;
}
.panel {
background: #1a1a2e;
display: flex;
flex-direction: column;
overflow: hidden;
}
.panel-header {
padding: 8px 12px;
background: #16213e;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: #7986cb;
border-bottom: 1px solid #0f3460;
flex-shrink: 0;
}
.panel-body {
flex: 1;
padding: 12px;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 10px;
}
/* Inputs / buttons */
input[type="text"], select {
background: #0f3460;
border: 1px solid #233a6e;
color: #e0e0e0;
padding: 6px 10px;
border-radius: 4px;
font-size: 13px;
width: 100%;
outline: none;
}
input[type="text"]:focus, select:focus { border-color: #7986cb; }
button {
padding: 6px 14px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 12px;
font-weight: 600;
background: #0f3460;
color: #e0e0e0;
transition: background 0.15s;
}
button:hover { background: #1a4a8e; }
button.primary { background: #e94560; color: #fff; }
button.primary:hover { background: #c73652; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; }
/* Command list */
#cmd-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
#cmd-list li { font-size: 12px; color: #aaa; }
#cmd-list code { color: #e94560; font-size: 12px; }
/* Message result */
#msg-result {
background: #0f3460;
border: 1px solid #233a6e;
border-radius: 4px;
padding: 8px;
font-family: monospace;
font-size: 12px;
white-space: pre-wrap;
min-height: 52px;
color: #b0bec5;
}
/* Settings */
.setting-row {
display: flex;
align-items: center;
gap: 10px;
padding: 6px 0;
border-bottom: 1px solid #12244a;
}
.setting-row label { flex: 1; color: #b0bec5; font-size: 12px; }
.setting-row input[type="checkbox"] { width: auto; }
.setting-row input[type="text"], .setting-row select { width: 140px; flex: none; }
/* Log */
#log {
flex: 1;
overflow-y: auto;
font-family: monospace;
font-size: 11px;
display: flex;
flex-direction: column;
gap: 2px;
}
.log-entry { padding: 2px 0; }
.log-log { color: #90a4ae; }
.log-info { color: #7986cb; }
.log-success { color: #4caf50; }
.log-error { color: #e94560; }
.log-warn { color: #ffb300; }
/* Theme section */
.theme-row { display: flex; gap: 8px; flex-wrap: wrap; }
/* Plugin manager cards */
.plugin-card {
background: #0f3460;
border: 1px solid #1e3a6e;
border-radius: 6px;
padding: 10px;
display: flex;
flex-direction: column;
gap: 6px;
}
.plugin-card-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
}
.plugin-name { font-weight: 700; font-size: 13px; color: #e0e0e0; }
.plugin-version { font-size: 10px; color: #7986cb; background: #162250; padding: 1px 6px; border-radius: 8px; }
.plugin-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.badge {
font-size: 10px;
padding: 1px 6px;
border-radius: 8px;
background: #162250;
color: #90caf9;
white-space: nowrap;
}
.badge.green { background: #1a4a2e; color: #4caf50; }
.badge.red { background: #4a1a1a; color: #e94560; }
.badge.amber { background: #4a3a00; color: #ffb300; }
.plugin-unload-btn {
font-size: 10px;
padding: 2px 8px;
background: #3a0f20;
color: #e94560;
border-radius: 4px;
margin-top: 2px;
align-self: flex-start;
}
.plugin-unload-btn:hover { background: #5a1a30; }
/* Load-plugin section */
#load-plugin-row { display: flex; gap: 6px; }
#load-plugin-row input { flex: 1; font-size: 11px; }
#load-plugin-row button { white-space: nowrap; font-size: 11px; padding: 4px 10px; }
#no-plugins-msg { color: #555; font-size: 12px; text-align: center; padding: 20px 0; }
/* Manager tabs */
.tab-bar {
display: flex;
gap: 1px;
background: #0f3460;
flex-shrink: 0;
}
.tab-bar button {
flex: 1;
padding: 7px 4px;
border-radius: 0;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
background: #16213e;
color: #555;
border: none;
border-bottom: 2px solid transparent;
transition: color 0.15s, border-color 0.15s;
}
.tab-bar button.active {
color: #7986cb;
border-bottom-color: #7986cb;
background: #1a1a2e;
}
.tab-bar button:hover:not(.active) { color: #90a4ae; background: #1a1a2e; }
.tab-pane { display: none; flex-direction: column; gap: 10px; }
.tab-pane.active { display: flex; }
/* Marketplace cards */
.market-card {
background: #0f3460;
border: 1px solid #1e3a6e;
border-radius: 6px;
padding: 10px;
display: flex;
flex-direction: column;
gap: 5px;
}
.market-card-header { display: flex; align-items: center; gap: 8px; }
.market-card-thumb {
width: 36px; height: 36px; border-radius: 6px;
background: linear-gradient(135deg, #233a6e 0%, #0f3460 100%);
flex-shrink: 0; object-fit: cover;
}
.market-card-thumb-fallback {
width: 36px; height: 36px; border-radius: 6px;
background: linear-gradient(135deg, #1e3a7e 0%, #e94560 100%);
flex-shrink: 0;
display: flex; align-items: center; justify-content: center;
font-weight: 700; font-size: 15px; color: #fff;
}
.market-info { flex: 1; min-width: 0; }
.market-name { font-weight: 700; font-size: 12px; color: #e0e0e0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.market-author { font-size: 10px; color: #7986cb; }
.market-desc { font-size: 11px; color: #90a4ae; line-height: 1.4; }
.market-footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.market-install-btn {
font-size: 10px; padding: 3px 10px; background: #e94560; color: #fff;
border-radius: 4px; margin-left: auto;
}
.market-install-btn:hover { background: #c73652; }
.market-install-btn:disabled { background: #333; color: #555; cursor: default; }
.market-tag { font-size: 9px; padding: 1px 5px; border-radius: 6px; background: #162250; color: #7986cb; }
#dir-search { margin-bottom: 4px; }
#dir-status { font-size: 11px; color: #7986cb; text-align: center; padding: 6px 0; }
</style>
</head>
<body>
<header>
<h1>@paarrot/plugin-manager</h1>
<span id="status-badge">Loading…</span>
</header>
<main>
<!-- Left: Plugin Manager (spans both rows) -->
<div class="panel" id="panel-manager" style="overflow:hidden;">
<div class="panel-header" style="display:flex;align-items:center;justify-content:space-between;">
Plugin Manager
</div>
<div class="tab-bar">
<button id="tab-installed" class="active">Installed</button>
<button id="tab-directory">Directory</button>
</div>
<!-- Installed tab -->
<div id="pane-installed" class="tab-pane active" style="flex:1;overflow-y:auto;padding:12px;">
<div style="font-size:11px;color:#7986cb;margin-bottom:2px;">Load plugin from file:</div>
<div id="load-plugin-row">
<input type="text" id="load-plugin-path" placeholder="/path/to/plugin/index.js" />
<button class="primary" id="load-plugin-btn">Load</button>
</div>
<div style="margin-top:10px;font-size:11px;color:#7986cb;margin-bottom:4px;">Registered plugins:</div>
<div id="plugin-list"><div id="no-plugins-msg">No plugins loaded</div></div>
</div>
<!-- Directory tab -->
<div id="pane-directory" class="tab-pane" style="flex:1;overflow-y:auto;padding:12px;">
<input type="text" id="dir-search" placeholder="Search plugins…" />
<div id="dir-status">Click Refresh to fetch the plugin directory.</div>
<button id="dir-refresh" style="font-size:11px;padding:4px 10px;align-self:flex-start;">&#8635; Refresh</button>
<div id="dir-list" style="display:flex;flex-direction:column;gap:8px;"></div>
</div>
</div>
<!-- Top-center: Commands -->
<div class="panel">
<div class="panel-header">Commands</div>
<div class="panel-body">
<div>
<div style="font-size:11px;color:#7986cb;margin-bottom:6px;">Registered commands:</div>
<ul id="cmd-list"><li style="color:#555">Loading…</li></ul>
</div>
<div class="row">
<input type="text" id="cmd-input" placeholder="/hello World" />
<button class="primary" id="cmd-run">Run</button>
</div>
<div id="cmd-result" style="font-family:monospace;font-size:12px;color:#4caf50;min-height:20px;"></div>
</div>
</div>
<!-- Top-right: Message Interceptor -->
<div class="panel">
<div class="panel-header">Message Interceptor</div>
<div class="panel-body">
<div style="font-size:11px;color:#7986cb;">
Type a message. The plugin will expand abbreviations like <code style="color:#e94560">brb</code>, <code style="color:#e94560">omw</code>, <code style="color:#e94560">afk</code>.
</div>
<textarea id="msg-input" rows="3"
style="background:#0f3460;border:1px solid #233a6e;color:#e0e0e0;padding:8px;border-radius:4px;font-size:13px;resize:none;width:100%;outline:none;"
placeholder="Type something… try 'brb' or 'omw'"></textarea>
<button class="primary" id="msg-send">Process Message</button>
<pre id="msg-result"></pre>
</div>
</div>
<!-- Bottom-center: Settings + Theme -->
<div class="panel">
<div class="panel-header">Settings &amp; Theme</div>
<div class="panel-body">
<div style="font-size:11px;color:#7986cb;margin-bottom:4px;">Plugin settings (persisted to localStorage):</div>
<div id="settings-container"></div>
<div style="margin-top:8px;font-size:11px;color:#7986cb;">Plugin Themes:</div>
<div class="theme-row">
<button id="theme-apply">Apply Ocean Blue</button>
<button id="theme-reset">Reset Theme</button>
</div>
<div style="margin-top:8px;font-size:11px;color:#7986cb;">Events:</div>
<button id="event-fire">Fire test-event</button>
</div>
</div>
<!-- Bottom-right: Log -->
<div class="panel">
<div class="panel-header">Log</div>
<div class="panel-body" style="padding:8px;">
<div id="log"></div>
</div>
</div>
</main>
<script src="renderer.js"></script>
</body>
</html>