Enhance import functionality for recipes with image upload and URL support

- Added support for importing recipes via image upload or URL input in the ImportManager.
- Implemented toggle functionality to switch between upload and URL modes, updating the UI accordingly.
- Enhanced error handling for missing fields and invalid URLs during the import process.
- Updated the RecipeRoutes to analyze images from both uploaded files and URLs, returning appropriate metadata.
- Improved the import modal UI to accommodate new input methods and provide clearer user feedback.
This commit is contained in:
Will Miao
2025-03-19 05:13:44 +08:00
parent 8a871ae643
commit 7c56825f9b
7 changed files with 482 additions and 54 deletions

View File

@@ -4,6 +4,47 @@
transition: none !important; /* Disable any transitions that might affect display */
}
/* Import Mode Toggle */
.import-mode-toggle {
display: flex;
margin-bottom: var(--space-3);
border-radius: var(--border-radius-sm);
overflow: hidden;
border: 1px solid var(--border-color);
}
.toggle-btn {
flex: 1;
padding: 10px 16px;
background: var(--bg-color);
color: var(--text-color);
border: none;
cursor: pointer;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
transition: background-color 0.2s, color 0.2s;
}
.toggle-btn:first-child {
border-right: 1px solid var(--border-color);
}
.toggle-btn.active {
background: var(--lora-accent);
color: var(--lora-text);
}
.toggle-btn:hover:not(.active) {
background: var(--lora-surface);
}
.import-section {
margin-bottom: var(--space-3);
}
/* File Input Styles */
.file-input-wrapper {
position: relative;
@@ -364,6 +405,14 @@
color: var(--text-color);
}
.input-group button {
background: var(--lora-accent);
color: var(--lora-text);
border: none;
padding: 8px 16px;
border-radius: var(--border-radius-xs);
}
.error-message {
color: var(--lora-error);
font-size: 0.9em;