lthn.io/app/Mod/Names/Mail/ClaimApproved.php
Claude 8f9c1f282e
feat: email notifications on claim approval + OG images for names
ClaimApproved mailable sent when admin approves a claim — dark
themed HTML email with name, next steps, and CTA links. Wrapped
in try/catch so email failure doesn't block approval.

Dynamic SVG OpenGraph images at /names/{name}/og.svg — shows name,
type badge (Registered/Reserved/Gateway/Available), and branding.
og:image meta tag added to name detail pages via @push('head').

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 12:20:43 +01:00

66 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
namespace Mod\Names\Mail;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Mod\Names\Models\NameClaim;
/**
* Sent when a pre-registration claim is approved.
*
* Mail::to($claim->email)->send(new ClaimApproved($claim));
*/
class ClaimApproved extends Mailable
{
public function __construct(
public readonly NameClaim $claim,
) {}
public function envelope(): Envelope
{
return new Envelope(
subject: "{$this->claim->name}.lthn — Your Name Claim Has Been Approved",
);
}
public function content(): Content
{
return new Content(
htmlString: $this->buildHtml(),
);
}
private function buildHtml(): string
{
$name = e($this->claim->name);
$fqdn = "{$name}.lthn";
return <<<HTML
<div style="font-family: -apple-system, sans-serif; max-width: 600px; margin: 0 auto; padding: 2rem;">
<h1 style="color: #34d399; font-size: 1.5rem;">Your .lthn Name is Ready</h1>
<p>Great news — your claim for <strong>{$fqdn}</strong> has been approved and registered on the Lethean blockchain.</p>
<div style="background: #111827; border: 1px solid #1f2937; border-radius: 0.5rem; padding: 1.5rem; margin: 1.5rem 0;">
<p style="margin: 0 0 0.5rem; color: #9ca3af;">Name</p>
<p style="margin: 0; font-size: 1.25rem; font-weight: 600; color: #e5e7eb;">{$fqdn}</p>
</div>
<h2 style="font-size: 1.1rem; margin-top: 2rem;">What's Next?</h2>
<ul style="line-height: 2;">
<li><strong>Manage DNS</strong> — log in at <a href="https://order.lthn.ai">order.lthn.ai</a> to set up your DNS records</li>
<li><strong>View your name</strong> — <a href="https://lthn.io/names/{$name}">lthn.io/names/{$name}</a></li>
<li><strong>Get SSL</strong> — add a certificate from the services page</li>
</ul>
<p style="color: #6b7280; font-size: 0.85rem; margin-top: 2rem;">
Lethean CIC — Community Interest Company<br>
<a href="https://lthn.io" style="color: #818cf8;">lthn.io</a>
</p>
</div>
HTML;
}
}