mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 20:20:41 -05:00
Moves Livewire into App JS
Makes it easier to bundle for prod.
This commit is contained in:
parent
169777f957
commit
5aafbe94d1
@ -1,12 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "laravel/laravel",
|
"name": "sp-tarkov/forge",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"description": "The skeleton application for the Laravel framework.",
|
"description": "A Laravel-based web application that provides a platform for the Single Player Tarkov community to share and discover user-generated content, such as mods, guides, and other tools.",
|
||||||
"keywords": [
|
"keywords": [],
|
||||||
"laravel",
|
"license": "MPL-2.0",
|
||||||
"framework"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.3",
|
"php": "^8.3",
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "html",
|
"name": "forge",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
@ -2,12 +2,18 @@ import "./bootstrap";
|
|||||||
|
|
||||||
import.meta.glob(["../video/**"]);
|
import.meta.glob(["../video/**"]);
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
const themeToggleIcon = {
|
const themeToggleIcon = {
|
||||||
dark: document.getElementById("theme-toggle-dark-icon"),
|
dark: document.getElementById("theme-toggle-dark-icon"),
|
||||||
light: document.getElementById("theme-toggle-light-icon"),
|
light: document.getElementById("theme-toggle-light-icon")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make sure the theme toggle icons are available.
|
||||||
|
if (themeToggleIcon.dark === null || themeToggleIcon.light === null) {
|
||||||
|
console.log("Theme toggle icons not found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Function to update the visibility of the theme icons based on the theme
|
// Function to update the visibility of the theme icons based on the theme
|
||||||
function updateIconVisibility(theme) {
|
function updateIconVisibility(theme) {
|
||||||
if (theme === "dark") {
|
if (theme === "dark") {
|
||||||
@ -41,7 +47,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
// Set up the theme toggle button
|
// Set up the theme toggle button
|
||||||
const themeToggleBtn = document.getElementById("theme-toggle");
|
const themeToggleBtn = document.getElementById("theme-toggle");
|
||||||
themeToggleBtn.addEventListener("click", function () {
|
themeToggleBtn.addEventListener("click", function() {
|
||||||
// Determine the current theme by checking the classList of documentElement
|
// Determine the current theme by checking the classList of documentElement
|
||||||
const currentTheme = document.documentElement.classList.contains("dark") ? "dark" : "light";
|
const currentTheme = document.documentElement.classList.contains("dark") ? "dark" : "light";
|
||||||
const newTheme = currentTheme === "light" ? "dark" : "light";
|
const newTheme = currentTheme === "light" ? "dark" : "light";
|
||||||
|
3
resources/js/bootstrap.js
vendored
3
resources/js/bootstrap.js
vendored
@ -1,4 +1,7 @@
|
|||||||
|
import { Livewire } from "../../vendor/livewire/livewire/dist/livewire.esm";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
|
Livewire.start();
|
||||||
|
|
||||||
window.axios = axios;
|
window.axios = axios;
|
||||||
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
|
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
|
||||||
|
@ -56,6 +56,6 @@
|
|||||||
@livewire('global-search')
|
@livewire('global-search')
|
||||||
@stack('modals')
|
@stack('modals')
|
||||||
|
|
||||||
@livewireScripts
|
@livewireScriptConfig
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
<link href="//fonts.bunny.net" rel="preconnect">
|
<link href="//fonts.bunny.net" rel="preconnect">
|
||||||
<link href="//fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet">
|
<link href="//fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
|
<link href="{{ config('app.asset_url') }}" rel="dns-prefetch">
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Immediately set the theme to prevent a flash of the default theme when another is set.
|
// Immediately set the theme to prevent a flash of the default theme when another is set.
|
||||||
// Must be located inline, in the head, and before any CSS is loaded.
|
// Must be located inline, in the head, and before any CSS is loaded.
|
||||||
@ -33,7 +35,6 @@
|
|||||||
{{ $slot }}
|
{{ $slot }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@livewireScripts
|
@livewireScriptConfig
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user