mirror of
https://github.com/soconnor0919/robot-plugins.git
synced 2025-12-12 23:24:43 -05:00
309 lines
15 KiB
HTML
309 lines
15 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>HRIStudio Robot Plugins</title>
|
|
<link rel="stylesheet" href="assets/style.css">
|
|
</head>
|
|
<body>
|
|
<button id="themeToggle" class="theme-toggle" aria-label="Toggle theme">
|
|
<svg id="themeIcon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<circle cx="12" cy="12" r="5"/>
|
|
<line x1="12" y1="1" x2="12" y2="3"/>
|
|
<line x1="12" y1="21" x2="12" y2="23"/>
|
|
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
|
|
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
|
|
<line x1="1" y1="12" x2="3" y2="12"/>
|
|
<line x1="21" y1="12" x2="23" y2="12"/>
|
|
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
|
|
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
|
|
</svg>
|
|
</button>
|
|
|
|
<div class="container">
|
|
<div id="loading">Loading repository data...</div>
|
|
<div id="content" class="hidden">
|
|
<!-- Banner -->
|
|
<div id="repoBanner" class="header-banner hidden">
|
|
<img alt="Repository Banner">
|
|
</div>
|
|
|
|
<!-- Header Card -->
|
|
<div class="card">
|
|
<div class="card-content">
|
|
<div class="header-content">
|
|
<img id="repoIcon" alt="Repository Icon" class="header-icon hidden">
|
|
<div>
|
|
<h1 id="repoName" class="title"></h1>
|
|
<p id="repoDescription" class="description"></p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tabs -->
|
|
<div class="tabs">
|
|
<div class="tabs-list" role="tablist">
|
|
<button class="tab" role="tab" data-state="active" data-tab="overview">Overview</button>
|
|
<button class="tab" role="tab" data-tab="plugins">Available Plugins</button>
|
|
</div>
|
|
|
|
<!-- Overview Tab -->
|
|
<div class="tab-content" data-state="active" role="tabpanel" data-tab="overview">
|
|
<div class="grid grid-cols-2">
|
|
<!-- Author Info -->
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h2>Author</h2>
|
|
</div>
|
|
<div class="card-content">
|
|
<div>
|
|
<span>Name:</span>
|
|
<span id="authorName"></span>
|
|
</div>
|
|
<div id="authorOrgContainer" class="hidden">
|
|
<span>Organization:</span>
|
|
<span id="authorOrg"></span>
|
|
</div>
|
|
<div id="authorUrlContainer" class="hidden">
|
|
<a id="authorUrl" target="_blank">View Profile</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Compatibility -->
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h2>Compatibility</h2>
|
|
</div>
|
|
<div class="card-content">
|
|
<div>
|
|
<h3>HRIStudio</h3>
|
|
<div>
|
|
<span>Min Version:</span>
|
|
<span id="hriMin"></span>
|
|
</div>
|
|
<div id="hriRecommendedContainer" class="hidden">
|
|
<span>Recommended:</span>
|
|
<span id="hriRecommended"></span>
|
|
</div>
|
|
</div>
|
|
<div id="ros2Container" class="hidden">
|
|
<h3>ROS 2</h3>
|
|
<div id="ros2Distributions"></div>
|
|
<div id="ros2RecommendedContainer" class="hidden">
|
|
<span>Recommended:</span>
|
|
<span id="ros2Recommended"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tags -->
|
|
<div class="card" style="margin-top: 1.5rem;">
|
|
<div class="card-header">
|
|
<h2>Tags</h2>
|
|
</div>
|
|
<div class="card-content">
|
|
<div id="tags"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Plugins Tab -->
|
|
<div class="tab-content" role="tabpanel" data-tab="plugins">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<h2 style="margin: 0;">Available Plugins</h2>
|
|
<span class="badge badge-secondary" id="pluginCount"></span>
|
|
</div>
|
|
</div>
|
|
<div class="card-content">
|
|
<div id="pluginGrid" class="plugin-grid">
|
|
<!-- Plugins will be loaded here -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Theme management
|
|
const themeToggle = document.getElementById('themeToggle');
|
|
const themeIcon = document.getElementById('themeIcon');
|
|
|
|
// Check for saved theme preference or system preference
|
|
const savedTheme = localStorage.getItem('theme');
|
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
const defaultTheme = savedTheme || (prefersDark ? 'dark' : 'light');
|
|
|
|
// Apply theme
|
|
function setTheme(theme) {
|
|
document.documentElement.setAttribute('data-theme', theme);
|
|
localStorage.setItem('theme', theme);
|
|
|
|
// Update icon
|
|
if (theme === 'dark') {
|
|
themeIcon.innerHTML = `
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
|
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
|
|
`;
|
|
} else {
|
|
themeIcon.innerHTML = `
|
|
<circle cx="12" cy="12" r="5"/>
|
|
<line x1="12" y1="1" x2="12" y2="3"/>
|
|
<line x1="12" y1="21" x2="12" y2="23"/>
|
|
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
|
|
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
|
|
<line x1="1" y1="12" x2="3" y2="12"/>
|
|
<line x1="21" y1="12" x2="23" y2="12"/>
|
|
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
|
|
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
|
|
`;
|
|
}
|
|
}
|
|
|
|
// Set initial theme
|
|
setTheme(defaultTheme);
|
|
|
|
// Theme toggle handler
|
|
themeToggle.addEventListener('click', () => {
|
|
const currentTheme = document.documentElement.getAttribute('data-theme');
|
|
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
|
|
setTheme(newTheme);
|
|
});
|
|
|
|
// Tab management
|
|
document.querySelectorAll('.tab').forEach(tab => {
|
|
tab.addEventListener('click', () => {
|
|
// Update tab states
|
|
document.querySelectorAll('.tab').forEach(t => t.setAttribute('data-state', ''));
|
|
tab.setAttribute('data-state', 'active');
|
|
|
|
// Update content states
|
|
const tabId = tab.getAttribute('data-tab');
|
|
document.querySelectorAll('.tab-content').forEach(content => {
|
|
content.setAttribute('data-state',
|
|
content.getAttribute('data-tab') === tabId ? 'active' : ''
|
|
);
|
|
});
|
|
});
|
|
});
|
|
|
|
// Repository data loading
|
|
async function loadRepositoryData() {
|
|
try {
|
|
const response = await fetch('repository.json');
|
|
const data = await response.json();
|
|
|
|
// Update page title
|
|
document.title = data.name;
|
|
|
|
// Update header
|
|
document.getElementById('repoName').textContent = data.name;
|
|
document.getElementById('repoDescription').textContent = data.description || '';
|
|
|
|
// Update stats
|
|
document.getElementById('pluginCount').textContent = `${data.stats?.plugins || 0} plugins`;
|
|
|
|
// Update author info
|
|
document.getElementById('authorName').textContent = data.author.name;
|
|
if (data.author.organization) {
|
|
document.getElementById('authorOrgContainer').classList.remove('hidden');
|
|
document.getElementById('authorOrg').textContent = data.author.organization;
|
|
}
|
|
if (data.author.url) {
|
|
document.getElementById('authorUrlContainer').classList.remove('hidden');
|
|
document.getElementById('authorUrl').href = data.author.url;
|
|
}
|
|
|
|
// Update compatibility
|
|
document.getElementById('hriMin').textContent = data.compatibility.hristudio.min;
|
|
if (data.compatibility.hristudio.recommended) {
|
|
document.getElementById('hriRecommendedContainer').classList.remove('hidden');
|
|
document.getElementById('hriRecommended').textContent = data.compatibility.hristudio.recommended;
|
|
}
|
|
|
|
if (data.compatibility.ros2) {
|
|
document.getElementById('ros2Container').classList.remove('hidden');
|
|
const distributionsDiv = document.getElementById('ros2Distributions');
|
|
data.compatibility.ros2.distributions.forEach(dist => {
|
|
const badge = document.createElement('span');
|
|
badge.className = 'badge';
|
|
badge.textContent = dist;
|
|
distributionsDiv.appendChild(badge);
|
|
});
|
|
|
|
if (data.compatibility.ros2.recommended) {
|
|
document.getElementById('ros2RecommendedContainer').classList.remove('hidden');
|
|
document.getElementById('ros2Recommended').textContent = data.compatibility.ros2.recommended;
|
|
}
|
|
}
|
|
|
|
// Update tags
|
|
const tagsContainer = document.getElementById('tags');
|
|
data.tags.forEach(tag => {
|
|
const badge = document.createElement('span');
|
|
badge.className = 'badge badge-secondary';
|
|
badge.textContent = tag;
|
|
tagsContainer.appendChild(badge);
|
|
});
|
|
|
|
// Handle assets
|
|
if (data.assets?.icon) {
|
|
const iconImg = document.getElementById('repoIcon');
|
|
iconImg.src = data.assets.icon;
|
|
iconImg.classList.remove('hidden');
|
|
}
|
|
|
|
if (data.assets?.banner) {
|
|
const banner = document.getElementById('repoBanner');
|
|
banner.classList.remove('hidden');
|
|
banner.querySelector('img').src = data.assets.banner;
|
|
}
|
|
|
|
// Load plugins
|
|
const pluginGrid = document.getElementById('pluginGrid');
|
|
const pluginsResponse = await fetch('plugins/index.json');
|
|
const pluginFiles = await pluginsResponse.json();
|
|
|
|
for (const pluginFile of pluginFiles) {
|
|
const pluginResponse = await fetch(`plugins/${pluginFile}`);
|
|
const plugin = await pluginResponse.json();
|
|
|
|
const card = document.createElement('div');
|
|
card.className = 'plugin-card';
|
|
card.innerHTML = `
|
|
<div class="plugin-header">
|
|
<img src="${plugin.assets.thumbnailUrl}" alt="${plugin.name}" class="plugin-icon">
|
|
<div class="plugin-info">
|
|
<div class="plugin-title">${plugin.name}</div>
|
|
<div class="plugin-description">${plugin.description || ''}</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<span class="badge badge-secondary">${plugin.platform}</span>
|
|
</div>
|
|
`;
|
|
pluginGrid.appendChild(card);
|
|
}
|
|
|
|
// Show content
|
|
document.getElementById('loading').classList.add('hidden');
|
|
document.getElementById('content').classList.remove('hidden');
|
|
} catch (error) {
|
|
console.error('Error loading repository data:', error);
|
|
document.getElementById('loading').textContent = 'Error loading repository data';
|
|
}
|
|
}
|
|
|
|
// Load data when page loads
|
|
loadRepositoryData();
|
|
</script>
|
|
</body>
|
|
</html> |