code cleanup
This commit is contained in:
parent
1f33ad1b16
commit
e2e5fe1641
@ -1,6 +1,5 @@
|
|||||||
---
|
---
|
||||||
// src/components/ToolCard.astro (Updated)
|
// src/components/ToolCard.astro (ENHANCED - Added data attributes for filtering)
|
||||||
import ContributionButton from './ContributionButton.astro';
|
|
||||||
import ShareButton from './ShareButton.astro';
|
import ShareButton from './ShareButton.astro';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@ -43,9 +42,27 @@ const cardClass = isConcept ? 'card card-concept tool-card' :
|
|||||||
isMethod ? 'card card-method tool-card' :
|
isMethod ? 'card card-method tool-card' :
|
||||||
hasValidProjectUrl ? 'card card-hosted tool-card' :
|
hasValidProjectUrl ? 'card card-hosted tool-card' :
|
||||||
(tool.license !== 'Proprietary' ? 'card card-oss tool-card' : 'card tool-card');
|
(tool.license !== 'Proprietary' ? 'card card-oss tool-card' : 'card tool-card');
|
||||||
|
|
||||||
|
// ENHANCED: Data attributes for filtering
|
||||||
|
const toolDataAttributes = {
|
||||||
|
'data-tool-name': tool.name.toLowerCase(),
|
||||||
|
'data-tool-type': tool.type,
|
||||||
|
'data-tool-domains': (tool.domains || []).join(','),
|
||||||
|
'data-tool-phases': (tool.phases || []).join(','),
|
||||||
|
'data-tool-tags': (tool.tags || []).join(',').toLowerCase(),
|
||||||
|
'data-tool-platforms': (tool.platforms || []).join(','),
|
||||||
|
'data-tool-license': tool.license || '',
|
||||||
|
'data-tool-skill': tool.skillLevel,
|
||||||
|
'data-tool-description': tool.description.toLowerCase()
|
||||||
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class={cardClass} onclick={`window.showToolDetails('${tool.name}')`} style="cursor: pointer; border-left: 4px solid {isMethod ? 'var(--color-method)' : hasValidProjectUrl ? 'var(--color-hosted)' : tool.license !== 'Proprietary' ? 'var(--color-oss)' : 'var(--color-border)'};">
|
<div
|
||||||
|
class={cardClass}
|
||||||
|
{...toolDataAttributes}
|
||||||
|
style="cursor: pointer;"
|
||||||
|
onclick={`window.showToolDetails('${tool.name}')`}
|
||||||
|
>
|
||||||
<!-- Card Header with Fixed Height -->
|
<!-- Card Header with Fixed Height -->
|
||||||
<div class="tool-card-header">
|
<div class="tool-card-header">
|
||||||
<h3>
|
<h3>
|
||||||
@ -94,7 +111,7 @@ const cardClass = isConcept ? 'card card-concept tool-card' :
|
|||||||
<polyline points="14 2 14 8 20 8"></polyline>
|
<polyline points="14 2 14 8 20 8"></polyline>
|
||||||
</svg>
|
</svg>
|
||||||
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;">
|
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;">
|
||||||
{isMethod ? 'Methode' : tool.license === 'Proprietary' ? 'Prop.' : tool.license?.split(' ')[0]}
|
{isConcept ? 'Konzept' : isMethod ? 'Methode' : tool.license === 'Proprietary' ? 'Prop.' : tool.license?.split(' ')[0]}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -106,45 +123,29 @@ const cardClass = isConcept ? 'card card-concept tool-card' :
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Buttons - Fixed at Bottom with Contribution Button -->
|
<!-- Buttons - Fixed at Bottom (NO EDIT BUTTONS - Available in modals) -->
|
||||||
<div class="tool-card-buttons" onclick="event.stopPropagation();">
|
<div class="tool-card-buttons" onclick="event.stopPropagation();">
|
||||||
{isConcept ? (
|
{isConcept ? (
|
||||||
<!-- Concept buttons with edit -->
|
<a href={tool.url} target="_blank" rel="noopener noreferrer" class="btn btn-primary single-button" style="background-color: var(--color-concept); border-color: var(--color-concept);">
|
||||||
<div class="button-row">
|
Mehr erfahren
|
||||||
<a href={tool.url} target="_blank" rel="noopener noreferrer" class="btn btn-primary" style="background-color: var(--color-concept); border-color: var(--color-concept); flex: 2;">
|
</a>
|
||||||
Mehr erfahren
|
|
||||||
</a>
|
|
||||||
<ContributionButton type="edit" toolName={tool.name} variant="secondary" text="Edit" style="flex: 1; font-size: 0.75rem;" />
|
|
||||||
</div>
|
|
||||||
) : isMethod ? (
|
) : isMethod ? (
|
||||||
<!-- Method buttons with edit -->
|
<a href={tool.projectUrl || tool.url} target="_blank" rel="noopener noreferrer" class="btn btn-primary single-button" style="background-color: var(--color-method); border-color: var(--color-method);">
|
||||||
<div class="button-row">
|
Zur Methode
|
||||||
<a href={tool.projectUrl || tool.url} target="_blank" rel="noopener noreferrer" class="btn btn-primary" style="background-color: var(--color-method); border-color: var(--color-method); flex: 2;">
|
</a>
|
||||||
Zur Methode
|
|
||||||
</a>
|
|
||||||
<ContributionButton type="edit" toolName={tool.name} variant="secondary" text="Edit" style="flex: 1; font-size: 0.75rem;" />
|
|
||||||
</div>
|
|
||||||
) : hasValidProjectUrl ? (
|
) : hasValidProjectUrl ? (
|
||||||
<!-- Three buttons for hosted tools -->
|
<div class="button-row">
|
||||||
<div style="display: flex; flex-direction: column; gap: 0.5rem;">
|
<a href={tool.url} target="_blank" rel="noopener noreferrer" class="btn btn-secondary">
|
||||||
<div class="button-row">
|
Homepage
|
||||||
<a href={tool.url} target="_blank" rel="noopener noreferrer" class="btn btn-secondary">
|
</a>
|
||||||
Homepage
|
<a href={tool.projectUrl} target="_blank" rel="noopener noreferrer" class="btn btn-primary">
|
||||||
</a>
|
Zugreifen
|
||||||
<a href={tool.projectUrl} target="_blank" rel="noopener noreferrer" class="btn btn-primary">
|
</a>
|
||||||
Zugreifen
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<ContributionButton type="edit" toolName={tool.name} variant="secondary" text="Edit Entry" className="single-button" />
|
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<!-- Two buttons for external tools -->
|
<a href={tool.url} target="_blank" rel="noopener noreferrer" class="btn btn-primary single-button">
|
||||||
<div class="button-row">
|
Software-Homepage
|
||||||
<a href={tool.url} target="_blank" rel="noopener noreferrer" class="btn btn-primary" style="flex: 2;">
|
</a>
|
||||||
Software-Homepage
|
|
||||||
</a>
|
|
||||||
<ContributionButton type="edit" toolName={tool.name} variant="secondary" text="Edit" style="flex: 1; font-size: 0.75rem;" />
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,11 +1,9 @@
|
|||||||
---
|
---
|
||||||
import { getToolsData } from '../utils/dataService.js';
|
import { getToolsData } from '../utils/dataService.js';
|
||||||
|
|
||||||
|
|
||||||
// Load tools data
|
// Load tools data
|
||||||
const data = await getToolsData();
|
const data = await getToolsData();
|
||||||
|
|
||||||
|
|
||||||
const domains = data.domains;
|
const domains = data.domains;
|
||||||
const phases = data.phases;
|
const phases = data.phases;
|
||||||
|
|
||||||
@ -106,7 +104,6 @@ const sortedTags = Object.entries(tagFrequency)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- View Toggle -->
|
<!-- View Toggle -->
|
||||||
<!--<div style="display: flex; gap: 1rem; margin-bottom: 1.5rem; align-items: center; flex-wrap: wrap;">-->
|
|
||||||
<div style="display: flex; gap: 1rem; margin-bottom: 1.5rem; align-items: center;">
|
<div style="display: flex; gap: 1rem; margin-bottom: 1.5rem; align-items: center;">
|
||||||
<button class="btn btn-secondary view-toggle active" style="height:50px" data-view="grid">Kachelansicht</button>
|
<button class="btn btn-secondary view-toggle active" style="height:50px" data-view="grid">Kachelansicht</button>
|
||||||
<button class="btn btn-secondary view-toggle" style="height:50px" data-view="matrix">Matrix-Ansicht</button>
|
<button class="btn btn-secondary view-toggle" style="height:50px" data-view="matrix">Matrix-Ansicht</button>
|
||||||
@ -127,7 +124,6 @@ const sortedTags = Object.entries(tagFrequency)
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script define:vars={{ toolsData: data.tools, tagFrequency, sortedTags }}>
|
<script define:vars={{ toolsData: data.tools, tagFrequency, sortedTags }}>
|
||||||
// Store tools data globally for filtering
|
// Store tools data globally for filtering
|
||||||
window.toolsData = toolsData;
|
window.toolsData = toolsData;
|
||||||
@ -286,7 +282,7 @@ const sortedTags = Object.entries(tagFrequency)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter function
|
// ENHANCED: Filter function with better performance for show/hide pattern
|
||||||
function filterTools() {
|
function filterTools() {
|
||||||
const searchTerm = searchInput.value.toLowerCase();
|
const searchTerm = searchInput.value.toLowerCase();
|
||||||
const selectedDomain = domainSelect.value;
|
const selectedDomain = domainSelect.value;
|
||||||
@ -298,7 +294,7 @@ const sortedTags = Object.entries(tagFrequency)
|
|||||||
const phases = tool.phases || [];
|
const phases = tool.phases || [];
|
||||||
const tags = tool.tags || [];
|
const tags = tool.tags || [];
|
||||||
|
|
||||||
// Search filter
|
// Search filter - more comprehensive
|
||||||
if (searchTerm && !(
|
if (searchTerm && !(
|
||||||
tool.name.toLowerCase().includes(searchTerm) ||
|
tool.name.toLowerCase().includes(searchTerm) ||
|
||||||
tool.description.toLowerCase().includes(searchTerm) ||
|
tool.description.toLowerCase().includes(searchTerm) ||
|
||||||
@ -317,12 +313,12 @@ const sortedTags = Object.entries(tagFrequency)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proprietary filter (skip for methods since they don't have licenses)
|
// Proprietary filter (skip for methods and concepts since they don't have licenses)
|
||||||
if (!includeProprietary && !isMethod(tool) && tool.license === 'Proprietary') {
|
if (!includeProprietary && !isMethod(tool) && tool.type !== 'concept' && tool.license === 'Proprietary') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tag filter
|
// Tag filter - ensure all selected tags are present
|
||||||
if (selectedTags.size > 0 && !Array.from(selectedTags).every(tag => tags.includes(tag))) {
|
if (selectedTags.size > 0 && !Array.from(selectedTags).every(tag => tags.includes(tag))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -332,6 +328,7 @@ const sortedTags = Object.entries(tagFrequency)
|
|||||||
|
|
||||||
// Update matrix highlighting
|
// Update matrix highlighting
|
||||||
updateMatrixHighlighting();
|
updateMatrixHighlighting();
|
||||||
|
|
||||||
// Emit custom event with filtered results
|
// Emit custom event with filtered results
|
||||||
window.dispatchEvent(new CustomEvent('toolsFiltered', { detail: filtered }));
|
window.dispatchEvent(new CustomEvent('toolsFiltered', { detail: filtered }));
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ const tools = data.tools;
|
|||||||
KI befragen
|
KI befragen
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Contribution Button - FIXED: Use data-contribute-button -->
|
<!-- Contribution Button -->
|
||||||
<a href="/contribute" class="btn" style="padding: 0.75rem 1.5rem; background-color: var(--color-warning); color: white; border-color: var(--color-warning);" data-contribute-button="new">
|
<a href="/contribute" class="btn" style="padding: 0.75rem 1.5rem; background-color: var(--color-warning); color: white; border-color: var(--color-warning);" data-contribute-button="new">
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 0.5rem;">
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 0.5rem;">
|
||||||
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
|
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
|
||||||
@ -121,29 +121,7 @@ const tools = data.tools;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simple sorting function
|
// AI Query Button Handler using consolidated auth system
|
||||||
function sortTools(tools, sortBy = 'default') {
|
|
||||||
const sorted = [...tools];
|
|
||||||
|
|
||||||
switch (sortBy) {
|
|
||||||
case 'alphabetical':
|
|
||||||
return sorted.sort((a, b) => a.name.localeCompare(b.name));
|
|
||||||
case 'difficulty':
|
|
||||||
const difficultyOrder = { 'novice': 0, 'beginner': 1, 'intermediate': 2, 'advanced': 3, 'expert': 4 };
|
|
||||||
return sorted.sort((a, b) =>
|
|
||||||
(difficultyOrder[a.skillLevel] || 999) - (difficultyOrder[b.skillLevel] || 999)
|
|
||||||
);
|
|
||||||
case 'type':
|
|
||||||
const typeOrder = { 'concept': 0, 'method': 1, 'software': 2 };
|
|
||||||
return sorted.sort((a, b) =>
|
|
||||||
(typeOrder[a.type] || 999) - (typeOrder[b.type] || 999)
|
|
||||||
);
|
|
||||||
case 'default':
|
|
||||||
default:
|
|
||||||
return sorted;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// OPTIMIZED: AI Query Button Handler using consolidated auth system
|
|
||||||
if (aiQueryBtn) {
|
if (aiQueryBtn) {
|
||||||
aiQueryBtn.addEventListener('click', async () => {
|
aiQueryBtn.addEventListener('click', async () => {
|
||||||
// Use the global auth system consistently
|
// Use the global auth system consistently
|
||||||
@ -256,7 +234,7 @@ const tools = data.tools;
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// RESTORED: Navigation functions for sharing - EXACT ORIGINAL VERSIONS
|
// Navigation functions for sharing
|
||||||
window.navigateToGrid = function(toolName) {
|
window.navigateToGrid = function(toolName) {
|
||||||
console.log('Navigating to grid for tool:', toolName);
|
console.log('Navigating to grid for tool:', toolName);
|
||||||
|
|
||||||
@ -344,7 +322,7 @@ const tools = data.tools;
|
|||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
// RESTORED: Handle URL parameters on page load - EXACT ORIGINAL VERSION
|
// Handle URL parameters on page load
|
||||||
function handleSharedURL() {
|
function handleSharedURL() {
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const toolParam = urlParams.get('tool');
|
const toolParam = urlParams.get('tool');
|
||||||
@ -392,7 +370,7 @@ const tools = data.tools;
|
|||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle filtered results
|
// ENHANCED: New filtering logic using show/hide pattern
|
||||||
window.addEventListener('toolsFiltered', (event) => {
|
window.addEventListener('toolsFiltered', (event) => {
|
||||||
const filtered = event.detail;
|
const filtered = event.detail;
|
||||||
const currentView = document.querySelector('.view-toggle.active')?.getAttribute('data-view');
|
const currentView = document.querySelector('.view-toggle.active')?.getAttribute('data-view');
|
||||||
@ -401,20 +379,27 @@ const tools = data.tools;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear container
|
// Get all existing tool cards
|
||||||
toolsContainer.innerHTML = '';
|
const allToolCards = document.querySelectorAll('.tool-card');
|
||||||
|
const filteredNames = new Set(filtered.map(tool => tool.name.toLowerCase()));
|
||||||
|
|
||||||
if (filtered.length === 0) {
|
let visibleCount = 0;
|
||||||
|
|
||||||
|
allToolCards.forEach(card => {
|
||||||
|
const toolName = card.getAttribute('data-tool-name');
|
||||||
|
if (filteredNames.has(toolName)) {
|
||||||
|
card.style.display = 'block';
|
||||||
|
visibleCount++;
|
||||||
|
} else {
|
||||||
|
card.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Show/hide no results message
|
||||||
|
if (visibleCount === 0) {
|
||||||
noResults.style.display = 'block';
|
noResults.style.display = 'block';
|
||||||
} else {
|
} else {
|
||||||
noResults.style.display = 'none';
|
noResults.style.display = 'none';
|
||||||
|
|
||||||
const sortedTools = sortTools(filtered, 'default');
|
|
||||||
|
|
||||||
sortedTools.forEach((tool) => {
|
|
||||||
const toolCard = createToolCard(tool);
|
|
||||||
toolsContainer.appendChild(toolCard);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -427,124 +412,7 @@ const tools = data.tools;
|
|||||||
// Make switchToView available globally
|
// Make switchToView available globally
|
||||||
window.switchToAIView = () => switchToView('ai');
|
window.switchToAIView = () => switchToView('ai');
|
||||||
|
|
||||||
// Tool card creation function
|
// Initialize URL handling
|
||||||
function createToolCard(tool) {
|
|
||||||
const isMethod = tool.type === 'method';
|
|
||||||
const isConcept = tool.type === 'concept';
|
|
||||||
const hasValidProjectUrl = tool.projectUrl !== undefined &&
|
|
||||||
tool.projectUrl !== null &&
|
|
||||||
tool.projectUrl !== "" &&
|
|
||||||
tool.projectUrl.trim() !== "";
|
|
||||||
|
|
||||||
const hasKnowledgebase = tool.knowledgebase === true;
|
|
||||||
|
|
||||||
const cardDiv = document.createElement('div');
|
|
||||||
const cardClass = isConcept ? 'card card-concept tool-card' :
|
|
||||||
isMethod ? 'card card-method tool-card' :
|
|
||||||
hasValidProjectUrl ? 'card card-hosted tool-card' :
|
|
||||||
(tool.license !== 'Proprietary' ? 'card card-oss tool-card' : 'card tool-card');
|
|
||||||
cardDiv.className = cardClass;
|
|
||||||
cardDiv.style.cursor = 'pointer';
|
|
||||||
cardDiv.onclick = () => window.showToolDetails(tool.name);
|
|
||||||
|
|
||||||
// Create tool slug for share button
|
|
||||||
const toolSlug = createToolSlug(tool.name);
|
|
||||||
|
|
||||||
cardDiv.innerHTML = `
|
|
||||||
<div class="tool-card-header">
|
|
||||||
<h3>${tool.icon ? `<span style="margin-right: 0.5rem; font-size: 1.125rem;">${tool.icon}</span>` : ''}${tool.name}</h3>
|
|
||||||
<div class="tool-card-badges">
|
|
||||||
${!isMethod && !isConcept && hasValidProjectUrl ? '<span class="badge badge-primary">CC24-Server</span>' : ''}
|
|
||||||
${hasKnowledgebase ? '<span class="badge badge-error">📖</span>' : ''}
|
|
||||||
<button class="share-btn share-btn--small"
|
|
||||||
data-tool-name="${tool.name}"
|
|
||||||
data-tool-slug="${toolSlug}"
|
|
||||||
data-context="card"
|
|
||||||
onclick="event.stopPropagation(); window.showShareDialog(this)"
|
|
||||||
title="${tool.name} teilen"
|
|
||||||
aria-label="${tool.name} teilen">
|
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
||||||
<circle cx="18" cy="5" r="3"/>
|
|
||||||
<circle cx="6" cy="12" r="3"/>
|
|
||||||
<circle cx="18" cy="19" r="3"/>
|
|
||||||
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/>
|
|
||||||
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="text-muted">
|
|
||||||
${tool.description}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="tool-card-metadata" style="display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; line-height: 1;">
|
|
||||||
<div class="metadata-item" style="display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--color-text-secondary); flex-shrink: 1; min-width: 0;">
|
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="flex-shrink: 0;">
|
|
||||||
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
||||||
<line x1="9" y1="9" x2="15" y2="9"></line>
|
|
||||||
<line x1="9" y1="15" x2="15" y2="15"></line>
|
|
||||||
</svg>
|
|
||||||
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;">
|
|
||||||
${(tool.platforms || []).slice(0, 2).join(', ')}${tool.platforms && tool.platforms.length > 2 ? '...' : ''}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="metadata-item" style="display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--color-text-secondary); flex-shrink: 1; min-width: 0;">
|
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="flex-shrink: 0;">
|
|
||||||
<circle cx="12" cy="12" r="10"></circle>
|
|
||||||
<path d="M12 6v6l4 2"></path>
|
|
||||||
</svg>
|
|
||||||
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;">
|
|
||||||
${tool.skillLevel}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="metadata-item" style="display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--color-text-secondary); flex-shrink: 1; min-width: 0;">
|
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="flex-shrink: 0;">
|
|
||||||
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
||||||
<polyline points="14 2 14 8 20 8"></polyline>
|
|
||||||
</svg>
|
|
||||||
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;">
|
|
||||||
${isConcept ? 'Konzept' : isMethod ? 'Methode' : tool.license === 'Proprietary' ? 'Prop.' : tool.license?.split(' ')[0] || 'N/A'}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tool-tags-container">
|
|
||||||
${(tool.tags || []).slice(0, 8).map((tag) => `<span class="tag">${tag}</span>`).join('')}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tool-card-buttons" onclick="event.stopPropagation();">
|
|
||||||
${isConcept ? `
|
|
||||||
<a href="${tool.url}" target="_blank" rel="noopener noreferrer" class="btn btn-primary single-button" style="background-color: var(--color-concept); border-color: var(--color-concept);">
|
|
||||||
Mehr erfahren
|
|
||||||
</a>
|
|
||||||
` : isMethod ? `
|
|
||||||
<a href="${tool.projectUrl || tool.url}" target="_blank" rel="noopener noreferrer" class="btn btn-primary single-button" style="background-color: var(--color-method); border-color: var(--color-method);">
|
|
||||||
Zur Methode
|
|
||||||
</a>
|
|
||||||
` : hasValidProjectUrl ? `
|
|
||||||
<div class="button-row">
|
|
||||||
<a href="${tool.url}" target="_blank" rel="noopener noreferrer" class="btn btn-secondary">
|
|
||||||
Homepage
|
|
||||||
</a>
|
|
||||||
<a href="${tool.projectUrl}" target="_blank" rel="noopener noreferrer" class="btn btn-primary">
|
|
||||||
Zugreifen
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
` : `
|
|
||||||
<a href="${tool.url}" target="_blank" rel="noopener noreferrer" class="btn btn-primary single-button">
|
|
||||||
Software-Homepage
|
|
||||||
</a>
|
|
||||||
`}
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
return cardDiv;
|
|
||||||
}
|
|
||||||
|
|
||||||
// RESTORED: Initialize URL handling - EXACT ORIGINAL
|
|
||||||
handleSharedURL();
|
handleSharedURL();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
Loading…
x
Reference in New Issue
Block a user