Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

677 B
Raw Blame
'use client';

import { useCallback } from 'react';
import { useTranslations } from 'next-intl';
import { PRIORITY_ORDER, type Priority } from '@/utils/fieldOptions';

// The label of a priority value, with '' (and null) the explicit "no priority"
// choice. The API types priority as a plain string, so a value outside the fixed
// list is shown as it came instead of rendering a key path.
export function usePriorityLabel() {
  const t = useTranslations('common.priority');
  return useCallback(
    (value: string | null) => {
      if (!value) return t('none');
      return PRIORITY_ORDER.includes(value as Priority) ? t(value as Priority) : value;
    },
    [t],
  );
}