6.19.0: Унификация кнопок сохранения в формах
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m18s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m18s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "play-life-web",
|
"name": "play-life-web",
|
||||||
"version": "6.18.17",
|
"version": "6.19.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -1445,6 +1445,7 @@ function AppContent() {
|
|||||||
boardId={tabParams.boardId}
|
boardId={tabParams.boardId}
|
||||||
previousTab={previousTab}
|
previousTab={previousTab}
|
||||||
onSaved={() => setShoppingRefreshTrigger(prev => prev + 1)}
|
onSaved={() => setShoppingRefreshTrigger(prev => prev + 1)}
|
||||||
|
isActive={activeTab === 'shopping-item-form'}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1061,19 +1061,38 @@ function ProjectPriorityManager({ allProjectsData, currentWeekData, shouldLoad,
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className={onClose
|
<div style={{
|
||||||
? 'sticky bottom-0 pt-2 pb-4 mt-2'
|
position: 'sticky',
|
||||||
: 'fixed bottom-0 left-0 right-0 bg-gray-100 px-4 pt-2 pb-4'
|
bottom: 0,
|
||||||
}>
|
left: 0,
|
||||||
<div className="max-w-2xl mx-auto">
|
right: 0,
|
||||||
<button
|
padding: '0.75rem 0',
|
||||||
onClick={handleSave}
|
paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))',
|
||||||
disabled={isSaving}
|
background: 'linear-gradient(to top, white 60%, rgba(255,255,255,0))',
|
||||||
className="w-full py-3 bg-indigo-600 hover:bg-indigo-700 disabled:bg-indigo-400 text-white font-semibold rounded-lg shadow transition-all"
|
display: 'flex',
|
||||||
>
|
justifyContent: 'center',
|
||||||
{isSaving ? 'Сохранение...' : 'Сохранить'}
|
}}>
|
||||||
</button>
|
<button
|
||||||
</div>
|
onClick={handleSave}
|
||||||
|
disabled={isSaving}
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
maxWidth: '42rem',
|
||||||
|
padding: '0.875rem',
|
||||||
|
background: isSaving ? undefined : 'linear-gradient(to right, #10b981, #059669)',
|
||||||
|
backgroundColor: isSaving ? '#9ca3af' : undefined,
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '0.5rem',
|
||||||
|
fontSize: '1rem',
|
||||||
|
fontWeight: 600,
|
||||||
|
cursor: isSaving ? 'not-allowed' : 'pointer',
|
||||||
|
opacity: isSaving ? 0.6 : 1,
|
||||||
|
transition: 'all 0.2s',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isSaving ? 'Сохранение...' : 'Сохранить'}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{toastMessage && (
|
{toastMessage && (
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
padding-bottom: 5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shopping-item-form h2 {
|
.shopping-item-form h2 {
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
|
import { createPortal } from 'react-dom'
|
||||||
import { useAuth } from './auth/AuthContext'
|
import { useAuth } from './auth/AuthContext'
|
||||||
import Toast from './Toast'
|
import Toast from './Toast'
|
||||||
import SubmitButton from './SubmitButton'
|
import SubmitButton from './SubmitButton'
|
||||||
import DeleteButton from './DeleteButton'
|
import DeleteButton from './DeleteButton'
|
||||||
import './ShoppingItemForm.css'
|
import './ShoppingItemForm.css'
|
||||||
|
|
||||||
function ShoppingItemForm({ onNavigate, itemId, boardId, previousTab, onSaved }) {
|
function ShoppingItemForm({ onNavigate, itemId, boardId, previousTab, onSaved, isActive }) {
|
||||||
const { authFetch } = useAuth()
|
const { authFetch } = useAuth()
|
||||||
const [name, setName] = useState('')
|
const [name, setName] = useState('')
|
||||||
const [description, setDescription] = useState('')
|
const [description, setDescription] = useState('')
|
||||||
@@ -183,6 +184,7 @@ function ShoppingItemForm({ onNavigate, itemId, boardId, previousTab, onSaved })
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<div className="shopping-item-form">
|
<div className="shopping-item-form">
|
||||||
<button className="close-x-button" onClick={handleClose}>
|
<button className="close-x-button" onClick={handleClose}>
|
||||||
✕
|
✕
|
||||||
@@ -277,23 +279,6 @@ function ShoppingItemForm({ onNavigate, itemId, boardId, previousTab, onSaved })
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-actions">
|
|
||||||
<SubmitButton
|
|
||||||
onClick={handleSave}
|
|
||||||
loading={loading}
|
|
||||||
disabled={!name.trim() || !hasValidPeriod}
|
|
||||||
>
|
|
||||||
Сохранить
|
|
||||||
</SubmitButton>
|
|
||||||
{isEdit && (
|
|
||||||
<DeleteButton
|
|
||||||
onClick={handleDelete}
|
|
||||||
loading={isDeleting}
|
|
||||||
disabled={loading}
|
|
||||||
title="Удалить товар"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{toastMessage && (
|
{toastMessage && (
|
||||||
@@ -304,6 +289,53 @@ function ShoppingItemForm({ onNavigate, itemId, boardId, previousTab, onSaved })
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
{isActive ? createPortal(
|
||||||
|
<div style={{
|
||||||
|
position: 'fixed',
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
padding: '0.75rem 1rem',
|
||||||
|
paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))',
|
||||||
|
background: 'linear-gradient(to top, white 60%, rgba(255,255,255,0))',
|
||||||
|
zIndex: 1500,
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
gap: '0.75rem',
|
||||||
|
}}>
|
||||||
|
<button
|
||||||
|
onClick={handleSave}
|
||||||
|
disabled={loading || isDeleting || !name.trim() || !hasValidPeriod}
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
maxWidth: '42rem',
|
||||||
|
padding: '0.875rem',
|
||||||
|
background: loading ? undefined : 'linear-gradient(to right, #10b981, #059669)',
|
||||||
|
backgroundColor: loading ? '#9ca3af' : undefined,
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '0.5rem',
|
||||||
|
fontSize: '1rem',
|
||||||
|
fontWeight: 600,
|
||||||
|
cursor: (loading || isDeleting) ? 'not-allowed' : 'pointer',
|
||||||
|
opacity: loading ? 0.6 : 1,
|
||||||
|
transition: 'all 0.2s',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{loading ? 'Сохранение...' : 'Сохранить'}
|
||||||
|
</button>
|
||||||
|
{isEdit && (
|
||||||
|
<DeleteButton
|
||||||
|
onClick={handleDelete}
|
||||||
|
loading={isDeleting}
|
||||||
|
disabled={loading}
|
||||||
|
title="Удалить товар"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>,
|
||||||
|
document.body
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-bottom: 5.5rem;
|
padding-bottom: 5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-x-button {
|
.close-x-button {
|
||||||
|
|||||||
@@ -1412,23 +1412,36 @@ function TaskForm({ onNavigate, taskId, wishlistId, returnTo, returnWishlistId,
|
|||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
padding: '1.5rem 1rem 0.75rem',
|
padding: '0.75rem 1rem',
|
||||||
paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))',
|
paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))',
|
||||||
background: 'linear-gradient(to top, white 70%, rgba(255,255,255,0))',
|
background: 'linear-gradient(to top, white 60%, rgba(255,255,255,0))',
|
||||||
zIndex: 1500,
|
zIndex: 1500,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
gap: '0.75rem',
|
gap: '0.75rem',
|
||||||
}}>
|
}}>
|
||||||
<SubmitButton
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
form="task-form-element"
|
form="task-form-element"
|
||||||
loading={loading}
|
disabled={loading || isDeleting}
|
||||||
disabled={isDeleting}
|
style={{
|
||||||
style={{ flex: 1, maxWidth: '42rem' }}
|
flex: 1,
|
||||||
|
maxWidth: '42rem',
|
||||||
|
padding: '0.875rem',
|
||||||
|
background: loading ? undefined : 'linear-gradient(to right, #10b981, #059669)',
|
||||||
|
backgroundColor: loading ? '#9ca3af' : undefined,
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '0.5rem',
|
||||||
|
fontSize: '1rem',
|
||||||
|
fontWeight: 600,
|
||||||
|
cursor: (loading || isDeleting) ? 'not-allowed' : 'pointer',
|
||||||
|
opacity: loading ? 0.6 : 1,
|
||||||
|
transition: 'all 0.2s',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Сохранить
|
{loading ? 'Сохранение...' : 'Сохранить'}
|
||||||
</SubmitButton>
|
</button>
|
||||||
{taskId && (
|
{taskId && (
|
||||||
<DeleteButton
|
<DeleteButton
|
||||||
onClick={handleDelete}
|
onClick={handleDelete}
|
||||||
|
|||||||
Reference in New Issue
Block a user