<?php
// Pass a $page_title variable before including this file.
$current = basename($_SERVER['PHP_SELF']);
require_once __DIR__ . '/lib.php';
?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title><?= h($page_title ?? 'Mailchimp Transactional Demo') ?></title>
    <link rel="stylesheet" href="style.css">
</head>
<body>

<header>
    <h1><?= h($page_title ?? 'Mailchimp Transactional Demo') ?></h1>
</header>

<nav class="nav">
    <a href="index.php"   class="<?= $current==='index.php'?'current':'' ?>">Home</a>
    <a href="setup.php"   class="<?= $current==='setup.php'?'current':'' ?>">Setup</a>
    <span class="sep">|</span>
    <a href="01-ping.php"             class="<?= $current==='01-ping.php'?'current':'' ?>">1. Ping</a>
    <a href="02-allowlist-list.php"   class="<?= $current==='02-allowlist-list.php'?'current':'' ?>">2. List allowlist</a>
    <a href="03-allowlist-add.php"    class="<?= $current==='03-allowlist-add.php'?'current':'' ?>">3. Add</a>
    <a href="04-allowlist-delete.php" class="<?= $current==='04-allowlist-delete.php'?'current':'' ?>">4. Remove</a>
    <a href="05-send.php"             class="<?= $current==='05-send.php'?'current':'' ?>">5. Send</a>
    <a href="06-templates-list.php"   class="<?= $current==='06-templates-list.php'?'current':'' ?>">6. Templates</a>
    <a href="07-templates-add.php"    class="<?= $current==='07-templates-add.php'?'current':'' ?>">7. New template</a>
    <a href="08-stats.php"            class="<?= $current==='08-stats.php'?'current':'' ?>">8. Stats</a>
</nav>

<?php if (!is_configured() && $current !== 'setup.php' && $current !== 'index.php'): ?>
<div class="callout warn">
    <strong>No API key configured.</strong>
    Open <code>config.php</code> and paste your Mandrill key, or follow the
    <a href="setup.php">setup guide</a>.
</div>
<?php endif; ?>

<main>
