0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-16 03:11:54 +00:00
nextcloud_server/apps/files_reminders/src/actions/reminderStatusAction.ts
Andy Scherzinger 8d8891c5bc
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-30 15:49:33 +02:00

45 lines
1.1 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { FileAction, type Node } from '@nextcloud/files'
import { translate as t } from '@nextcloud/l10n'
import AlarmSvg from '@mdi/svg/svg/alarm.svg?raw'
import { pickCustomDate } from '../services/customPicker.ts'
import { getVerboseDateString } from '../shared/utils.ts'
export const action = new FileAction({
id: 'reminder-status',
inline: () => true,
displayName: () => '',
title: (nodes: Node[]) => {
const node = nodes.at(0)!
const dueDate = new Date(node.attributes['reminder-due-date'])
return `${t('files_reminders', 'Reminder set')} ${getVerboseDateString(dueDate)}`
},
iconSvgInline: () => AlarmSvg,
enabled: (nodes: Node[]) => {
// Only allow on a single node
if (nodes.length !== 1) {
return false
}
const node = nodes.at(0)!
const dueDate = node.attributes['reminder-due-date']
return Boolean(dueDate)
},
async exec(node: Node) {
pickCustomDate(node)
return null
},
order: -15,
})