This commit is contained in:
ct
2025-07-07 21:17:00 +08:00
parent 23fa3aec04
commit 6a66f96d22
31 changed files with 227 additions and 232 deletions

View File

@@ -2,9 +2,8 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Illuminate\Support\Str;
use Inertia\Inertia;
class FrontPagesController extends Controller
{
@@ -12,16 +11,16 @@ public function privacy()
{
$markdownPath = resource_path('markdown/privacy.md');
$markdownContent = file_get_contents($markdownPath);
// Parse markdown to HTML using Laravel's built-in Str::markdown helper
$htmlContent = Str::markdown($markdownContent);
// Style the HTML with Tailwind classes
$styledContent = $this->styleHtmlContent($htmlContent);
return Inertia::render('FrontPages/Privacy', [
'content' => $styledContent,
'title' => 'Privacy Policy'
'title' => 'Privacy Policy',
]);
}
@@ -29,16 +28,16 @@ public function terms()
{
$markdownPath = resource_path('markdown/terms.md');
$markdownContent = file_get_contents($markdownPath);
// Parse markdown to HTML using Laravel's built-in Str::markdown helper
$htmlContent = Str::markdown($markdownContent);
// Style the HTML with Tailwind classes
$styledContent = $this->styleHtmlContent($htmlContent);
return Inertia::render('FrontPages/Terms', [
'content' => $styledContent,
'title' => 'Terms & Conditions'
'title' => 'Terms & Conditions',
]);
}
@@ -59,7 +58,7 @@ private function styleHtmlContent($html)
$html = preg_replace('/<blockquote([^>]*)>/', '<blockquote$1 class="border-l-4 border-gray-300 dark:border-gray-600 pl-4 py-2 my-4 bg-gray-50 dark:bg-gray-800">', $html);
$html = preg_replace('/<code([^>]*)>/', '<code$1 class="bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded text-sm font-mono text-gray-800 dark:text-gray-200">', $html);
$html = preg_replace('/<pre([^>]*)>/', '<pre$1 class="bg-gray-100 dark:bg-gray-800 p-4 rounded-lg overflow-x-auto mb-4">', $html);
return $html;
}
}
}