Migration complete

This commit is contained in:
2026-06-23 19:24:38 +02:00
parent 279160c1cb
commit 64b26ef059
126 changed files with 8121 additions and 221 deletions

View File

@@ -0,0 +1,47 @@
import { calculate as calculateHashes } from "./hashes.js";
window.HashesChecker = function( wire ) {
return {
/**
* Wire variable instance.
*/
$wire: wire,
/**
* If a file hash is currently calculated or not.
* @type {boolean}
*/
isCalculating: false,
/**
* An error on hash calculation.
* @type {any|null}
*/
error: null,
async handleSubmitFile(e){
if( this.isCalculating === true ) // Calculation already done for another file.
return;
this.error = null; // Reset.
const FILE = e.target.files[0];
if( !FILE )
return; // No file sent.
this.isCalculating = true;
try {
const RESULT = await calculateHashes(FILE);
await this.$wire.addHash(RESULT.filename, RESULT.crc32, RESULT.sha1); // Send a signal to livewire.
window.refreshIcons();
} catch(err) {
this.error = err.message;
} finally {
this.isCalculating = false;
}
}
}
}

View File

@@ -7,6 +7,7 @@ import hovercard from "./hovercard.js";
import notifications from "./notifications.js";
import conversations from "./conversations.js";
import settings from "./settings.js";
import { initMobileMenu } from "./mobile-menu.js";
/**
* Get config defined in meta.blade.php
@@ -43,3 +44,6 @@ Alpine.store('conversations', conversations() );
// Settings
Alpine.store('settings', settings() );
// Mobile Menu
document.addEventListener('DOMContentLoaded', initMobileMenu);

View File

@@ -0,0 +1,46 @@
export function initMobileMenu() {
const menuToggle = document.querySelector('.mobile-toggle');
const menu = document.getElementById('menu');
const app = document.getElementById('app');
const content = document.getElementById('content');
if (!menuToggle || !menu) return;
menuToggle.addEventListener('click', (e) => {
e.stopPropagation();
menu.classList.toggle('mobile-open');
app.classList.toggle('menu-open');
});
const menuItems = menu.querySelectorAll('.menu-item');
menuItems.forEach(item => {
item.addEventListener('click', () => {
menu.classList.remove('mobile-open');
app.classList.remove('menu-open');
});
});
document.addEventListener('click', (e) => {
const isClickInsideMenu = menu.contains(e.target);
const isClickOnToggle = menuToggle.contains(e.target);
if (!isClickInsideMenu && !isClickOnToggle && menu.classList.contains('mobile-open')) {
menu.classList.remove('mobile-open');
app.classList.remove('menu-open');
}
});
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && menu.classList.contains('mobile-open')) {
menu.classList.remove('mobile-open');
app.classList.remove('menu-open');
}
});
window.addEventListener('resize', () => {
if (window.innerWidth > 768) {
menu.classList.remove('mobile-open');
app.classList.remove('menu-open');
}
});
}

View File

@@ -27,7 +27,7 @@ const ERROR_TABLE = {
noGame: "Please provide a game or create a new one and fill all the required fields.",
noLanguages: "Please select at least a language.",
noAuthors: "Please provide at least an author or create a new one and fill all the required fields.",
noMainImage: "Please select a main image.",
noMainImage: "Please upload a main image.",
noGalleryImages: "Please select at least a gallery image.",
isSubmitting: "The entry is already during submission."
}
@@ -269,75 +269,75 @@ window.Submission = function(){
*/
verifyForm(){
console.log( "Step 1" );
console.info( "Step 1: During File upload" );
if( !SubmissionVerifications.step1_DuringFSUpload( this.Uploader ) ){
this.errorKey = "isUploading";
return false;
}
console.log( "Step 2" );
console.info( "Step 2: No files uploaded" );
if( !SubmissionVerifications.step2_NoFilesFSUpload( this.Uploader ) ){
this.errorKey = "noFiles";
return false;
}
console.log( "Step 3" );
console.info( 'Step 3: Error in file upload')
if( !SubmissionVerifications.step3_ErrorsFSUpload( this.Uploader ) ){
this.errorKey = "uploadError";
return false;
}
console.log( "Step 4" );
console.info("Step 4: All files uploaded");
if( !SubmissionVerifications.step4_AllFilesUploadedFSUpload( this.Uploader ) ){
this.errorKey = "notAllFilesDone";
return false;
}
if( SECTION() === "romhacks" || SECTION() === "lua-scripts" ){
console.log( "Step 5" );
console.info( "Step 5: Verify modifications")
if( !SubmissionVerifications.step5_RomhacksModificationsCheckboxes()){
this.errorKey = "noModifications";
return false;
}
} else if( SECTION() === "utilities" ){
console.log( "Step 5" );
console.info( "Step 5: Verify systems");
if( !SubmissionVerifications.step5_UtilitiesSystemsCheckboxes()){
this.errorKey = "noSystems";
return false;
}
}
console.log( "Step 6" );
console.info( "Step 6: Verify description");
if( !SubmissionVerifications.step6_VerifyDescription() ){
this.errorKey = "noDescription";
return false;
}
console.log( "Step 7" );
console.info( "Step 7: Verify game");
if( !SubmissionVerifications.step7_VerifyGame( this.$el ) ){
this.errorKey = "noGame";
return false;
}
console.log( "Step 8" );
console.info("Step 8: Verify languages");
if( !SubmissionVerifications.step8_LanguagesCheckboxes()){
this.errorKey = "noLanguages";
return false;
}
console.log( "Step 9" );
console.info( "Step 9: Verify authors" );
if( !SubmissionVerifications.step9_verifyAuthors()){
this.errorKey = "noAuthors";
return false;
}
console.log( "Step 10" );
console.info( "Step 10: Verify Main image" );
if( !SubmissionVerifications.step10_verifyMainImage( this.$el )){
this.errorKey = "noMainImage";
return false;
}
console.log( "Step 11" );
console.info( "Step 11: Verify gallery images" );
if( !SubmissionVerifications.step11_verifyGallery( this.$el )){
this.errorKey = "noGalleryImages";
return false;
@@ -367,9 +367,13 @@ window.Submission = function(){
isSubmitting: 'submitButton'
};
const target = this.$refs[refMap[this.errorKey]]
|| this.$el.querySelector('.upload-list')
|| this.$el.querySelector('.form-upload');
const targetKey = refMap[this.errorKey];
const target = this.$refs[targetKey]
|| this.$el.querySelector(`[data-target="${targetKey}"]`)
|| this.$el.querySelector(`[x-ref="${targetKey}"]`)
|| this.$el.querySelector('.upload-list')
|| this.$el.querySelector('.form-upload');
if (target) {
target.scrollIntoView({behavior: 'smooth', block: 'center'});