Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

2.0 KB
Raw Blame
'use client';

import type { AcceptanceReviewAnnotation } from '@lobechat/types';
import { cssVar, Flexbox, Icon, Text } from '@lobehub/ui';
import { Flag, Repeat } from 'lucide-react';
import { useTranslation } from 'react-i18next';

import { ClaimLabel } from './ClaimLabel';
import { formatVideoTime } from './videoTime';

/**
 * A submitted reject's notes on one video, read back as text in time order.
 * The frames themselves are one click away on the player above; repeating a
 * still here would show a frame without the motion the note is about.
 */
export const VideoFeedbackNotes = ({ notes }: { notes: AcceptanceReviewAnnotation[] }) => {
  const { t } = useTranslation('verify');

  return (
    <Flexbox gap={4}>
      {[...notes]
        .sort((a, b) => (a.time?.start ?? 0) - (b.time?.start ?? 0))
        .map((note, index) => (
          <Flexbox horizontal align={'baseline'} gap={8} key={index}>
            <Flexbox
              horizontal
              align={'center'}
              gap={4}
              style={{
                color: cssVar.colorErrorText,
                flex: 'none',
                fontFamily: cssVar.fontFamilyCode,
                fontSize: 12,
              }}
            >
              <Icon icon={note.time?.end === undefined ? Flag : Repeat} size={12} />
              {note.time
                ? note.time.end === undefined
                  ? formatVideoTime(note.time.start)
                  : `${formatVideoTime(note.time.start)} – ${formatVideoTime(note.time.end)}`
                : '—'}
            </Flexbox>
            <Flexbox gap={2}>
              {note.disputes?.note && (
                <Text fontSize={12} type={'secondary'}>
                  <ClaimLabel kind={note.disputes.kind} style={{ marginInlineEnd: 6 }} />
                  {note.disputes.note}
                </Text>
              )}
              <Text fontSize={12}>{note.comment || t('acceptance.video.noteEmpty')}</Text>
            </Flexbox>
          </Flexbox>
        ))}
    </Flexbox>
  );
};