Skip to content

Commit

Permalink
Merge branch 'main' into shift-ci-v10.25.2
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjustesen authored Oct 1, 2023
2 parents 1cdda64 + 3532c89 commit 7a7f206
Show file tree
Hide file tree
Showing 12 changed files with 344 additions and 5 deletions.
25 changes: 23 additions & 2 deletions app/Filament/Widgets/RecentSpeedChartWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function getData(): array
return [
'datasets' => [
[
'label' => 'Download (Mbps)',
'label' => 'Download',
'data' => $results->map(fn ($item) => ! blank($item->download) ? toBits(convertSize($item->download), 2) : 0),
'borderColor' => '#0ea5e9',
'backgroundColor' => '#0ea5e9',
Expand All @@ -59,7 +59,7 @@ protected function getData(): array
'tension' => 0.4,
],
[
'label' => 'Upload (Mbps)',
'label' => 'Upload',
'data' => $results->map(fn ($item) => ! blank($item->upload) ? toBits(convertSize($item->upload), 2) : 0),
'borderColor' => '#8b5cf6',
'backgroundColor' => '#8b5cf6',
Expand All @@ -72,6 +72,27 @@ protected function getData(): array
];
}

protected function getOptions(): array
{
return [
'scales' => [
'x' => [
'display' => true,
'title' => [
'display' => true,
],
],
'y' => [
'display' => true,
'title' => [
'display' => true,
'text' => 'Mbps',
],
],
],
];
}

protected function getType(): string
{
return 'line';
Expand Down
19 changes: 19 additions & 0 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Http\Controllers;

use App\Models\Result;
use Illuminate\Http\Request;

class HomeController extends Controller
{
/**
* Handle the incoming request.
*/
public function __invoke(Request $request)
{
$hasResults = Result::count() > 0;

return view($hasResults ? 'dashboard' : 'get-started');
}
}
25 changes: 25 additions & 0 deletions app/View/Components/AppLayout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\View\Components;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class AppLayout extends Component
{
public $title = 'Page Title';

public function __construct($title)
{
$this->title = $title;
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('layouts.app');
}
}
1 change: 1 addition & 0 deletions public/build/assets/app-d8cd240f.css

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"resources/css/app.css": {
"file": "assets/app-d8cd240f.css",
"isEntry": true,
"src": "resources/css/app.css"
},
"resources/css/filament/admin/theme.css": {
"file": "assets/theme-182befaf.css",
"isEntry": true,
Expand Down
9 changes: 9 additions & 0 deletions resources/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
[x-cloak] {
display: none !important;
}
}
19 changes: 19 additions & 0 deletions resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<x-app-layout title="Dashboard">
<div class="grid gap-4 sm:grid-cols-6 sm:gap-8">
<div class="col-span-full">
@livewire(\App\Filament\Widgets\StatsOverviewWidget::class)
</div>

<div class="col-span-full">
@livewire(\App\Filament\Widgets\RecentSpeedChartWidget::class)
</div>

<div class="col-span-full">
@livewire(\App\Filament\Widgets\RecentPingChartWidget::class)
</div>

<div class="col-span-full">
@livewire(\App\Filament\Widgets\RecentJitterChartWidget::class)
</div>
</div>
</x-app-layout>
149 changes: 149 additions & 0 deletions resources/views/get-started.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="h-full">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Getting Started - {{ config('app.name') }}</title>

{{-- Fonts --}}
<link href="{{ asset('fonts/inter/inter.css') }}" rel="stylesheet" />

{{-- Styles --}}
@filamentStyles
@vite('resources/css/app.css')

<script>
const theme = localStorage.getItem('theme') ?? 'system'
if (
theme === 'dark' ||
(theme === 'system' &&
window.matchMedia('(prefers-color-scheme: dark)')
.matches)
) {
document.documentElement.classList.add('dark')
}
</script>
</head>
<body class="h-full antialiased bg-gray-50 dark:bg-gray-950 text-gray-950 dark:text-white">
<main class="flex flex-col justify-center min-h-full p-4 space-y-4 sm:mx-auto sm:p-6 lg:p-8 sm:max-w-3xl sm:space-y-8">
<header>
<h1 class="text-2xl font-bold tracking-tight text-gray-950 dark:text-white sm:text-3xl">{{ __("Getting Started") }} - {{ config('app.name') }}</h1>
</header>
<div>
<ul role="list" class="divide dark:divide-white/5 divide-white/80">
<li class="relative flex items-center py-4 space-x-4">
<div class="flex-auto min-w-0">
<div class="flex items-center gap-x-3">
<div class="flex-none p-1 rounded-full text-amber-400 bg-gray-100/10">
<div class="w-2 h-2 bg-current rounded-full"></div>
</div>
<h2 class="min-w-0 text-sm font-semibold leading-6 text-white">
<a href="{{ url('/admin/login') }}" class="flex gap-x-2">
<span class="truncate">Sign In</span>
<span class="text-amber-400">/</span>
<span class="whitespace-nowrap">Admin Panel</span>
<span class="absolute inset-0"></span>
</a>
</h2>
</div>
<div class="mt-3 flex items-center gap-x-2.5 text-sm leading-5 dark:text-gray-400 text-gray-950">
<p class="truncate">
Sign in to the admin panel to run your first speedtest or to setup scheduled tests.
</p>
</div>
</div>
<svg class="flex-none w-5 h-5 text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
</svg>
</li>
<li class="relative flex items-center py-4 space-x-4">
<div class="flex-auto min-w-0">
<div class="flex items-center gap-x-3">
<div class="flex-none p-1 rounded-full text-amber-400 bg-gray-100/10">
<div class="w-2 h-2 bg-current rounded-full"></div>
</div>
<h2 class="min-w-0 text-sm font-semibold leading-6 text-white">
<a href="https://docs.speedtest-tracker.dev/" target="_blank" rel="nofollow" class="flex gap-x-2">
<span class="truncate">Getting Started</span>
<span class="text-amber-400">/</span>
<span class="whitespace-nowrap">Docs</span>
<span class="absolute inset-0"></span>
</a>
</h2>
</div>
<div class="mt-3 flex items-center gap-x-2.5 text-sm leading-5 dark:text-gray-400 text-gray-950">
<p class="truncate">
Need help getting started with Speedtest Tracker? Check out the docs.
</p>
</div>
</div>
<svg class="flex-none w-5 h-5 text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
</svg>
</li>
<li class="relative flex items-center py-4 space-x-4">
<div class="flex-auto min-w-0">
<div class="flex items-center gap-x-3">
<div class="flex-none p-1 rounded-full text-amber-400 bg-gray-100/10">
<div class="w-2 h-2 bg-current rounded-full"></div>
</div>
<h2 class="min-w-0 text-sm font-semibold leading-6 text-white">
<a href="https://github.com/alexjustesen/speedtest-tracker" target="_blank" rel="nofollow" class="flex gap-x-2">
<span class="truncate">GitHub</span>
<span class="text-amber-400">/</span>
<span class="whitespace-nowrap">Repo</span>
<span class="absolute inset-0"></span>
</a>
</h2>
</div>
</div>
<svg class="flex-none w-5 h-5 text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
</svg>
</li>
<li class="relative flex items-center py-4 space-x-4">
<div class="flex-auto min-w-0">
<div class="flex items-center gap-x-3">
<div class="flex-none p-1 rounded-full text-amber-400 bg-gray-100/10">
<div class="w-2 h-2 bg-current rounded-full"></div>
</div>
<h2 class="min-w-0 text-sm font-semibold leading-6 text-white">
<a href="https://github.com/alexjustesen/speedtest-tracker/discussions" target="_blank" rel="nofollow" class="flex gap-x-2">
<span class="truncate">Discussions</span>
<span class="text-amber-400">/</span>
<span class="whitespace-nowrap">Community</span>
<span class="absolute inset-0"></span>
</a>
</h2>
</div>
</div>
<svg class="flex-none w-5 h-5 text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
</svg>
</li>
<!-- More items... -->
</ul>
</div>
</main>
{{-- Scripts --}}
@filamentScripts
</body>
</html>
52 changes: 52 additions & 0 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>{{ $title }} - {{ config('app.name') }}</title>

{{-- Fonts --}}
<link href="{{ asset('fonts/inter/inter.css') }}" rel="stylesheet" />

{{-- Styles --}}
@filamentStyles
@vite('resources/css/app.css')

<script>
const theme = localStorage.getItem('theme') ?? 'system'
if (
theme === 'dark' ||
(theme === 'system' &&
window.matchMedia('(prefers-color-scheme: dark)')
.matches)
) {
document.documentElement.classList.add('dark')
}
</script>
</head>
<body class="min-h-screen antialiased bg-gray-50 dark:bg-gray-950 text-gray-950 dark:text-white">
<main class="p-4 sm:p-6 lg:p-8 mx-auto max-w-{{ config('speedtest.content_width') }} space-y-4 sm:space-y-8">
<header class="flex flex-col gap-4 sm:flex-row sm:justify-between sm:items-center">
<div>
<h1 class="text-2xl font-bold tracking-tight text-gray-950 dark:text-white sm:text-3xl">{{ $title ?? 'Page Title' }}</h1>
</div>
<div class="flex-shrink-0">
<x-filament::button
href="{{ url('/admin') }}"
tag="a"
>
Admin Panel
</x-filament::button>
</div>
</header>
{{ $slot }}
</main>
{{-- Scripts --}}
@filamentScripts
</body>
</html>
3 changes: 2 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use App\Http\Controllers\HomeController;
use Illuminate\Support\Facades\Route;

/*
Expand All @@ -13,7 +14,7 @@
|
*/

Route::redirect('/', '/admin');
Route::get('/', HomeController::class);

Route::get('/login', function () {
return redirect('/admin/login');
Expand Down
29 changes: 29 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import defaultTheme from 'tailwindcss/defaultTheme';
import forms from '@tailwindcss/forms';
import presets from './vendor/filament/support/tailwind.config.preset';
import typography from '@tailwindcss/typography';

/** @type {import('tailwindcss').Config} */
export default {
presets: [presets],

content: [
'./resources/views/**/*.blade.php',
'./storage/framework/views/*.php',
],

darkMode: 'class',

theme: {
extend: {
fontFamily: {
sans: ['Inter', ...defaultTheme.fontFamily.sans],
},
},
},

plugins: [
forms,
typography,
],
}
Loading

0 comments on commit 7a7f206

Please sign in to comment.