Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

2.4 KB
Raw Blame
import { ChevronDown, Sparkles, type LucideIcon } from 'lucide-react';
import { useLocalizedCopy } from '../../i18n/useLocalizedCopy.js';
import { useOptionalCreatorSession } from './creator-session-store.js';

type SummaryItem = {
  label: string;
  value: string;
};

export default function CreatorTaskSummary(props: {
  sourceIcon: LucideIcon;
  sourceLabel: string;
  sourceValue: string;
  items: SummaryItem[];
  note?: string;
  noteIcon?: LucideIcon;
  compactSummary?: string;
}) {
  const l = useLocalizedCopy();
  const session = useOptionalCreatorSession();
  const SourceIcon = props.sourceIcon;
  const NoteIcon = props.noteIcon;
  const presetTitle = session?.job.presetOrigin?.title.trim();
  const heading = (
    <div className="video-translation-summary-heading">
      <span><Sparkles size={16} strokeWidth={1.8} aria-hidden="true" /></span>
      <h2>{l('任务摘要', 'Task summary')}</h2>
      {props.compactSummary !== undefined ? <ChevronDown size={15} strokeWidth={1.8} aria-hidden="true" /> : null}
    </div>
  );
  const content = (
    <>
      <div className="video-translation-source-summary">
        <SourceIcon size={16} strokeWidth={1.7} aria-hidden="true" />
        <span>
          <small>{props.sourceLabel}</small>
          <strong title={props.sourceValue}>{props.sourceValue}</strong>
        </span>
      </div>
      <dl>
        {presetTitle ? (
          <div>
            <dt>{l('模板来源', 'Preset')}</dt>
            <dd title={presetTitle}>{presetTitle}</dd>
          </div>
        ) : null}
        {props.items.map(item => (
          <div key={item.label}>
            <dt>{item.label}</dt>
            <dd>{item.value}</dd>
          </div>
        ))}
      </dl>
      {props.note ? <p>{NoteIcon ? <NoteIcon size={14} strokeWidth={1.8} aria-hidden="true" /> : null}{props.note}</p> : null}
    </>
  );

  return (
    <aside
      className={`video-translation-summary creator-task-summary${props.compactSummary !== undefined ? ' creator-task-summary-compact' : ''}`}
      aria-label={l('任务摘要', 'Task summary')}
    >
      {props.compactSummary !== undefined ? (
        <details>
          <summary>
            {heading}
            <p className="creator-task-summary-overview">{props.compactSummary}</p>
          </summary>
          <div className="creator-task-summary-details">{content}</div>
        </details>
      ) : <>{heading}{content}</>}
    </aside>
  );
}