Spaces:
Sleeping
Sleeping
update home view
Browse files6 unmodified lines78910111211 unmodified lines242526272829107 unmodified lines137138139140141142196 unmodified lines339340341342343344345346256 unmodified lines603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667474 unmodified lines11421143114411451146114724 unmodified lines117211731174117511761177117811791180118111821183118447 unmodified lines12321233123412351236123712386 unmodified linesimport CalibrationArea from '@/components/CalibrationArea.vue'import FootballField from '@/components/FootballField.vue'import PlotlyChart from '@/components/PlotlyChart.vue'const router = useRouter()const calibrationStore = useCalibrationStore()11 unmodified lines// États locauxconst dragActive = ref(false)// États pour la vue manuelleconst thumbnail = ref(null)107 unmodified linescalibrationStore.setMode(mode)}const resetToStart = () => {// Réinitialiser tous les storescalibrationStore.reset()196 unmodified lines}const exportResults = () => {const data = calibrationStore.resultsconst filename = 'football_vision_results.json'const content = JSON.stringify(data, null, 2)256 unmodified lines</div></section><!-- Section 2: Upload de fichier --><section v-if="showUpload" ref="uploadSection" class="section upload-section"><divclass="drop-zone":class="{active: dragActive,'has-file': uploadStore.isFileSelected,'processing': uploadStore.isUploading}"@drop="handleDrop"@dragover="handleDragOver"@dragleave="handleDragLeave"><div v-if="!uploadStore.isFileSelected" class="drop-content"><div class="upload-icon">+</div><h3>Glissez-déposez votre fichier ici</h3><p class="or-text">ou</p><label class="file-input-label"><inputtype="file"accept="image/*,video/*"@change="handleFileSelect"hidden>Choisir un fichier</label><p class="format-info">Images: JPG, PNG | Vidéos: MP4, AVI, MOV</p></div><div v-else class="file-preview"><div class="file-info"><h3>Fichier sélectionné</h3><p class="file-name">{{ uploadStore.selectedFile.name }}</p><p class="file-details"><span>Type: {{ uploadStore.fileType === 'image' ? 'Image' : 'Vidéo' }}</span><span>Taille: {{ Math.round(uploadStore.selectedFile.size / 1024) }} KB</span></p></div><div class="preview" v-if="uploadStore.filePreview"><imgv-if="uploadStore.isImage":src="uploadStore.filePreview"alt="Preview"class="preview-media"><videov-else:src="uploadStore.filePreview"controlsclass="preview-media"></video></div><button @click="uploadStore.clearFile()" class="btn-secondary">Changer de fichier</button></div></div></section>474 unmodified linesfont-weight: 600;}.drop-zone {border: 3px dashed #555;border-radius: 12px;24 unmodified linesfont-weight: 300;}.drop-content h3 {font-size: 1.25rem;color: white;margin-bottom: 1rem;font-weight: 600;}.or-text {color: #888;margin: 1.5rem 0;47 unmodified linestext-align: center;}.file-info h3 {color: var(--color-primary);margin-bottom: 1.5rem;font-weight: 600;6 unmodified lines7891011121311 unmodified lines25262728293031323334353637383940107 unmodified lines148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182196 unmodified lines379380381382383384385386387388389390391392393394395396397256 unmodified lines654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739474 unmodified lines12141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124924 unmodified lines12741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138447 unmodified lines14321433143414351436143714386 unmodified linesimport CalibrationArea from '@/components/CalibrationArea.vue'import FootballField from '@/components/FootballField.vue'import PlotlyChart from '@/components/PlotlyChart.vue'import fieldTestImage from '@/assets/field_test_thumb.jpg'const router = useRouter()const calibrationStore = useCalibrationStore()11 unmodified lines// États locauxconst dragActive = ref(false)const selectedTestImage = ref(null)// Image de testconst testImage = ref({id: 'field1',name: 'Terrain de test',description: 'Image d\'exemple pour tester l\'analyse',thumbnail: fieldTestImage,fullUrl: fieldTestImage})// États pour la vue manuelleconst thumbnail = ref(null)107 unmodified linescalibrationStore.setMode(mode)}const selectTestImage = async (testImage) => {try {selectedTestImage.value = testImage.id// Créer un objet File à partir de l'URL de l'image de testconst response = await fetch(testImage.fullUrl)const blob = await response.blob()const file = new File([blob], `${testImage.name}.jpg`, { type: 'image/jpeg' })uploadStore.setFile(file)if (calibrationStore.isManualMode) {// En mode manuel avec image, charger la vue manuelle intégréeawait loadThumbnail()await nextTick()scrollToSection(manualSection.value)} else if (calibrationStore.isAutoMode) {// En mode auto, lancement automatique pour les imagesstartProcessing()}} catch (error) {console.error('Erreur lors du chargement de l\'image de test:', error)// Fallback: utiliser l'URL directement pour la previewuploadStore.filePreview = testImage.fullUrluploadStore.selectedFile = { name: `${testImage.name}.jpg`, size: 0 }uploadStore.fileType = 'image'}}const resetToStart = () => {// Réinitialiser tous les storescalibrationStore.reset()196 unmodified lines}const exportResults = () => {// Encapsuler les données de calibration dans une clé "calibration"const data = {calibration: calibrationStore.results}// Générer le nom de fichier basé sur le fichier originallet filename = 'football_vision_config.json'if (uploadStore.selectedFile && uploadStore.selectedFile.name) {// Enlever l'extension du fichier original et ajouter .jsonconst originalName = uploadStore.selectedFile.nameconst nameWithoutExtension = originalName.substring(0, originalName.lastIndexOf('.')) || originalNamefilename = `${nameWithoutExtension}_config.json`}const content = JSON.stringify(data, null, 2)256 unmodified lines</div></section><!-- Section 2: Upload de fichier --><section v-if="showUpload" ref="uploadSection" class="section upload-section"><div class="upload-grid"><!-- Côté gauche: Upload de fichier --><div class="upload-left"><divclass="drop-zone":class="{active: dragActive,'has-file': uploadStore.isFileSelected,'processing': uploadStore.isUploading}"@drop="handleDrop"@dragover="handleDragOver"@dragleave="handleDragLeave"><div v-if="!uploadStore.isFileSelected" class="drop-content"><div class="upload-icon">+</div><h4>Glissez-déposez votre fichier ici</h4><p class="or-text">ou</p><label class="file-input-label"><inputtype="file"accept="image/*,video/*"@change="handleFileSelect"hidden>Choisir un fichier</label></div><div v-else class="file-preview"><div class="file-info"><h4>Fichier sélectionné</h4><p class="file-name">{{ uploadStore.selectedFile.name }}</p><p class="file-details"><span>Type: {{ uploadStore.fileType === 'image' ? 'Image' : 'Vidéo' }}</span><span>Taille: {{ Math.round(uploadStore.selectedFile.size / 1024) }} KB</span></p></div><div class="preview" v-if="uploadStore.filePreview"><imgv-if="uploadStore.isImage":src="uploadStore.filePreview"alt="Preview"class="preview-media"><videov-else:src="uploadStore.filePreview"controlsclass="preview-media"></video></div><button @click="uploadStore.clearFile()" class="btn-secondary">Changer de fichier</button></div></div></div><!-- Côté droit: Images de test --><div class="upload-right"><div class="test-image-container"><divclass="test-image-card single"@click="selectTestImage(testImage)":class="{ selected: selectedTestImage === testImage.id }"><img :src="testImage.thumbnail" :alt="testImage.name" class="test-image-thumb"><div class="test-image-overlay"><div class="overlay-content"><p>Vue Drone</p></div></div></div></div></div></div></section>474 unmodified linesfont-weight: 600;}/* Grid Upload */.upload-grid {display: grid;grid-template-columns: 1fr 1fr;gap: 3rem;width: 100%;max-width: 1200px;align-items: start;padding: 2rem;}.upload-left, .upload-right {display: flex;flex-direction: column;height: 100%;}.upload-right {justify-content: center;align-items: center;}.upload-title {font-size: 1.25rem;font-weight: 600;color: white;margin-bottom: 2rem;text-align: center;}.drop-zone {border: 3px dashed #555;border-radius: 12px;24 unmodified linesfont-weight: 300;}.drop-content h4 {font-size: 1.25rem;color: white;margin-bottom: 1rem;font-weight: 600;}/* Image de test */.test-image-container {display: flex;flex-direction: column;align-items: center;justify-content: center;width: 100%;height: 100%;}.test-image-card.single {background: var(--color-secondary-soft);border-radius: 12px;overflow: hidden;cursor: pointer;transition: all 0.3s ease;border: 2px solid transparent;position: relative;width: 100%;height: 100%;display: flex;}.test-image-card:hover {transform: translateY(-4px);box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);border-color: rgba(255, 255, 255, 0.2);}.test-image-card.selected {border-color: var(--color-primary);box-shadow: 0 4px 20px rgba(217, 255, 4, 0.3);}.test-image-card.selected::after {content: '✓';position: absolute;top: 8px;right: 8px;background: var(--color-primary);color: var(--color-secondary);width: 24px;height: 24px;border-radius: 50%;display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 0.8rem;}.test-image-thumb {width: 100%;height: 100%;object-fit: cover;display: block;}.test-image-overlay {position: absolute;top: 0;left: 0;right: 0;bottom: 0;background: rgba(0, 0, 0, 0.7);display: flex;align-items: center;justify-content: center;opacity: 1;transition: opacity 0.3s ease;backdrop-filter: blur(2px);}.test-image-card.single:hover .test-image-overlay {opacity: 0;}.overlay-content {text-align: center;color: white;}.overlay-content h4 {font-size: 1.25rem;font-weight: 600;margin: 0 0 0.5rem 0;color: var(--color-primary);}.overlay-content p {font-size: 0.9rem;margin: 0;color: #e0e0e0;font-weight: 500;}.or-text {color: #888;margin: 1.5rem 0;47 unmodified linestext-align: center;}.file-info h4 {color: var(--color-primary);margin-bottom: 1.5rem;font-weight: 600;
src/views/HomeView.vue+258-58