fix: correct token read in upload + remove upload button, keep drop zone
- api.upload.photo used wrong localStorage key ('access_token' vs 'hotelsync-session')
- Removed standalone 'Загрузить фото' button — drop zone handles click+drag
- Added '+' thumbnail button to add more photos when gallery is non-empty
- Show spinner inline during upload instead of disabled button
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -250,6 +250,12 @@ function CategoryForm({ category, onClose, onSave }: CategoryFormProps) {
|
||||
<img src={p} alt="" className="w-full h-full object-cover" />
|
||||
</button>
|
||||
))}
|
||||
<button
|
||||
onClick={() => fileRef.current?.click()}
|
||||
className="w-14 h-14 rounded-lg border-2 border-dashed border-slate-300 dark:border-slate-600 flex items-center justify-center text-slate-400 hover:border-brand-400 hover:text-brand-500 shrink-0 transition-colors"
|
||||
>
|
||||
<Plus size={18} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -271,10 +277,12 @@ function CategoryForm({ category, onClose, onSave }: CategoryFormProps) {
|
||||
</div>
|
||||
)}
|
||||
<input ref={fileRef} type="file" accept="image/*" multiple className="hidden" onChange={handlePhotoUpload} />
|
||||
<button onClick={() => fileRef.current?.click()} className="btn-secondary w-full justify-center" disabled={uploading}>
|
||||
{uploading ? <Loader2 size={14} className="animate-spin" /> : <ImagePlus size={14} />}
|
||||
{uploading ? 'Загрузка...' : 'Загрузить фото'}
|
||||
</button>
|
||||
{uploading && (
|
||||
<div className="flex items-center justify-center gap-2 text-sm text-slate-500 py-1">
|
||||
<Loader2 size={14} className="animate-spin" />
|
||||
Загрузка...
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user