['Free', '#f3f4f6', '#374151'],
'plus' => ['Plus', '#ddd6fe', '#5b21b6'],
'pro' => ['Pro Familie', '#bfdbfe', '#1e40af'],
'caveau' => ['CaveauAI', '#d1fae5', '#065f46'],
];
$tierLabel = $tierLabels[$dashTier] ?? $tierLabels['free'];
$showSurveyCta = $dashIsSso && empty($dashDetail['survey_completed_at']);
// User display name
$dashAuthUser = dbnToolsAuthenticatedUser();
$dashEmail = '';
if ($dashAuthUser !== null) {
$e = (string)($dashAuthUser['email'] ?? '');
$dashEmail = strstr($e, '@', true) ?: $e;
}
// Next refill / billing date
$dashNextBilling = '';
$dashNextBillingKey = 'next_refill';
if ($dashIsSso && $dashDetail) {
if (!empty($dashDetail['subscription_period_end'])) {
$ts = strtotime((string)$dashDetail['subscription_period_end']);
$dashNextBilling = $ts ? date('j M Y', $ts) : '';
$dashNextBillingKey = 'next_billing';
} else {
$m = (int)date('m'); $y = (int)date('Y');
if ($m === 12) { $m = 1; $y++; } else { $m++; }
$dashNextBilling = date('j M Y', mktime(0, 0, 0, $m, 1, $y));
}
}
// Tool → MCP slug
$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',
];
// Tool → About page
$toolAboutPages = [
'advocate' => '/advocate-about.php',
'timeline' => '/timeline-about.php',
'korrespond' => '/korrespond-about.php',
];
// Localized strings for new sections
$dashL = [
'en' => [
'acct_header' => 'Account',
'signed_in_as' => 'Signed in as',
'manage_plan' => 'Manage plan',
'upgrade_plan' => 'Upgrade plan',
'top_up' => 'Top up credits',
'next_refill' => 'Credits refill',
'next_billing' => 'Next billing',
'monthly_quota' => 'monthly quota',
'trial_badge' => 'Trial — %d days left',
'about_link' => 'About',
'mcp_copy_slug' => 'Copy MCP slug',
'mcp_section' => 'Developers & MCP',
'mcp_desc' => 'Connect Claude Desktop, Claude Code, Cursor, or any MCP-compatible client to the full tool suite.',
'mcp_token_lbl' => 'API token',
'mcp_no_token' => 'No active token',
'mcp_copy' => 'Copy',
'mcp_not_avail' => 'MCP tokens require Plus or Pro — upgrade to connect AI clients.',
'mcp_stdio_lbl' => 'Claude Desktop / Claude Code (stdio)',
'mcp_remote_lbl' => 'Remote HTTP — Cursor, Zed, Windsurf',
'mcp_full_docs' => 'Full setup guide & token management →',
'tool_ref_title' => 'Tool reference',
'tool_ref_sub' => 'Deep-dive docs for the three flagship tools.',
'guide_link' => 'Guide',
'tech_link' => 'Technical',
'open_tool' => 'Open tool',
],
'no' => [
'acct_header' => 'Konto',
'signed_in_as' => 'Innlogget som',
'manage_plan' => 'Administrer plan',
'upgrade_plan' => 'Oppgrader plan',
'top_up' => 'Kjøp kreditter',
'next_refill' => 'Kreditter fornyes',
'next_billing' => 'Neste fakturering',
'monthly_quota' => 'månedlig kvote',
'trial_badge' => 'Prøveperiode — %d dager igjen',
'about_link' => 'Om',
'mcp_copy_slug' => 'Kopier MCP-slug',
'mcp_section' => 'Utviklere & MCP',
'mcp_desc' => 'Koble Claude Desktop, Claude Code, Cursor eller annen MCP-klient til hele verktøysuiten.',
'mcp_token_lbl' => 'API-token',
'mcp_no_token' => 'Ingen aktiv token',
'mcp_copy' => 'Kopier',
'mcp_not_avail' => 'MCP-tokens krever Plus eller Pro — oppgrader for å koble til AI-klienter.',
'mcp_stdio_lbl' => 'Claude Desktop / Claude Code (stdio)',
'mcp_remote_lbl' => 'Ekstern HTTP — Cursor, Zed, Windsurf',
'mcp_full_docs' => 'Full oppsettsguide & token-administrasjon →',
'tool_ref_title' => 'Verktøyreferanse',
'tool_ref_sub' => 'Dybdedokumentasjon for de tre flaggskipverktøyene.',
'guide_link' => 'Guide',
'tech_link' => 'Teknisk',
'open_tool' => 'Åpne verktøy',
],
'uk' => [
'acct_header' => 'Обліковий запис',
'signed_in_as' => 'Ввійшли як',
'manage_plan' => 'Управляти планом',
'upgrade_plan' => 'Покращити план',
'top_up' => 'Поповнити кредити',
'next_refill' => 'Кредити поновлюються',
'next_billing' => 'Наступне списання',
'monthly_quota' => 'місячна квота',
'trial_badge' => 'Пробний — %d дн. залишилось',
'about_link' => 'Про',
'mcp_copy_slug' => 'Копіювати MCP-ідентифікатор',
'mcp_section' => 'Розробники & MCP',
'mcp_desc' => 'Підключайте Claude Desktop, Claude Code, Cursor або будь-який MCP-клієнт до повного набору інструментів.',
'mcp_token_lbl' => 'API-токен',
'mcp_no_token' => 'Немає активного токена',
'mcp_copy' => 'Копіювати',
'mcp_not_avail' => 'MCP-токени потребують Plus або Pro — оновіться для підключення AI-клієнтів.',
'mcp_stdio_lbl' => 'Claude Desktop / Claude Code (stdio)',
'mcp_remote_lbl' => 'Віддалений HTTP — Cursor, Zed, Windsurf',
'mcp_full_docs' => 'Повна документація та управління токенами →',
'tool_ref_title' => 'Довідник інструментів',
'tool_ref_sub' => 'Детальна документація трьох флагманських інструментів.',
'guide_link' => 'Посібник',
'tech_link' => 'Технічний',
'open_tool' => 'Відкрити',
],
'pl' => [
'acct_header' => 'Konto',
'signed_in_as' => 'Zalogowany jako',
'manage_plan' => 'Zarządzaj planem',
'upgrade_plan' => 'Ulepsz plan',
'top_up' => 'Doładuj kredyty',
'next_refill' => 'Kredyty odnawiają się',
'next_billing' => 'Następne rozliczenie',
'monthly_quota' => 'miesięczny limit',
'trial_badge' => 'Próba — %d dni pozostało',
'about_link' => 'O narzędziu',
'mcp_copy_slug' => 'Kopiuj identyfikator MCP',
'mcp_section' => 'Deweloperzy & MCP',
'mcp_desc' => 'Podłącz Claude Desktop, Claude Code, Cursor lub dowolnego klienta MCP do pełnego zestawu narzędzi.',
'mcp_token_lbl' => 'Token API',
'mcp_no_token' => 'Brak aktywnego tokenu',
'mcp_copy' => 'Kopiuj',
'mcp_not_avail' => 'Tokeny MCP wymagają Plus lub Pro — zaktualizuj, aby połączyć klientów AI.',
'mcp_stdio_lbl' => 'Claude Desktop / Claude Code (stdio)',
'mcp_remote_lbl' => 'Zdalny HTTP — Cursor, Zed, Windsurf',
'mcp_full_docs' => 'Pełna dokumentacja i zarządzanie tokenami →',
'tool_ref_title' => 'Dokumentacja narzędzi',
'tool_ref_sub' => 'Szczegółowa dokumentacja trzech flagowych narzędzi.',
'guide_link' => 'Poradnik',
'tech_link' => 'Techniczny',
'open_tool' => 'Otwórz',
],
];
$dl = $dashL[$uiLang] ?? $dashL['en'];
// Three flagship tools reference data
$toolRefCards = [
'advocate' => [
'icon' => '⚖️',
'mcp' => 'dbn.advocate_brief',
'about' => '/advocate-about.php',
'guide' => '/advocate-guide.php',
'tech' => '/advocate-tech.php',
'tool' => '/advocate.php',
'name' => ['en' => 'Advocate', 'no' => 'Advokat', 'uk' => 'Адвокат', 'pl' => 'Adwokat'],
'desc' => [
'en' => 'AI-generated partisan brief grounded in Lovdata + ECHR, framed for your party role. 9 role presets, 220 K+ verified legal passages.',
'no' => 'AI-generert partisk prosedyre basert på Lovdata + EMD, formulert for din partsrolle. 9 roller, 220 K+ verifiserte rettskilder.',
'uk' => 'ШІ-стислий виклад позиції на основі Lovdata + ЄСПЛ. 9 ролей, 220 K+ верифікованих правових пасажів.',
'pl' => 'Brief AI oparty na Lovdata + ETPC, z Twojej perspektywy. 9 ról, 220 K+ zweryfikowanych źródeł prawnych.',
],
],
'timeline' => [
'icon' => '📅',
'mcp' => 'dbn.timeline',
'about' => '/timeline-about.php',
'guide' => '/timeline-guide.php',
'tech' => '/timeline-tech.php',
'tool' => '/timeline.php',
'name' => ['en' => 'Timeline', 'no' => 'Tidslinje', 'uk' => 'Хронологія', 'pl' => 'Oś czasu'],
'desc' => [
'en' => 'Extract every key date from case documents into a confidence-scored chronology. Recognises 12+ Norwegian date formats, 5 event types.',
'no' => 'Trekk ut alle viktige datoer til en konfidensscorert kronologi. Gjenkjenner 12+ norske datoformater og 5 hendelsestyper.',
'uk' => 'Витягуйте ключові дати з документів справи. 12+ форматів, 5 типів подій, оцінка достовірності.',
'pl' => 'Wyodrębnij daty z dokumentów sprawy w ocenioną chronologię. 12+ formatów dat, 5 typów zdarzeń.',
],
],
'korrespond' => [
'icon' => '✉️',
'mcp' => 'dbn.korrespond',
'about' => '/korrespond-about.php',
'guide' => '/korrespond-guide.php',
'tech' => '/korrespond-tech.php',
'tool' => '/korrespond.php',
'name' => ['en' => 'Korrespond', 'no' => 'Korrespond', 'uk' => 'Кореспонд', 'pl' => 'Korrespond'],
'desc' => [
'en' => 'Statute-grounded authority letters in Norwegian bokmål + your language, side-by-side. Hard-RAG: every § verified — no hallucinated citations.',
'no' => 'Lovsikre myndighetsbrev på norsk bokmål + ditt språk, side ved side. Hard-RAG: alle §§ verifisert — ingen hallusinerte kilder.',
'uk' => 'Офіційні листи, підкріплені законами, норвезькою та вашою мовою. Hard-RAG: кожен § перевірений.',
'pl' => 'Pisma urzędowe oparte na przepisach, po norwesku i w Twoim języku. Hard-RAG: każdy § zweryfikowany.',
],
],
];
require_once __DIR__ . '/includes/tool-svgs.php';
$langSuffix = $uiLang !== 'en' ? '?lang=' . urlencode($uiLang) : '';
?>
= htmlspecialchars(dbnToolsT('dashboard_title', $uiLang)) ?> — Do Better Norge
= htmlspecialchars($tierLabel[0]) ?>
= htmlspecialchars(sprintf($dl['trial_badge'], (int)$dashDetail['trial_days_remaining'])) ?>
= number_format($eff) ?> = $uiLang === 'no' ? 'kred.' : 'credits' ?>
= (int)$dashDetail['balance'] ?> = $uiLang === 'no' ? 'månedlige' : 'monthly' ?> · = (int)$dashDetail['bonus_balance'] ?> = $uiLang === 'no' ? 'forhåndsbetalt' : 'prepaid' ?>
= htmlspecialchars($dl[$dashNextBillingKey]) ?>: = htmlspecialchars($dashNextBilling) ?>
·
= htmlspecialchars($dl['signed_in_as']) ?>: = htmlspecialchars($dashEmail) ?>
= htmlspecialchars(dbnToolsT('credits_available', $uiLang)) ?>
= number_format($eff, 0, ',', ' ') ?>
= (int)$dashDetail['balance'] ?> = htmlspecialchars(dbnToolsT('credits_monthly', $uiLang)) ?> · = (int)$dashDetail['bonus_balance'] ?> = $uiLang === 'no' ? 'forhåndsbetalte' : 'prepaid' ?> · = htmlspecialchars(dbnToolsT('details_link', $uiLang)) ?>
= htmlspecialchars(dbnToolsT('my_case', $uiLang)) ?>
= htmlspecialchars(dbnToolsT('build_your_case', $uiLang)) ?> →
0 ? round($used / 1048576, 1) : 0;
$quotaMb = $quota > 0 ? round($quota / 1048576, 0) : 0;
?>
= $usedMb ?> MB / = $quotaMb ?> MB
= htmlspecialchars(dbnToolsT('build_your_case', $uiLang)) ?>
= htmlspecialchars(dbnToolsT('upload_documents', $uiLang)) ?> →
= htmlspecialchars(dbnToolsT('upgrade_from_plus', $uiLang)) ?>
= htmlspecialchars(dbnToolsT('my_corpus', $uiLang)) ?>
—
= htmlspecialchars(dbnToolsT('open_corpus', $uiLang)) ?> →
= htmlspecialchars(dbnToolsT('earn_credits_eyebrow', $uiLang)) ?>
= htmlspecialchars(dbnToolsT('survey_btn', $uiLang)) ?> →
= htmlspecialchars(dbnToolsT('survey_cta_text', $uiLang)) ?>
= htmlspecialchars(dbnToolsT('disclaimer', $uiLang)) ?>
⚙️
= htmlspecialchars($dl['mcp_section']) ?>
— = htmlspecialchars($dl['mcp_desc']) ?>
▼
= htmlspecialchars($dl['mcp_stdio_lbl']) ?>
claude mcp add dobetternorge -- npx -y @bluenotelogic/mcp dobetternorge-mcp --stdio
# Set token (add to ~/.bashrc or ~/.zshrc to persist):
export DBN_MCP_TOKEN=dbn_user_mcp_…
= htmlspecialchars($dl['mcp_copy']) ?>
= htmlspecialchars($dl['mcp_remote_lbl']) ?>
URL: https://mcp.dobetternorge.no/mcp
Authorization: Bearer dbn_user_mcp_…
= htmlspecialchars($dl['mcp_copy']) ?>
= htmlspecialchars($dl['mcp_full_docs']) ?>
= htmlspecialchars($dl['tool_ref_title']) ?>
= htmlspecialchars($dl['tool_ref_sub']) ?>
$ref):
$refName = $ref['name'][$uiLang] ?? $ref['name']['en'];
$refDesc = $ref['desc'][$uiLang] ?? $ref['desc']['en'];
?>
= $ref['icon'] ?>
= htmlspecialchars($refName) ?>
= htmlspecialchars($ref['mcp']) ?>
= htmlspecialchars($refDesc) ?>
💡
Start with the Case Workbench — frame your situation first, then use the tools below with context already loaded.