ChatAgentStatus

Feedback & Status

에이전트의 현재 작업 상태를 알리는 한 줄 표시.

Usage

에이전트가 지금 무엇을 하는지 working/waiting/done 상태로 알릴 때 사용한다.

import

import

import { ChatAgentStatus } from '@mildang/design-system/unofficial/Chat';

예제를 복사해 쓸 때 필요한 준비

@mildang/styled-system 은 이 저장소에서 Panda 가 생성하는 산출물이다. 저장소 안에서는 turbo run ship 이후 쓸 수 있고, 패키지 소비자는 자기 Panda 산출물이나 다른 레이아웃 수단으로 바꿔야 한다.

API Reference

ChatAgentStatus Props

Prop

Type

Default

label
필수

ReactNode

지정 안 함

state
필수

"done" | "working" | "waiting"

지정 안 함

elapsed

ReactNode

지정 안 함

labels

Partial<ChatAgentStatusLabels>

지정 안 함

onPause

ReactEventHandler<HTMLDivElement> & (() => void)

지정 안 함

onResume

() => void

지정 안 함

같은 패밀리

@mildang/design-system/unofficial/Chat 에서 같이 내보내는 컴포넌트다.

예제

실행 중

import type { ComponentProps } from 'react';
import { ChatAgentStatus } from '@mildang/design-system/unofficial/Chat';
type Props = ComponentProps<typeof ChatAgentStatus>;
const DEFAULT_ARGS: Props = { state: 'working', label: '테스트 스위트 실행 중', elapsed: '00:42', onPause: () => {} };
export default function AgentStatusWorkingExample(props: Partial<Props> = {}) { return <ChatAgentStatus {...DEFAULT_ARGS} {...props} />; }

대기 중

import type { ComponentProps } from 'react';
import { ChatAgentStatus } from '@mildang/design-system/unofficial/Chat';
type Props = ComponentProps<typeof ChatAgentStatus>;
const DEFAULT_ARGS: Props = { state: 'waiting', label: '승인을 기다리는 중', elapsed: '00:08', onPause: () => {} };
export default function AgentStatusWaitingExample(props: Partial<Props> = {}) { return <ChatAgentStatus {...DEFAULT_ARGS} {...props} />; }

완료

import type { ComponentProps } from 'react';
import { ChatAgentStatus } from '@mildang/design-system/unofficial/Chat';
type Props = ComponentProps<typeof ChatAgentStatus>;
const DEFAULT_ARGS: Props = { state: 'done', label: '테스트 24개 통과', elapsed: '01:15', onResume: () => {} };
export default function AgentStatusDoneExample(props: Partial<Props> = {}) { return <ChatAgentStatus {...DEFAULT_ARGS} {...props} />; }

일시정지

import type { ComponentProps } from 'react';
import { ChatAgentStatus } from '@mildang/design-system/unofficial/Chat';
type Props = ComponentProps<typeof ChatAgentStatus>;
const DEFAULT_ARGS: Props = { state: 'waiting', label: '일시정지됨', elapsed: '00:42', onResume: () => {} };
export default function AgentStatusPausedExample(props: Partial<Props> = {}) { return <ChatAgentStatus {...DEFAULT_ARGS} {...props} />; }

콜백 미전달

onPause·onResume을 넘기지 않아 버튼이 아예 렌더되지 않는 예시다.

import { css } from '@mildang/styled-system/css';
import { ChatAgentStatus } from '@mildang/design-system/unofficial/Chat';

const AgentStatusNoCallbacksExample = () => (
    <div className={css({ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: '12' })}>
      <ChatAgentStatus state="working" label="버튼 없음" elapsed="00:12" />
      <ChatAgentStatus state="working" label="경과시간도 없음" />
      <ChatAgentStatus
        state="working"
        label="아주 긴 라벨은 말줄임으로 잘린다 — 파일 열두 개를 훑는 중"
        elapsed="02:30"
        onPause={() => {}}
      />
    </div>
  );

export default AgentStatusNoCallbacksExample;

문구 교체

import type { ComponentProps } from 'react';
import { ChatAgentStatus } from '@mildang/design-system/unofficial/Chat';
type Props = ComponentProps<typeof ChatAgentStatus>;
const DEFAULT_ARGS: Props = { state: 'working', label: 'Running tests', elapsed: '00:42', onPause: () => {}, labels: { pause: 'Pause agent' } };
export default function AgentStatusCustomLabelsExample(props: Partial<Props> = {}) { return <ChatAgentStatus {...DEFAULT_ARGS} {...props} />; }