* Add next suggestions and remove console logs * Add pomodoro timer * Add pomodoro switch in settings * Fix pomodoro setting * Add timezones to settings * Fix an issue with password reset * Cleanup * Sort tags alphabetically * Clean up today's view * Add an indicator for repeatedly added to today * Refactor tags * Add due date today item * Move recurrence to the subtitle area * Fix today layout * Add a badge to Inbox items * Move inbox badge to sidebar * Add quotes and progress bar * Add translations for quotes * Fix test issues * Add helper script for docker local * Set up overdue tasks * Add linux/arm/v7 build to deploy script * Add linux/arm/v7 build to deploy script pt2 * Fix an issue with helmet and SSL * Add volume db persistence * Fix cog icon issues
46 lines
No EOL
1.4 KiB
TypeScript
46 lines
No EOL
1.4 KiB
TypeScript
import React from 'react';
|
|
import { RecurrenceType } from '../../entities/Task';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { ArrowPathIcon } from '@heroicons/react/24/outline';
|
|
|
|
interface TaskRecurrenceBadgeProps {
|
|
recurrenceType: RecurrenceType;
|
|
}
|
|
|
|
const TaskRecurrenceBadge: React.FC<TaskRecurrenceBadgeProps> = ({ recurrenceType }) => {
|
|
const { t } = useTranslation();
|
|
|
|
if (!recurrenceType || recurrenceType === 'none') {
|
|
return null;
|
|
}
|
|
|
|
const getRecurrenceIcon = () => {
|
|
return <ArrowPathIcon className="w-3 h-3 mr-1" />;
|
|
};
|
|
|
|
const getRecurrenceLabel = (type: RecurrenceType) => {
|
|
switch (type) {
|
|
case 'daily':
|
|
return t('recurrence.daily', 'DAILY');
|
|
case 'weekly':
|
|
return t('recurrence.weekly', 'WEEKLY');
|
|
case 'monthly':
|
|
return t('recurrence.monthly', 'MONTHLY');
|
|
case 'monthly_weekday':
|
|
return t('recurrence.monthlyWeekday', 'MONTHLY');
|
|
case 'monthly_last_day':
|
|
return t('recurrence.monthlyLastDay', 'MONTHLY');
|
|
default:
|
|
return t('recurrence.recurring', 'RECURRING');
|
|
}
|
|
};
|
|
|
|
return (
|
|
<span className="inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-purple-100 text-purple-800 dark:bg-purple-800 dark:text-purple-100">
|
|
{getRecurrenceIcon()}
|
|
{getRecurrenceLabel(recurrenceType)}
|
|
</span>
|
|
);
|
|
};
|
|
|
|
export default TaskRecurrenceBadge; |