first commit from hostslim

This commit is contained in:
2026-03-24 21:12:21 +01:00
commit 20fee7784c
252 changed files with 27385 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Add Website') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-2xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden rounded-xl border border-gray-200">
<div class="p-6">
<form method="POST" action="{{ route('websites.store') }}">
@csrf
<div class="mb-6">
<x-input-label for="name" :value="__('Website Name')" />
<x-text-input id="name" name="name" type="text" class="mt-1 block w-full" :value="old('name')" required autofocus placeholder="My Website" />
<x-input-error class="mt-2" :messages="$errors->get('name')" />
</div>
<div class="mb-6">
<x-input-label for="domain" :value="__('Domain')" />
<x-text-input id="domain" name="domain" type="text" class="mt-1 block w-full" :value="old('domain')" required placeholder="example.com" />
<p class="mt-1 text-sm text-gray-500">{{ __('Enter the domain without http:// or https://') }}</p>
<x-input-error class="mt-2" :messages="$errors->get('domain')" />
</div>
<div class="flex items-center gap-4">
<button type="submit" class="bg-indigo-600 rounded-lg px-4 py-2 text-white hover:bg-indigo-500 transition">
{{ __('Add Website') }}
</button>
<a href="{{ route('websites.index') }}" class="text-sm text-gray-600 hover:text-gray-900">{{ __('Cancel') }}</a>
</div>
</form>
</div>
</div>
</div>
</div>
</x-app-layout>
+59
View File
@@ -0,0 +1,59 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Edit Website') }}: {{ $website->name }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-2xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden rounded-xl border border-gray-200">
<div class="p-6">
<form method="POST" action="{{ route('websites.update', $website) }}">
@csrf
@method('PUT')
<div class="mb-6">
<x-input-label for="name" :value="__('Website Name')" />
<x-text-input id="name" name="name" type="text" class="mt-1 block w-full" :value="old('name', $website->name)" required autofocus />
<x-input-error class="mt-2" :messages="$errors->get('name')" />
</div>
<div class="mb-6">
<x-input-label for="domain" :value="__('Domain')" />
<x-text-input id="domain" name="domain" type="text" class="mt-1 block w-full" :value="old('domain', $website->domain)" required />
<p class="mt-1 text-sm text-gray-500">{{ __('Enter the domain without http:// or https://') }}</p>
<x-input-error class="mt-2" :messages="$errors->get('domain')" />
</div>
<div class="mb-6">
<label for="is_active" class="inline-flex items-center">
<input id="is_active" type="checkbox" name="is_active" value="1" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500" {{ old('is_active', $website->is_active) ? 'checked' : '' }}>
<span class="ms-2 text-sm text-gray-600">{{ __('Active') }}</span>
</label>
</div>
<div class="flex items-center gap-4">
<button type="submit" class="bg-indigo-600 rounded-lg px-4 py-2 text-white hover:bg-indigo-500 transition">
{{ __('Save Changes') }}
</button>
<a href="{{ route('dashboard.show', $website) }}" class="text-sm text-gray-600 hover:text-gray-900">{{ __('Cancel') }}</a>
</div>
</form>
</div>
</div>
<div class="mt-6 bg-red-50 overflow-hidden rounded-xl border border-red-200">
<div class="p-6">
<h3 class="text-lg font-medium text-red-600 mb-4">{{ __('Danger Zone') }}</h3>
<p class="text-sm text-gray-600 mb-4">{{ __('Deleting a website will permanently remove all its analytics data. This action cannot be undone.') }}</p>
<form method="POST" action="{{ route('websites.destroy', $website) }}" onsubmit="return confirm('Are you sure you want to delete this website and all its data?');">
@csrf
@method('DELETE')
<x-danger-button>{{ __('Delete Website') }}</x-danger-button>
</form>
</div>
</div>
</div>
</div>
</x-app-layout>
+58
View File
@@ -0,0 +1,58 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">Websites</h2>
<a href="{{ route('websites.create') }}" class="inline-flex items-center gap-2 px-4 py-2 bg-indigo-600 rounded-lg font-medium text-sm text-white hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition">
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" /></svg>
Add Website
</a>
</div>
</x-slot>
<div class="py-10">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
@if (session('success'))
<div class="mb-6 rounded-xl bg-emerald-50 border border-emerald-200 p-4">
<p class="text-sm font-medium text-emerald-800">{{ session('success') }}</p>
</div>
@endif
@if ($websites->isEmpty())
<div class="bg-white rounded-xl border border-gray-200 p-16 text-center">
<svg class="mx-auto h-14 w-14 text-gray-300" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418" />
</svg>
<h3 class="mt-4 text-lg font-semibold text-gray-900">No websites yet</h3>
<p class="mt-1 text-sm text-gray-500">Get started by adding your first website to track.</p>
<div class="mt-6">
<a href="{{ route('websites.create') }}" class="inline-flex items-center gap-2 px-5 py-2.5 bg-indigo-600 rounded-lg font-medium text-sm text-white hover:bg-indigo-500 transition">
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" /></svg>
Add Website
</a>
</div>
</div>
@else
<div class="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
@foreach ($websites as $website)
<a href="{{ route('dashboard.show', $website) }}" class="group bg-white rounded-xl border border-gray-200 p-6 hover:border-indigo-300 hover:shadow-md transition-all">
<div class="flex items-start justify-between mb-3">
<div class="min-w-0">
<h3 class="text-base font-semibold text-gray-900 truncate group-hover:text-indigo-600 transition-colors">{{ $website->name }}</h3>
<p class="text-sm text-gray-500 mt-0.5">{{ $website->domain }}</p>
</div>
<span class="inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium {{ $website->is_active ? 'bg-emerald-50 text-emerald-700 ring-1 ring-emerald-200' : 'bg-gray-50 text-gray-500 ring-1 ring-gray-200' }}">
<span class="w-1.5 h-1.5 rounded-full {{ $website->is_active ? 'bg-emerald-500' : 'bg-gray-400' }}"></span>
{{ $website->is_active ? 'Active' : 'Inactive' }}
</span>
</div>
<p class="text-xs text-gray-400 font-mono mt-2">{{ $website->tracking_id }}</p>
<div class="mt-4 pt-3 border-t border-gray-100 flex items-center gap-4 text-sm" onclick="event.stopPropagation();">
<span class="text-indigo-600 group-hover:text-indigo-700 font-medium">Dashboard →</span>
</div>
</a>
@endforeach
</div>
@endif
</div>
</div>
</x-app-layout>
@@ -0,0 +1,93 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Tracking Snippet') }}: {{ $website->name }}
</h2>
<a href="{{ route('dashboard.show', $website) }}" class="text-sm text-gray-600 hover:text-gray-900">
&larr; {{ __('Back to dashboard') }}
</a>
</div>
</x-slot>
<div class="py-12">
<div class="max-w-3xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6">
<h3 class="text-lg font-medium text-gray-900 mb-2">{{ __('Install the tracking code') }}</h3>
<p class="text-sm text-gray-600 mb-6">
{{ __('Copy and paste the following code snippet into the') }}
<code class="text-sm bg-gray-100 px-1.5 py-0.5 rounded">&lt;head&gt;</code>
{{ __('section of every page on') }}
<strong>{{ $website->domain }}</strong>.
</p>
<div class="relative" x-data="{ copied: false }">
<pre class="bg-gray-900 text-gray-100 rounded-lg p-4 text-sm overflow-x-auto"><code id="snippet-code">{{ $website->embedSnippet() }}</code></pre>
<button
@click="
navigator.clipboard.writeText(document.getElementById('snippet-code').textContent);
copied = true;
setTimeout(() => copied = false, 2000);
"
class="absolute top-3 right-3 inline-flex items-center gap-1 rounded-md bg-gray-700 px-2.5 py-1.5 text-xs font-medium text-gray-200 hover:bg-gray-600 transition"
>
<span x-show="!copied">{{ __('Copy') }}</span>
<span x-show="copied" x-cloak>{{ __('Copied!') }}</span>
</button>
</div>
</div>
</div>
<div class="mt-6 bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6">
<h3 class="text-lg font-medium text-gray-900 mb-2">{{ __('Track custom events') }}</h3>
<p class="text-sm text-gray-600 mb-4">
{{ __('After the tracking script is loaded, you can send custom events from anywhere in your JavaScript:') }}
</p>
<pre class="bg-gray-900 text-gray-100 rounded-lg p-4 text-sm overflow-x-auto"><code>// Basic event
ta('event', 'signup');
// Event with details
ta('event', 'purchase', {
category: 'ecommerce',
action: 'checkout',
label: 'premium_plan',
value: 29.99,
properties: {
plan: 'premium',
period: 'monthly'
}
});</code></pre>
</div>
</div>
<div class="mt-6 bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">{{ __('Details') }}</h3>
<dl class="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div>
<dt class="text-sm font-medium text-gray-500">{{ __('Tracking ID') }}</dt>
<dd class="mt-1 text-sm text-gray-900 font-mono">{{ $website->tracking_id }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">{{ __('Domain') }}</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $website->domain }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">{{ __('Script URL') }}</dt>
<dd class="mt-1 text-sm text-gray-900 font-mono break-all">{{ route('tracking.script', $website->tracking_id) }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">{{ __('Collection Endpoint') }}</dt>
<dd class="mt-1 text-sm text-gray-900 font-mono break-all">{{ route('collect.store') }}</dd>
</div>
</dl>
</div>
</div>
</div>
</div>
</x-app-layout>