Replace landing card MCP copy pill with link to /mcp-tool.php; fix preview.php for slugs without authored content (legal-analysis, summarize, translate)
This commit is contained in:
+27
-42
@@ -18,16 +18,19 @@ $returnPath = '/';
|
||||
$toolsLogin = 'https://dobetternorge.no/tools-login.php?return=' . urlencode($returnPath);
|
||||
|
||||
$toolMcpSlugs = [
|
||||
'transcribe' => 'dbn.transcribe_audio',
|
||||
'timeline' => 'dbn.timeline',
|
||||
'redact' => 'dbn.redact',
|
||||
'korrespond' => 'dbn.korrespond',
|
||||
'barnevernet' => 'dbn.barnevernet_analyze',
|
||||
'advocate' => 'dbn.advocate_brief',
|
||||
'deep-research' => 'dbn.deep_research',
|
||||
'discrepancy' => 'dbn.discrepancy_find',
|
||||
'corpus' => 'dbn.list_documents',
|
||||
'citations' => 'dbn.citation_graph',
|
||||
'transcribe' => 'dbn.transcribe_audio',
|
||||
'timeline' => 'dbn.timeline',
|
||||
'redact' => 'dbn.redact',
|
||||
'summarize' => 'dbn.summarize',
|
||||
'legal-analysis' => 'dbn.legal_analysis',
|
||||
'korrespond' => 'dbn.korrespond',
|
||||
'barnevernet' => 'dbn.barnevernet_analyze',
|
||||
'advocate' => 'dbn.advocate_brief',
|
||||
'deep-research' => 'dbn.deep_research',
|
||||
'discrepancy' => 'dbn.discrepancy_find',
|
||||
'corpus' => 'dbn.list_documents',
|
||||
'citations' => 'dbn.citation_graph',
|
||||
'translate' => 'dbn.translate',
|
||||
];
|
||||
$toolMcpSlug = $toolMcpSlugs[$slug] ?? null;
|
||||
|
||||
@@ -207,7 +210,12 @@ $localizedContent = [
|
||||
|
||||
// uk/pl fall back to 'en' — sample documents are Norwegian regardless
|
||||
$contentLang = array_key_exists($uiLang, $localizedContent) ? $uiLang : 'en';
|
||||
$localContent = $localizedContent[$contentLang][$slug];
|
||||
$localContent = $localizedContent[$contentLang][$slug] ?? $localizedContent['en'][$slug] ?? null;
|
||||
if ($localContent === null) {
|
||||
// No marketing copy authored for this slug yet — send the visitor straight to the tool.
|
||||
header('Location: /' . $slug . '.php' . ($uiLang !== 'en' ? '?lang=' . urlencode($uiLang) : ''));
|
||||
exit;
|
||||
}
|
||||
|
||||
// ── Sample inputs/outputs (always Norwegian — legal domain is Norway) ─────────
|
||||
$samples = [
|
||||
@@ -483,7 +491,7 @@ $samples = [
|
||||
],
|
||||
];
|
||||
|
||||
$sample = $samples[$slug];
|
||||
$sample = $samples[$slug] ?? null;
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="<?= htmlspecialchars($uiLang) ?>">
|
||||
@@ -551,6 +559,7 @@ $sample = $samples[$slug];
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php if ($sample): ?>
|
||||
<section class="lt-preview-sample">
|
||||
<div class="lt-preview-sample__inner">
|
||||
<div class="lt-preview-sample__col">
|
||||
@@ -573,38 +582,14 @@ $sample = $samples[$slug];
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($toolMcpSlug): ?>
|
||||
<section class="lt-preview-mcp">
|
||||
<div class="lt-preview-mcp__inner">
|
||||
<div class="lt-preview-mcp__head">
|
||||
<span class="lt-preview-mcp__icon" aria-hidden="true">⚙️</span>
|
||||
<div>
|
||||
<h2 class="lt-preview-mcp__title"><?= $uiLang === 'no' ? 'MCP-integrasjon' : 'MCP Integration' ?></h2>
|
||||
<p class="lt-preview-mcp__sub"><?= $uiLang === 'no' ? 'Bruk dette verktøyet direkte fra Claude Desktop, Claude Code eller Cursor.' : 'Use this tool directly from Claude Desktop, Claude Code, or Cursor.' ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lt-preview-mcp__slug-row">
|
||||
<span class="lt-preview-mcp__slug-label"><?= $uiLang === 'no' ? 'MCP-verktøyslug' : 'MCP tool slug' ?></span>
|
||||
<code class="lt-preview-mcp__slug" id="mcpSlugCode"><?= htmlspecialchars($toolMcpSlug) ?></code>
|
||||
<button class="lt-preview-mcp__copy" onclick="navigator.clipboard.writeText('<?= htmlspecialchars($toolMcpSlug) ?>').then(()=>{this.textContent='<?= $uiLang === 'no' ? 'Kopiert!' : 'Copied!' ?>';setTimeout(()=>{this.textContent='<?= $uiLang === 'no' ? 'Kopier' : 'Copy' ?>';},1400);});"><?= $uiLang === 'no' ? 'Kopier' : 'Copy' ?></button>
|
||||
</div>
|
||||
<div class="lt-preview-mcp__snippet">
|
||||
<p class="lt-preview-mcp__snippet-label">claude_desktop_config.json</p>
|
||||
<pre class="lt-preview-mcp__pre">{
|
||||
"mcpServers": {
|
||||
"dbn-tools": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@dobetternorge/mcp"],
|
||||
"env": { "DBN_API_TOKEN": "YOUR_TOKEN" }
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</div>
|
||||
<p class="lt-preview-mcp__note">
|
||||
<?= $uiLang === 'no'
|
||||
? 'API-token krever Plus- eller Pro-plan. <a href="' . htmlspecialchars($toolsLogin) . '">Logg inn</a> for å generere token og se full oppsettsguide.'
|
||||
: 'API tokens require a Plus or Pro plan. <a href="' . htmlspecialchars($toolsLogin) . '">Log in</a> to generate a token and view the full setup guide.' ?>
|
||||
<section class="lt-preview-mcp-link">
|
||||
<div class="lt-preview-mcp-link__inner">
|
||||
<p>
|
||||
<?= $uiLang === 'no' ? 'Bruker du Claude Desktop, Claude Code eller Cursor?' : 'Using Claude Desktop, Claude Code, or Cursor?' ?>
|
||||
<a href="/mcp-tool.php?tool=<?= urlencode($toolMcpSlug) ?><?= $uiLang !== 'en' ? '&lang=' . urlencode($uiLang) : '' ?>"><?= $uiLang === 'no' ? 'Se MCP-oppsett for dette verktøyet' : 'See MCP setup for this tool' ?> →</a>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user