From 8d5920468d9fa057c3da8ec00f717d3e0c4b3a87 Mon Sep 17 00:00:00 2001 From: Refringe Date: Fri, 17 May 2024 17:11:54 -0400 Subject: [PATCH] To many things to mention Shut up. --- .editorconfig | 2 +- app/Models/Mod.php | 5 + app/Models/ModVersion.php | 11 +- app/Models/SptVersion.php | 2 +- app/View/Components/LatestModListing.php | 17 ++ composer.json | 1 + composer.lock | 154 +++++++++++++++++- database/factories/SptVersionFactory.php | 2 +- phpstan.neon | 24 ++- resources/css/app.css | 9 + .../components/application-mark.blade.php | 11 +- .../authentication-card-logo.blade.php | 11 +- .../components/latest-mod-listing.blade.php | 48 ++++++ resources/views/components/warning.blade.php | 4 + resources/views/home.blade.php | 29 ++++ resources/views/layouts/app.blade.php | 68 ++++---- .../livewire/latest-mod-listing.blade.php | 54 ++++++ resources/views/navigation-menu.blade.php | 68 ++++---- routes/web.php | 2 +- storage/debugbar/.gitignore | 2 + tailwind.config.js | 22 ++- 21 files changed, 455 insertions(+), 91 deletions(-) create mode 100644 app/View/Components/LatestModListing.php create mode 100644 resources/views/components/latest-mod-listing.blade.php create mode 100644 resources/views/components/warning.blade.php create mode 100644 resources/views/home.blade.php create mode 100644 resources/views/livewire/latest-mod-listing.blade.php create mode 100644 storage/debugbar/.gitignore diff --git a/.editorconfig b/.editorconfig index 8f0de65..facf37e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,7 +11,7 @@ trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false -[*.{yml,yaml}] +[*.{yml,yaml,neon}] indent_size = 2 [docker-compose.yml] diff --git a/app/Models/Mod.php b/app/Models/Mod.php index 437d22e..3ba9e6d 100644 --- a/app/Models/Mod.php +++ b/app/Models/Mod.php @@ -38,6 +38,11 @@ class Mod extends Model return $this->hasMany(ModVersion::class); } + public function versionWithHighestSptVersion() + { + return $this->hasOne(ModVersion::class)->highestSptVersion(); + } + protected function slug(): Attribute { return Attribute::make( diff --git a/app/Models/ModVersion.php b/app/Models/ModVersion.php index 58bfa50..304b8d9 100644 --- a/app/Models/ModVersion.php +++ b/app/Models/ModVersion.php @@ -25,8 +25,15 @@ class ModVersion extends Model return $this->belongsTo(Mod::class); } - public function spt_version(): BelongsTo + public function sptVersion(): belongsTo { - return $this->belongsTo(SptVersion::class, 'spt_version_id'); + return $this->belongsTo(SptVersion::class); + } + + public function scopeHighestSptVersion($query) + { + return $query->orderByDesc( + SptVersion::select('spt_versions.version')->whereColumn('mod_versions.spt_version_id', 'spt_versions.id') + )->orderByDesc('mod_versions.version'); } } diff --git a/app/Models/SptVersion.php b/app/Models/SptVersion.php index 1393fd3..f261e43 100644 --- a/app/Models/SptVersion.php +++ b/app/Models/SptVersion.php @@ -16,7 +16,7 @@ class SptVersion extends Model 'color_class', ]; - public function mod_versions(): HasMany + public function modVersions(): HasMany { return $this->hasMany(ModVersion::class); } diff --git a/app/View/Components/LatestModListing.php b/app/View/Components/LatestModListing.php new file mode 100644 index 0000000..292a495 --- /dev/null +++ b/app/View/Components/LatestModListing.php @@ -0,0 +1,17 @@ + Mod::with('versionWithHighestSptVersion.sptVersion')->latest()->take(6)->get(), + ]); + } +} diff --git a/composer.json b/composer.json index 3c34243..86fd501 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "livewire/livewire": "^3.0" }, "require-dev": { + "barryvdh/laravel-debugbar": "^3.13", "fakerphp/faker": "^1.23", "larastan/larastan": "^2.9", "laravel/pint": "^1.13", diff --git a/composer.lock b/composer.lock index 03464e8..3d37332 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2c33659a8a7e803ed06f34292950d0f2", + "content-hash": "97244cec2c528738d97cf3b96c127b04", "packages": [ { "name": "bacon/bacon-qr-code", @@ -7168,6 +7168,90 @@ } ], "packages-dev": [ + { + "name": "barryvdh/laravel-debugbar", + "version": "v3.13.5", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-debugbar.git", + "reference": "92d86be45ee54edff735e46856f64f14b6a8bb07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/92d86be45ee54edff735e46856f64f14b6a8bb07", + "reference": "92d86be45ee54edff735e46856f64f14b6a8bb07", + "shasum": "" + }, + "require": { + "illuminate/routing": "^9|^10|^11", + "illuminate/session": "^9|^10|^11", + "illuminate/support": "^9|^10|^11", + "maximebf/debugbar": "~1.22.0", + "php": "^8.0", + "symfony/finder": "^6|^7" + }, + "require-dev": { + "mockery/mockery": "^1.3.3", + "orchestra/testbench-dusk": "^5|^6|^7|^8|^9", + "phpunit/phpunit": "^9.6|^10.5", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.13-dev" + }, + "laravel": { + "providers": [ + "Barryvdh\\Debugbar\\ServiceProvider" + ], + "aliases": { + "Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar" + } + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Barryvdh\\Debugbar\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "PHP Debugbar integration for Laravel", + "keywords": [ + "debug", + "debugbar", + "laravel", + "profiler", + "webprofiler" + ], + "support": { + "issues": "https://github.com/barryvdh/laravel-debugbar/issues", + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.13.5" + }, + "funding": [ + { + "url": "https://fruitcake.nl", + "type": "custom" + }, + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2024-04-12T11:20:37+00:00" + }, { "name": "fakerphp/faker", "version": "v1.23.1", @@ -7521,6 +7605,74 @@ }, "time": "2024-04-30T15:02:26+00:00" }, + { + "name": "maximebf/debugbar", + "version": "v1.22.3", + "source": { + "type": "git", + "url": "https://github.com/maximebf/php-debugbar.git", + "reference": "7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96", + "reference": "7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96", + "shasum": "" + }, + "require": { + "php": "^7.2|^8", + "psr/log": "^1|^2|^3", + "symfony/var-dumper": "^4|^5|^6|^7" + }, + "require-dev": { + "dbrekelmans/bdi": "^1", + "phpunit/phpunit": "^8|^9", + "symfony/panther": "^1|^2.1", + "twig/twig": "^1.38|^2.7|^3.0" + }, + "suggest": { + "kriswallsmith/assetic": "The best way to manage assets", + "monolog/monolog": "Log using Monolog", + "predis/predis": "Redis storage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.22-dev" + } + }, + "autoload": { + "psr-4": { + "DebugBar\\": "src/DebugBar/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maxime Bouroumeau-Fuseau", + "email": "maxime.bouroumeau@gmail.com", + "homepage": "http://maximebf.com" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Debug bar in the browser for php application", + "homepage": "https://github.com/maximebf/php-debugbar", + "keywords": [ + "debug", + "debugbar" + ], + "support": { + "issues": "https://github.com/maximebf/php-debugbar/issues", + "source": "https://github.com/maximebf/php-debugbar/tree/v1.22.3" + }, + "time": "2024-04-03T19:39:26+00:00" + }, { "name": "mockery/mockery", "version": "1.6.11", diff --git a/database/factories/SptVersionFactory.php b/database/factories/SptVersionFactory.php index 18095a6..6e17ca0 100644 --- a/database/factories/SptVersionFactory.php +++ b/database/factories/SptVersionFactory.php @@ -14,7 +14,7 @@ class SptVersionFactory extends Factory { return [ 'version' => $this->faker->numerify('1.#.#'), - 'color_class' => $this->faker->word(), + 'color_class' => $this->faker->randomElement(['green', 'yellow', 'red', 'gray']), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]; diff --git a/phpstan.neon b/phpstan.neon index 93d05f3..05ba64b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,22 @@ includes: - - vendor/larastan/larastan/extension.neon + - vendor/larastan/larastan/extension.neon + parameters: - paths: - - app/ - level: 5 + level: 6 + + paths: + - app/ + - tests/ + + scanFiles: + - tests/Pest.php + - vendor/mockery/mockery/library/helpers.php + + ignoreErrors: + - message: '#^Undefined variable: \$this$#' + paths: + - tests/* + + - message: '#Call to an undefined method Pest\\Expectation|Pest\\Support\\Extendable::#' + paths: + - tests/* diff --git a/resources/css/app.css b/resources/css/app.css index 0de2120..eb99723 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -5,3 +5,12 @@ [x-cloak] { display: none; } + +button[type="submit"]:not([role="menuitem"]), +button[type="button"]:not([role="menuitem"]) { + @apply border border-transparent rounded-md text-white bg-gray-900 hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-600 +} + +input[type="checkbox"] { + @apply text-gray-800 focus:ring-gray-600 border-gray-300 rounded +} diff --git a/resources/views/components/application-mark.blade.php b/resources/views/components/application-mark.blade.php index 182054e..1b54d0f 100644 --- a/resources/views/components/application-mark.blade.php +++ b/resources/views/components/application-mark.blade.php @@ -1,4 +1,9 @@ - - - + + + + + + + + diff --git a/resources/views/components/authentication-card-logo.blade.php b/resources/views/components/authentication-card-logo.blade.php index 0b59654..515aec0 100644 --- a/resources/views/components/authentication-card-logo.blade.php +++ b/resources/views/components/authentication-card-logo.blade.php @@ -1,6 +1,11 @@ - - - + + + + + + + + diff --git a/resources/views/components/latest-mod-listing.blade.php b/resources/views/components/latest-mod-listing.blade.php new file mode 100644 index 0000000..8d07edb --- /dev/null +++ b/resources/views/components/latest-mod-listing.blade.php @@ -0,0 +1,48 @@ +
+ +
+
+

{{ __('Latest Mods') }}

+
+
+ +
+
+ + +
diff --git a/resources/views/components/warning.blade.php b/resources/views/components/warning.blade.php new file mode 100644 index 0000000..fba137d --- /dev/null +++ b/resources/views/components/warning.blade.php @@ -0,0 +1,4 @@ +
+

Notice: The Forge is currently under + heavy construction. Expect nothing to work.

+
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php new file mode 100644 index 0000000..5fd7205 --- /dev/null +++ b/resources/views/home.blade.php @@ -0,0 +1,29 @@ + + +
+
+
+ {{-- Welcome Section --}} +
+ + + +
+

Step into + {{ config('app.name', 'The Forge') }}

+

The greatest resource available for Single Player Tarkov modifications. Where modding legends are made. Discover powerful tools, expert-written guides, and exclusive mods. Craft your vision. Transform the game.

+
+
+ + +
+
+
+
+ diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index e85a103..00dfd4a 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -1,45 +1,47 @@ - - - - + + + + - {{ config('app.name', 'Laravel') }} + {{ config('app.name', 'The Forge') }} - - - + + + - - @vite(['resources/css/app.css', 'resources/js/app.js']) + + @vite(['resources/css/app.css', 'resources/js/app.js']) - - @livewireStyles - - - + + @livewireStyles + + -
- @livewire('navigation-menu') + + - - @if (isset($header)) -
-
- {{ $header }} -
-
- @endif +
+ @livewire('navigation-menu') - -
- {{ $slot }} -
-
+ + @if (isset($header)) +
+
+ {{ $header }} +
+
+ @endif - @stack('modals') + +
+ {{ $slot }} +
+
- @livewireScripts - +@stack('modals') + +@livewireScripts + diff --git a/resources/views/livewire/latest-mod-listing.blade.php b/resources/views/livewire/latest-mod-listing.blade.php new file mode 100644 index 0000000..c7a47f6 --- /dev/null +++ b/resources/views/livewire/latest-mod-listing.blade.php @@ -0,0 +1,54 @@ +
+
+
+ +
+
+
+

{{ __('Latest Mods') }}

+
+
+ +
+
+
+ + +
+
+
diff --git a/resources/views/navigation-menu.blade.php b/resources/views/navigation-menu.blade.php index 426c29a..ffea1f7 100644 --- a/resources/views/navigation-menu.blade.php +++ b/resources/views/navigation-menu.blade.php @@ -6,7 +6,7 @@ @@ -29,7 +29,7 @@ {{ Auth::user()->currentTeam->name }} - + @@ -62,7 +62,7 @@ @foreach (Auth::user()->allTeams() as $team) - + @endforeach @endif @@ -75,21 +75,23 @@
- @if (Laravel\Jetstream\Jetstream::managesProfilePhotos()) - - @else - - - - @endif + @else + + + + @endif + @endauth @@ -114,8 +116,7 @@
@csrf - + {{ __('Log Out') }} @@ -128,8 +129,8 @@
@@ -147,16 +148,18 @@
- @if (Laravel\Jetstream\Jetstream::managesProfilePhotos()) -
- {{ Auth::user()->name }} -
- @endif + @auth() + @if (Laravel\Jetstream\Jetstream::managesProfilePhotos()) +
+ {{ Auth::user()->name }} +
+ @endif -
-
{{ Auth::user()->name }}
-
{{ Auth::user()->email }}
-
+
+
{{ Auth::user()->name }}
+
{{ Auth::user()->email }}
+
+ @endauth()
@@ -175,8 +178,7 @@
@csrf - + {{ __('Log Out') }} @@ -209,7 +211,7 @@
@foreach (Auth::user()->allTeams() as $team) - + @endforeach @endif @endif diff --git a/routes/web.php b/routes/web.php index 419a555..85957e3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,7 +3,7 @@ use Illuminate\Support\Facades\Route; Route::get('/', function () { - return view('welcome'); + return view('home'); }); Route::middleware(['auth:sanctum', config('jetstream.auth_session'), 'verified'])->group(function () { diff --git a/storage/debugbar/.gitignore b/storage/debugbar/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/storage/debugbar/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/tailwind.config.js b/tailwind.config.js index abfacff..f1632bb 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,23 +1,29 @@ -import defaultTheme from 'tailwindcss/defaultTheme'; -import forms from '@tailwindcss/forms'; -import typography from '@tailwindcss/typography'; +import defaultTheme from "tailwindcss/defaultTheme"; +import forms from "@tailwindcss/forms"; +import typography from "@tailwindcss/typography"; /** @type {import('tailwindcss').Config} */ export default { content: [ - './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php', - './vendor/laravel/jetstream/**/*.blade.php', - './storage/framework/views/*.php', - './resources/views/**/*.blade.php', + "./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php", + "./vendor/laravel/jetstream/**/*.blade.php", + "./storage/framework/views/*.php", + "./resources/views/**/*.blade.php", ], theme: { extend: { fontFamily: { - sans: ['Figtree', ...defaultTheme.fontFamily.sans], + sans: ["Figtree", ...defaultTheme.fontFamily.sans], }, }, }, + safelist: [ + { + pattern: /(bg|text|ring)-(green|yellow|red|grey)-(50|700|600\/20)/, + }, + ], + plugins: [forms, typography], };