|
|
|
@ -5,21 +5,33 @@ import {
@@ -5,21 +5,33 @@ import {
|
|
|
|
|
ITaskActionPayload, |
|
|
|
|
TaskStatus, |
|
|
|
|
} from '@/shared' |
|
|
|
|
import { getCurrentThemeType } from '@/shared/helpers' |
|
|
|
|
|
|
|
|
|
export const getTaskCardButtons = ( |
|
|
|
|
id: number | string, |
|
|
|
|
date: string, |
|
|
|
|
isTaskFavorite: boolean, |
|
|
|
|
isAccessibleAction: { |
|
|
|
|
canUpdate: boolean |
|
|
|
|
canDestroy: boolean |
|
|
|
|
}, |
|
|
|
|
onPress: (action: FullTaskActions, payload: ITaskActionPayload) => void, |
|
|
|
|
status: TaskStatus, |
|
|
|
|
closeSwipeable, |
|
|
|
|
) => { |
|
|
|
|
const theme = getCurrentThemeType() |
|
|
|
|
|
|
|
|
|
const deleteBtn = { |
|
|
|
|
title: 'Видалити', |
|
|
|
|
bgColor: getTheme().$deleteBtn, |
|
|
|
|
txtColor: getTheme().$deleteText, |
|
|
|
|
bgColor: !isAccessibleAction.canDestroy |
|
|
|
|
? getTheme(theme).$unAccessibleBtn |
|
|
|
|
: getTheme(theme).$deleteBtn, |
|
|
|
|
txtColor: !isAccessibleAction.canDestroy |
|
|
|
|
? getTheme(theme).$unAccessibleTxt |
|
|
|
|
: getTheme(theme).$deleteText, |
|
|
|
|
iconName: 'bin', |
|
|
|
|
onPress: () => { |
|
|
|
|
if (!isAccessibleAction.canDestroy) return |
|
|
|
|
closeSwipeable() |
|
|
|
|
appEvents.emit('openConfirmModal', { |
|
|
|
|
title: 'Видалити задачу?', |
|
|
|
@ -27,15 +39,15 @@ export const getTaskCardButtons = (
@@ -27,15 +39,15 @@ export const getTaskCardButtons = (
|
|
|
|
|
allowBtnAction: () => { |
|
|
|
|
setTimeout(() => onPress(FullTaskActions.Destroy, {}), 300) |
|
|
|
|
}, |
|
|
|
|
notAllowBtnAction: () => { }, |
|
|
|
|
notAllowBtnAction: () => {}, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
const result = [ |
|
|
|
|
{ |
|
|
|
|
title: 'Обрана', |
|
|
|
|
bgColor: getTheme().$pinBtn, |
|
|
|
|
txtColor: getTheme().$pinText, |
|
|
|
|
bgColor: getTheme(theme).$pinBtn, |
|
|
|
|
txtColor: getTheme(theme).$pinText, |
|
|
|
|
iconName: 'vectorstart', |
|
|
|
|
onPress: () => { |
|
|
|
|
closeSwipeable() |
|
|
|
@ -51,7 +63,7 @@ export const getTaskCardButtons = (
@@ -51,7 +63,7 @@ export const getTaskCardButtons = (
|
|
|
|
|
else onPress(FullTaskActions.AddFavorite, {}) |
|
|
|
|
}, 500) |
|
|
|
|
}, |
|
|
|
|
notAllowBtnAction: () => { }, |
|
|
|
|
notAllowBtnAction: () => {}, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -62,10 +74,15 @@ export const getTaskCardButtons = (
@@ -62,10 +74,15 @@ export const getTaskCardButtons = (
|
|
|
|
|
result.unshift(deleteBtn) |
|
|
|
|
result.unshift({ |
|
|
|
|
title: 'Виконати', |
|
|
|
|
bgColor: getTheme().$doneBtn, |
|
|
|
|
txtColor: getTheme().$doneText, |
|
|
|
|
bgColor: !isAccessibleAction.canUpdate |
|
|
|
|
? getTheme(theme).$unAccessibleBtn |
|
|
|
|
: getTheme(theme).$doneBtn, |
|
|
|
|
txtColor: !isAccessibleAction.canUpdate |
|
|
|
|
? getTheme(theme).$unAccessibleTxt |
|
|
|
|
: getTheme(theme).$doneText, |
|
|
|
|
iconName: 'checks-1', |
|
|
|
|
onPress: () => { |
|
|
|
|
if (!isAccessibleAction.canUpdate) return |
|
|
|
|
closeSwipeable() |
|
|
|
|
appEvents.emit('openFinishTasksModal', { |
|
|
|
|
taskIds: [id], |
|
|
|
|