mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 12:10:41 -05:00
Fixes Dark Mode Script - Work on Detail Page
This commit is contained in:
parent
fa963fe545
commit
45b9ebc096
@ -7,12 +7,16 @@ indent_size = 4
|
|||||||
indent_style = space
|
indent_style = space
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
max_line_length = 120
|
||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
max_line_length = off
|
||||||
|
|
||||||
[*.{yml,yaml,neon}]
|
[*.{yml,yaml,neon}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
max_line_length = off
|
||||||
|
|
||||||
[docker-compose.yml]
|
[docker-compose.yml]
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
max_line_length = off
|
||||||
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -154,4 +154,6 @@ jobs:
|
|||||||
run: composer install -n --no-dev --prefer-dist
|
run: composer install -n --no-dev --prefer-dist
|
||||||
|
|
||||||
- name: Execute Code Static Analysis with Larastan
|
- name: Execute Code Static Analysis with Larastan
|
||||||
run: vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress
|
run: |
|
||||||
|
composer require --dev larastan/larastan
|
||||||
|
vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress
|
||||||
|
@ -33,7 +33,7 @@ class ModController extends Controller
|
|||||||
->with('user:id,name')
|
->with('user:id,name')
|
||||||
->find($modId);
|
->find($modId);
|
||||||
|
|
||||||
if (!$mod || $mod->slug !== $slug) {
|
if (! $mod || $mod->slug !== $slug) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ namespace App\Policies;
|
|||||||
|
|
||||||
use App\Models\Mod;
|
use App\Models\Mod;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Auth\Access\Response;
|
|
||||||
|
|
||||||
class ModPolicy
|
class ModPolicy
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"barryvdh/laravel-debugbar": "^3.13",
|
"barryvdh/laravel-debugbar": "^3.13",
|
||||||
|
"deployer/deployer": "^7.4",
|
||||||
"fakerphp/faker": "^1.23",
|
"fakerphp/faker": "^1.23",
|
||||||
"larastan/larastan": "^2.9",
|
"larastan/larastan": "^2.9",
|
||||||
"laravel/pint": "^1.13",
|
"laravel/pint": "^1.13",
|
||||||
|
45
composer.lock
generated
45
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "ca3ac0463e2bccac87eddb5c41b29a5b",
|
"content-hash": "40b3d2220c6f07a6c8182c49f5174d16",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bacon/bacon-qr-code",
|
"name": "bacon/bacon-qr-code",
|
||||||
@ -7236,6 +7236,49 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-04-12T11:20:37+00:00"
|
"time": "2024-04-12T11:20:37+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "deployer/deployer",
|
||||||
|
"version": "v7.4.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/deployphp/deployer.git",
|
||||||
|
"reference": "b438dc22545ab2ecc67d79c80c7a79c156de3599"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/deployphp/deployer/zipball/b438dc22545ab2ecc67d79c80c7a79c156de3599",
|
||||||
|
"reference": "b438dc22545ab2ecc67d79c80c7a79c156de3599",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"dep"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Anton Medvedev",
|
||||||
|
"email": "anton@medv.io"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Deployment Tool",
|
||||||
|
"homepage": "https://deployer.org",
|
||||||
|
"support": {
|
||||||
|
"docs": "https://deployer.org/docs",
|
||||||
|
"issues": "https://github.com/deployphp/deployer/issues",
|
||||||
|
"source": "https://github.com/deployphp/deployer"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/sponsors/antonmedv",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-04-17T20:55:49+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "fakerphp/faker",
|
"name": "fakerphp/faker",
|
||||||
"version": "v1.23.1",
|
"version": "v1.23.1",
|
||||||
|
24
deploy.yaml
Normal file
24
deploy.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import:
|
||||||
|
- recipe/laravel.php
|
||||||
|
|
||||||
|
config:
|
||||||
|
application: 'Forge'
|
||||||
|
repository: 'https://github.com/SPT-AKI/forge.git'
|
||||||
|
keep_releases: 5
|
||||||
|
|
||||||
|
hosts:
|
||||||
|
forge.sp-tarkov.com:
|
||||||
|
remote_user: deployer
|
||||||
|
deploy_path: '~/Forge'
|
||||||
|
branch: 'main'
|
||||||
|
env:
|
||||||
|
environment: production
|
||||||
|
labels:
|
||||||
|
env: prod
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
build:
|
||||||
|
- run: uptime
|
||||||
|
|
||||||
|
after:
|
||||||
|
deploy:failed: deploy:unlock
|
@ -1,37 +1,49 @@
|
|||||||
import "./bootstrap";
|
import "./bootstrap";
|
||||||
|
|
||||||
var themeToggleDarkIcon = document.getElementById("theme-toggle-dark-icon");
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
var themeToggleLightIcon = document.getElementById("theme-toggle-light-icon");
|
const themeToggleIcon = {
|
||||||
|
dark: document.getElementById("theme-toggle-dark-icon"),
|
||||||
|
light: document.getElementById("theme-toggle-light-icon"),
|
||||||
|
};
|
||||||
|
|
||||||
if (
|
// Function to update the visibility of the theme icons based on the theme
|
||||||
localStorage.getItem("color-theme") === "dark" ||
|
function updateIconVisibility(theme) {
|
||||||
(!("color-theme" in localStorage) &&
|
if (theme === "dark") {
|
||||||
window.matchMedia("(prefers-color-scheme: dark)").matches)
|
themeToggleIcon.dark.classList.add("hidden");
|
||||||
) {
|
themeToggleIcon.light.classList.remove("hidden");
|
||||||
themeToggleLightIcon.classList.remove("hidden");
|
} else {
|
||||||
} else {
|
themeToggleIcon.dark.classList.remove("hidden");
|
||||||
themeToggleDarkIcon.classList.remove("hidden");
|
themeToggleIcon.light.classList.add("hidden");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var themeToggleBtn = document.getElementById("theme-toggle");
|
// Function to update the theme
|
||||||
themeToggleBtn.addEventListener("click", function () {
|
function updateTheme(theme) {
|
||||||
themeToggleDarkIcon.classList.toggle("hidden");
|
// Update the document element class
|
||||||
themeToggleLightIcon.classList.toggle("hidden");
|
document.documentElement.classList.remove("light", "dark");
|
||||||
if (localStorage.getItem("color-theme")) {
|
document.documentElement.classList.add(theme);
|
||||||
if (localStorage.getItem("color-theme") === "light") {
|
|
||||||
document.documentElement.classList.add("dark");
|
// Update local storage
|
||||||
localStorage.setItem("color-theme", "dark");
|
localStorage.setItem("forge-theme", theme);
|
||||||
} else {
|
|
||||||
document.documentElement.classList.remove("dark");
|
// Update icon visibility
|
||||||
localStorage.setItem("color-theme", "light");
|
updateIconVisibility(theme);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (document.documentElement.classList.contains("dark")) {
|
|
||||||
document.documentElement.classList.remove("dark");
|
|
||||||
localStorage.setItem("color-theme", "light");
|
|
||||||
} else {
|
|
||||||
document.documentElement.classList.add("dark");
|
|
||||||
localStorage.setItem("color-theme", "dark");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initial setup: Determine the current theme and set icon visibility
|
||||||
|
const initialTheme =
|
||||||
|
localStorage.getItem("forge-theme") ||
|
||||||
|
(window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark");
|
||||||
|
document.documentElement.classList.add(initialTheme); // Ensure the class is set
|
||||||
|
updateIconVisibility(initialTheme);
|
||||||
|
|
||||||
|
// Set up the theme toggle button
|
||||||
|
const themeToggleBtn = document.getElementById("theme-toggle");
|
||||||
|
themeToggleBtn.addEventListener("click", function () {
|
||||||
|
// Determine the current theme by checking the classList of documentElement
|
||||||
|
const currentTheme = document.documentElement.classList.contains("dark") ? "dark" : "light";
|
||||||
|
const newTheme = currentTheme === "light" ? "dark" : "light";
|
||||||
|
|
||||||
|
updateTheme(newTheme);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -7,16 +7,21 @@
|
|||||||
|
|
||||||
<title>{{ config('app.name', 'The Forge') }}</title>
|
<title>{{ config('app.name', 'The Forge') }}</title>
|
||||||
|
|
||||||
<link href="https://fonts.bunny.net" rel="preconnect">
|
<link rel="icon" href="data:image/x-icon;base64,AA">
|
||||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet">
|
<link href="//fonts.bunny.net" rel="preconnect">
|
||||||
|
<link href="//fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
{{-- Handle setting the dark mode theme. Done here to avoid FOUC --}}
|
|
||||||
<script>
|
<script>
|
||||||
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
// Immediately set the theme to prevent a flash of the default theme when another is set.
|
||||||
document.documentElement.classList.add('dark')
|
// Must be located inline, in the head, and before any CSS is loaded.
|
||||||
} else {
|
(function () {
|
||||||
document.documentElement.classList.remove('dark')
|
let theme = localStorage.getItem('forge-theme');
|
||||||
|
if (!theme) {
|
||||||
|
theme = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
||||||
|
localStorage.setItem('forge-theme', theme);
|
||||||
}
|
}
|
||||||
|
document.documentElement.classList.add(theme);
|
||||||
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||||
@ -32,14 +37,14 @@
|
|||||||
@livewire('navigation-menu')
|
@livewire('navigation-menu')
|
||||||
|
|
||||||
@if (isset($header))
|
@if (isset($header))
|
||||||
<header class="bg-white dark:bg-gray-800 shadow dark:shadow-white">
|
<header class="bg-gray-50 dark:bg-gray-900 shadow dark:shadow-gray-950">
|
||||||
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
|
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
|
||||||
{{ $header }}
|
{{ $header }}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<main class="py-12">
|
<main class="py-6 sm:py-12">
|
||||||
{{ $slot }}
|
{{ $slot }}
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,28 +5,35 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
||||||
<title>{{ config('app.name', 'Laravel') }}</title>
|
<title>{{ config('app.name', 'The Forge') }}</title>
|
||||||
|
|
||||||
<link href="https://fonts.bunny.net" rel="preconnect">
|
<link rel="icon" href="data:image/x-icon;base64,AA">
|
||||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet">
|
<link href="//fonts.bunny.net" rel="preconnect">
|
||||||
|
<link href="//fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
{{-- Handle setting the dark mode theme. Done here to avoid FOUC --}}
|
|
||||||
<script>
|
<script>
|
||||||
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
// Immediately set the theme to prevent a flash of the default theme when another is set.
|
||||||
document.documentElement.classList.add('dark')
|
// Must be located inline, in the head, and before any CSS is loaded.
|
||||||
} else {
|
(function () {
|
||||||
document.documentElement.classList.remove('dark')
|
let theme = localStorage.getItem('forge-theme');
|
||||||
|
if (!theme) {
|
||||||
|
theme = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
||||||
|
localStorage.setItem('forge-theme', theme);
|
||||||
}
|
}
|
||||||
|
document.documentElement.classList.add(theme);
|
||||||
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||||
@livewireStyles
|
@livewireStyles
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="font-sans text-gray-900 antialiased">
|
<div class="font-sans text-gray-900 antialiased">
|
||||||
{{ $slot }}
|
{{ $slot }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@livewireScripts
|
@livewireScripts
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,30 +1,44 @@
|
|||||||
<x-app-layout>
|
<x-app-layout>
|
||||||
|
|
||||||
<x-slot name="header">
|
<x-slot name="header">
|
||||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||||
{{ __('Mod Details') }}
|
{{ __('Mod Details') }}
|
||||||
</h2>
|
</h2>
|
||||||
</x-slot>
|
</x-slot>
|
||||||
|
|
||||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
<div class="grid grid-cols-1 lg:grid-cols-3 max-w-7xl mx-auto pb-6 px-4 gap-6 sm:px-6 lg:px-8">
|
||||||
<div class="bg-white dark:bg-gray-900 overflow-hidden shadow-xl dark:shadow-gray-900 sm:rounded-lg">
|
|
||||||
<div class="grid grid-cols-2 gap-6">
|
<div class="lg:col-span-2 p-4 sm:p-6 text-center sm:text-left bg-white dark:bg-gray-950 rounded-xl shadow-md dark:shadow-gray-950 drop-shadow-2xl">
|
||||||
<div>
|
<div class="flex flex-col sm:flex-row gap-4 sm:gap-6">
|
||||||
<div>
|
<div class="grow-0 flex justify-center items-center">
|
||||||
<img src="{{ $mod->thumbnail }}" alt="{{ $mod->name }}" />
|
@if(empty($mod->thumbnail))
|
||||||
<h2>{{ $mod->name }}</h2>
|
<img src="https://placehold.co/144x144/EEE/31343C?font=source-sans-pro&text={{ $mod->name }}" alt="{{ $mod->name }}" class="block dark:hidden w-36 rounded-lg">
|
||||||
<p>{{ $mod->latestSptVersion->sptVersion->version }}</p>
|
<img src="https://placehold.co/144x144/31343C/EEE?font=source-sans-pro&text={{ $mod->name }}" alt="{{ $mod->name }}" class="hidden dark:block w-36 rounded-lg">
|
||||||
<p>{{ $mod->user->name }}</p>
|
@else
|
||||||
<p>{{ $mod->total_downloads }}</p>
|
<img src="{{ $mod->thumbnail }}" alt="{{ $mod->name }}" class="w-36 rounded-lg">
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="grow flex flex-col justify-center items-center sm:items-start text-gray-800 dark:text-gray-200">
|
||||||
<a href="{{ $mod->latestSptVersion->link }}">{{ __('Download') }}</a>
|
<h2 class="pb-1 sm:p-0 text-3xl font-bold text-gray-900 dark:text-white">
|
||||||
</div>
|
{{ $mod->name }}
|
||||||
</div>
|
<span class="font-light text-nowrap text-gray-700 dark:text-gray-400">
|
||||||
<div>
|
{{ $mod->latestSptVersion->version }}
|
||||||
<h2>{{ __('Details') }}</h2>
|
</span>
|
||||||
|
</h2>
|
||||||
|
<p>{{ __('Created by') }} {{ $mod->user->name }}</p>
|
||||||
|
<p>{{ $mod->latestSptVersion->sptVersion->version }} {{ __('Compatible') }}</p>
|
||||||
|
<p>{{ $mod->total_downloads }} {{ __('Downloads') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-1 flex flex-col gap-6">
|
||||||
|
<a href="{{ $mod->latestSptVersion->link }}" class="block">
|
||||||
|
<button type="button" class="w-full">{{ __('Download Latest Version') }}</button>
|
||||||
|
</a>
|
||||||
|
<h2 class="text-2xl font-bold text-gray-900 dark:text-gray-100">{{ __('Details') }}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</x-app-layout>
|
</x-app-layout>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<nav x-data="{ open: false }" class="bg-white dark:bg-gray-900 border-b border-gray-100 dark:border-gray-700">
|
<nav x-data="{ open: false }" class="bg-white dark:bg-gray-950 border-b border-gray-100 dark:border-gray-800">
|
||||||
{{-- Primary Navigation Menu --}}
|
{{-- Primary Navigation Menu --}}
|
||||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
<div class="flex justify-between h-16">
|
<div class="flex justify-between h-16">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user