überarbeitung backend-code
This commit is contained in:
@@ -103,28 +103,22 @@ const tools = data.tools;
|
||||
matrixContainer.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// This replaces the createToolCard function in index.astro script section
|
||||
|
||||
// This replaces the createToolCard function in index.astro script section
|
||||
|
||||
// This replaces the createToolCard function in index.astro script section
|
||||
|
||||
// Create tool card element
|
||||
function createToolCard(tool) {
|
||||
const cardDiv = document.createElement('div');
|
||||
const cardClass = tool.isHosted ? 'card card-hosted' : (tool.license !== 'Proprietary' ? 'card card-oss' : 'card');
|
||||
cardDiv.className = cardClass;
|
||||
|
||||
// Create button HTML based on hosting status
|
||||
const hasValidProjectUrl = tool.projectUrl !== undefined &&
|
||||
tool.projectUrl !== null &&
|
||||
tool.projectUrl !== "" &&
|
||||
tool.projectUrl.trim() !== "";
|
||||
|
||||
const cardDiv = document.createElement('div');
|
||||
const cardClass = hasValidProjectUrl ? 'card card-hosted' : (tool.license !== 'Proprietary' ? 'card card-oss' : 'card');
|
||||
cardDiv.className = cardClass;
|
||||
|
||||
// Create button HTML based on hosting status
|
||||
let buttonHTML;
|
||||
if (tool.isHosted && hasValidProjectUrl) {
|
||||
// Two buttons for self-hosted tools with both URLs
|
||||
if (hasValidProjectUrl) {
|
||||
// Two buttons for tools we're hosting
|
||||
buttonHTML = `
|
||||
<div style="display: flex; gap: 0.5rem;">
|
||||
<a href="${tool.url}" target="_blank" rel="noopener noreferrer" class="btn btn-secondary" style="flex: 1;">
|
||||
@@ -135,15 +129,8 @@ function createToolCard(tool) {
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
} else if (tool.isHosted) {
|
||||
// Single button for self-hosted tools with only project URL
|
||||
buttonHTML = `
|
||||
<a href="${tool.url}" target="_blank" rel="noopener noreferrer" class="btn btn-primary" style="width: 100%;">
|
||||
Project Page
|
||||
</a>
|
||||
`;
|
||||
} else {
|
||||
// Single button for non-hosted tools
|
||||
// Single button for tools we're not hosting
|
||||
buttonHTML = `
|
||||
<a href="${tool.url}" target="_blank" rel="noopener noreferrer" class="btn btn-primary" style="width: 100%;">
|
||||
Visit Website
|
||||
@@ -155,7 +142,7 @@ function createToolCard(tool) {
|
||||
<div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 0.75rem;">
|
||||
<h3 style="margin: 0;">${tool.name}</h3>
|
||||
<div style="display: flex; gap: 0.5rem;">
|
||||
${tool.isHosted ? '<span class="badge badge-primary">Self-Hosted</span>' : ''}
|
||||
${hasValidProjectUrl ? '<span class="badge badge-primary">Self-Hosted</span>' : ''}
|
||||
${tool.license !== 'Proprietary' ? '<span class="badge badge-success">Open Source</span>' : ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,14 @@ import path from 'path';
|
||||
const yamlPath = path.join(process.cwd(), 'src/data/tools.yaml');
|
||||
const yamlContent = await fs.readFile(yamlPath, 'utf8');
|
||||
const data = load(yamlContent) as any;
|
||||
const hostedServices = data.tools.filter((tool: any) => tool.isHosted);
|
||||
|
||||
// Filter for hosted services based on projectUrl presence
|
||||
const hostedServices = data.tools.filter((tool: any) => {
|
||||
return tool.projectUrl !== undefined &&
|
||||
tool.projectUrl !== null &&
|
||||
tool.projectUrl !== "" &&
|
||||
tool.projectUrl.trim() !== "";
|
||||
});
|
||||
---
|
||||
|
||||
<BaseLayout title="Service Status">
|
||||
@@ -32,7 +39,7 @@ const hostedServices = data.tools.filter((tool: any) => tool.isHosted);
|
||||
<p class="text-muted" style="font-size: 0.875rem; margin-bottom: 1rem;">
|
||||
{service.description}
|
||||
</p>
|
||||
<a href={service.url} target="_blank" rel="noopener noreferrer" class="btn btn-secondary">
|
||||
<a href={service.projectUrl} target="_blank" rel="noopener noreferrer" class="btn btn-secondary">
|
||||
Access Service →
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user