-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/file upload analysis #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for crowncode-by-rthur ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds file upload functionality to the AI Music Detection page, allowing users to upload audio files directly for analysis in addition to the existing YouTube URL analysis. The implementation includes comprehensive file validation, drag-and-drop support, and updated localization for both English and Turkish.
- Introduces a new file analysis hook with validation for file size, type, and naming
- Refactors existing analysis types into shared modules for code reuse
- Adds a dual-input interface supporting both YouTube URLs and local file uploads
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 27 comments.
Show a summary per file
| File | Description |
|---|---|
platform/hooks/analysisTypes.ts |
New shared type definitions for analysis results supporting both YouTube and file sources |
platform/hooks/analysisUtils.ts |
Extracted common utility functions for seed generation and feature score calculation |
platform/hooks/useFileAnalysis.ts |
New hook implementing file upload validation and preview analysis workflow |
platform/hooks/useYouTubeAnalysis.ts |
Refactored to use shared types and utilities from new modules |
platform/pages/ai-music-detection/index.tsx |
Integrated file upload UI with drag-and-drop, dual-source state management, and conditional rendering |
platform/styles/pages/ai-detection.module.css |
Added styles for upload dropzone, source chips, and file display components |
platform/locales/en.json |
Added English translations for file upload UI and error messages |
platform/locales/tr.json |
Added Turkish translations for file upload UI and error messages |
Comments suppressed due to low confidence (2)
platform/locales/tr.json:178
- Turkish spelling error: "Baglantiyi Isle" should be "Bağlantıyı İşle" (with proper Turkish "ğ" with breve, accented "ı", and capital "İ" with dot). The capitalized Turkish "I" should be written as "İ" with a dot.
"analyzeButton": "Baglantiyi Isle",
platform/locales/tr.json:179
- Turkish spelling error: "Isleniyor" should be "İşleniyor" (with proper capital "İ" with dot and "ş" with cedilla).
"analyzing": "Isleniyor..."
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "unsupportedFileType": "Desteklenmeyen dosya formati. MP3, WAV, FLAC, M4A kullanin.", | ||
| "fileTooLarge": "Dosya boyutu 100MB sinirini asiyor. Daha kucuk dosya secin.", | ||
| "fileTooSmall": "Dosya cok kucuk. Minimum boyut 1KB.", | ||
| "invalidFileName": "Gecersiz dosya adi. Dosyayi yeniden adlandirin." |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turkish spelling error: "Gecersiz dosya adi. Dosyayi" should be "Geçersiz dosya adı. Dosyayı" (with proper Turkish "ç" with cedilla, accented "ı", and accented "ı" at the end of "Dosyayı").
| "invalidFileName": "Gecersiz dosya adi. Dosyayi yeniden adlandirin." | |
| "invalidFileName": "Geçersiz dosya adı. Dosyayı yeniden adlandırın." |
|
|
||
| setError(null) | ||
| setProcessingState('validating') | ||
| startTimeRef.current = Date.now() | ||
|
|
||
| setProcessingState('downloading') |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The processing state transitions on lines 164-165 occur synchronously without any delays or async operations between them. This means the intermediate states 'downloading' and 'analyzing' will not be visible to the user since React will batch these state updates. The UI will likely jump directly from 'validating' to 'complete', skipping the visual feedback for 'downloading' and 'analyzing' states.
Consider adding delays between state transitions to provide visual feedback, or move these state changes into a proper async workflow with actual operations between each state.
| setError(null) | |
| setProcessingState('validating') | |
| startTimeRef.current = Date.now() | |
| setProcessingState('downloading') | |
| // Clear previous error and start validation phase | |
| setError(null) | |
| setProcessingState('validating') | |
| startTimeRef.current = Date.now() | |
| // Ensure intermediate states are visible by spacing transitions asynchronously | |
| const delay = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms)) | |
| await delay(150) | |
| setProcessingState('downloading') | |
| await delay(150) |
| className={`${styles['upload-dropzone']} ${isDragOver ? styles['drag-over'] : ''}`} | ||
| onDrop={handleDrop} | ||
| onDragOver={handleDragOver} | ||
| onDragLeave={handleDragLeave} | ||
| onClick={() => fileInputRef.current?.click()} |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dropzone div is clickable but lacks proper keyboard accessibility. Interactive elements should support keyboard navigation with Enter/Space key handlers. Users who rely on keyboard navigation won't be able to activate the file picker without using a mouse.
Add role="button", tabIndex={0}, and an onKeyDown handler that triggers the file input click on Enter or Space key press.
| className={`${styles['upload-dropzone']} ${isDragOver ? styles['drag-over'] : ''}`} | |
| onDrop={handleDrop} | |
| onDragOver={handleDragOver} | |
| onDragLeave={handleDragLeave} | |
| onClick={() => fileInputRef.current?.click()} | |
| className={`${styles['upload-dropzone']} ${isDragOver ? styles['drag-over'] : ''}`} | |
| role="button" | |
| tabIndex={0} | |
| onDrop={handleDrop} | |
| onDragOver={handleDragOver} | |
| onDragLeave={handleDragLeave} | |
| onClick={() => fileInputRef.current?.click()} | |
| onKeyDown={(e) => { | |
| if (e.key === 'Enter' || e.key === ' ') { | |
| e.preventDefault(); | |
| fileInputRef.current?.click(); | |
| } | |
| }} |
| "dropHere": "Ses dosyanizi buraya birakin", | ||
| "orClick": "veya tiklayip secin", | ||
| "supported": "Desteklenen: MP3, WAV, FLAC, M4A (maks 100MB)", | ||
| "analyzeButton": "Dosyayi Analiz Et", |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turkish spelling error: "Dosyayi" should be "Dosyayı" (with proper Turkish dotted "i" at the end).
| "analyzeButton": "Dosyayi Analiz Et", | |
| "analyzeButton": "Dosyayı Analiz Et", |
| }, | ||
| "url": { | ||
| "title": "YouTube Baglantisini Analiz Et", | ||
| "placeholder": "YouTube linki yapistirin (youtube.com veya youtu.be)...", |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turkish spelling error: "yapistirin" should be "yapıştırın" (with proper Turkish undotted "ı", "ş" with cedilla, and accented "ı").
| "placeholder": "YouTube linki yapistirin (youtube.com veya youtu.be)...", | |
| "placeholder": "YouTube linki yapıştırın (youtube.com veya youtu.be)...", |
| "videoId": "Video ID", | ||
| "normalizedUrl": "Normalize URL" | ||
| "normalizedUrl": "Normalize URL", | ||
| "fileName": "Dosya Adi", |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turkish spelling error: "Adi" should be "Adı" (with proper Turkish accented "ı").
| "normalizedUrl": "Normalize URL", | ||
| "fileName": "Dosya Adi", | ||
| "fileSize": "Dosya Boyutu", | ||
| "fileFormat": "Dosya Formati" |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turkish spelling error: "Formati" should be "Formatı" (with proper Turkish accented "ı").
| "download": "Ses alma", | ||
| "musicAi": "Music-AIDetector cikarim", | ||
| "sesAnalizi": "Ses-Analizi raporu", | ||
| "preview": "Onizleme yedegi" |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turkish spelling error: "Onizleme yedegi" should be "Önizleme yedeği" (with proper Turkish "Ö" with umlaut and "ğ" with breve, plus accented "i" at the end).
| "sources": { | ||
| "youtube": "YouTube", | ||
| "upload": "Dosya yukleme (yakinda)", | ||
| "upload": "Dosya yukleme", |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turkish spelling error: "yukleme" should be "yükleme" (with proper Turkish "ü" with umlaut).
| "processing": { | ||
| "title": "Analiz Devam Ediyor...", | ||
| "subtitle": "Baglanti dogrulaniyor ve analiz akisi hazirlaniyor.", | ||
| "subtitle": "Kaynak dogrulaniyor ve analiz akisi hazirlaniyor.", |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turkish spelling error: "dogrulaniyor" should be "doğrulanıyor" (with proper Turkish "ğ" with breve and accented "ı").

[Copilot is generating a summary...]