6.14.0: Еженедельное подтверждение приоритетов
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m19s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m19s
This commit is contained in:
@@ -134,6 +134,10 @@ function AppContent() {
|
||||
// Ref для функции открытия модала добавления записи в CurrentWeek
|
||||
const currentWeekAddModalRef = useRef(null)
|
||||
|
||||
// Подтверждение приоритетов на текущей неделе (null = неизвестно, true/false = известно)
|
||||
const [prioritiesConfirmed, setPrioritiesConfirmed] = useState(null)
|
||||
const prioritiesOverlayPushedRef = useRef(false)
|
||||
|
||||
// Кеширование данных
|
||||
const [currentWeekData, setCurrentWeekData] = useState(null)
|
||||
const [fullStatisticsData, setFullStatisticsData] = useState(null)
|
||||
@@ -173,7 +177,22 @@ function AppContent() {
|
||||
|
||||
// Восстанавливаем последний выбранный таб после перезагрузки
|
||||
const [isInitialized, setIsInitialized] = useState(false)
|
||||
|
||||
|
||||
// Управление историей для оверлея приоритетов
|
||||
useEffect(() => {
|
||||
const overlayVisible = activeTab === 'current' && prioritiesConfirmed === false
|
||||
if (overlayVisible && !prioritiesOverlayPushedRef.current) {
|
||||
prioritiesOverlayPushedRef.current = true
|
||||
// Заменяем текущую запись { tab: 'current' } на { tab: 'tasks' },
|
||||
// затем добавляем запись оверлея. Так системная кнопка "Назад" вернёт на tasks.
|
||||
window.history.replaceState({ tab: 'tasks' }, '', '/')
|
||||
window.history.pushState({ tab: 'current', prioritiesOverlay: true }, '', '/')
|
||||
}
|
||||
if (!overlayVisible) {
|
||||
prioritiesOverlayPushedRef.current = false
|
||||
}
|
||||
}, [activeTab, prioritiesConfirmed])
|
||||
|
||||
// Переключение на экран прогрессии после успешной авторизации
|
||||
useEffect(() => {
|
||||
// Обновляем ref только после того, как authLoading стал false
|
||||
@@ -199,6 +218,7 @@ function AppContent() {
|
||||
setFullStatisticsData(null)
|
||||
setTasksData(null)
|
||||
setTodayEntriesData(null)
|
||||
setPrioritiesConfirmed(null)
|
||||
// Сбрасываем инициализацию табов, чтобы данные загрузились заново
|
||||
Object.keys(tabsInitializedRef.current).forEach(key => {
|
||||
tabsInitializedRef.current[key] = false
|
||||
@@ -506,6 +526,9 @@ function AppContent() {
|
||||
const wishes = jsonData?.wishes || []
|
||||
const pendingScoresByProject = jsonData?.pending_scores_by_project && typeof jsonData.pending_scores_by_project === 'object' ? jsonData.pending_scores_by_project : {}
|
||||
|
||||
const rootData = (Array.isArray(jsonData) && jsonData.length > 0) ? jsonData[0] : jsonData
|
||||
const prioritiesConfirmedValue = rootData?.priorities_confirmed ?? null
|
||||
|
||||
setCurrentWeekData({
|
||||
projects: Array.isArray(projects) ? projects : [],
|
||||
total: total,
|
||||
@@ -515,6 +538,10 @@ function AppContent() {
|
||||
wishes: wishes,
|
||||
pending_scores_by_project: pendingScoresByProject
|
||||
})
|
||||
|
||||
if (prioritiesConfirmedValue !== null) {
|
||||
setPrioritiesConfirmed(prioritiesConfirmedValue)
|
||||
}
|
||||
} catch (err) {
|
||||
setCurrentWeekError(err.message)
|
||||
console.error('Ошибка загрузки данных текущей недели:', err)
|
||||
@@ -796,7 +823,7 @@ function AppContent() {
|
||||
}
|
||||
|
||||
const validTabs = ['current', 'priorities', 'full', 'words', 'add-words', 'dictionaries', 'test', 'purchase', 'tasks', 'task-form', 'wishlist', 'wishlist-form', 'wishlist-detail', 'profile', 'todoist-integration', 'telegram-integration', 'tracking', 'tracking-access', 'tracking-invite', 'shopping', 'shopping-item-form', 'shopping-board-form', 'shopping-board-join', 'shopping-item-history']
|
||||
|
||||
|
||||
// Проверяем state текущей записи истории (куда мы вернулись)
|
||||
if (event.state && event.state.tab) {
|
||||
const { tab, params = {} } = event.state
|
||||
@@ -1123,6 +1150,8 @@ function AppContent() {
|
||||
let paddingClasses = ''
|
||||
if (tabName === 'current' || tabName === 'tasks' || tabName === 'wishlist' || tabName === 'profile') {
|
||||
paddingClasses = 'pb-20'
|
||||
} else if (tabName === 'priorities') {
|
||||
paddingClasses = 'pb-20'
|
||||
} else if (tabName === 'words' || tabName === 'dictionaries' || tabName === 'shopping') {
|
||||
paddingClasses = 'pb-16'
|
||||
}
|
||||
@@ -1171,7 +1200,7 @@ function AppContent() {
|
||||
{loadedTabs.priorities && (
|
||||
<div className={getTabContainerClasses('priorities')}>
|
||||
<div className={getInnerContainerClasses('priorities')}>
|
||||
<ProjectPriorityManager
|
||||
<ProjectPriorityManager
|
||||
allProjectsData={fullStatisticsData}
|
||||
currentWeekData={currentWeekData}
|
||||
shouldLoad={activeTab === 'priorities' && loadedTabs.priorities}
|
||||
@@ -1179,6 +1208,12 @@ function AppContent() {
|
||||
onErrorChange={setPrioritiesError}
|
||||
refreshTrigger={prioritiesRefreshTrigger}
|
||||
onNavigate={handleNavigate}
|
||||
onConfirmed={async () => {
|
||||
await fetchCurrentWeekData(false)
|
||||
setPrioritiesConfirmed(true)
|
||||
markTabAsLoaded('current')
|
||||
setActiveTab('current')
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1742,6 +1777,31 @@ function AppContent() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Оверлей подтверждения приоритетов — показывается поверх экрана прогресса недели */}
|
||||
{activeTab === 'current' && prioritiesConfirmed === false && (
|
||||
<div className="fixed inset-0 bg-white z-50 overflow-y-auto">
|
||||
<div className="max-w-2xl mx-auto px-4 h-full">
|
||||
<ProjectPriorityManager
|
||||
allProjectsData={fullStatisticsData}
|
||||
currentWeekData={currentWeekData}
|
||||
shouldLoad={true}
|
||||
onLoadingChange={setPrioritiesLoading}
|
||||
onErrorChange={setPrioritiesError}
|
||||
refreshTrigger={Math.max(prioritiesRefreshTrigger, 1)}
|
||||
onNavigate={handleNavigate}
|
||||
onConfirmed={async () => {
|
||||
await fetchCurrentWeekData(false)
|
||||
setPrioritiesConfirmed(true)
|
||||
}}
|
||||
onClose={() => {
|
||||
// history.back() переходит к { tab: 'tasks' }, popstate обработает переключение
|
||||
window.history.back()
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user