53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
import React from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { GATE_ORDER } from '../../utils/playreelApi';
|
|
import { AUTO_APPROVABLE, setAutoApprove, useAutoApprove } from '../../utils/playreelPrefs';
|
|
|
|
/**
|
|
* 게이트 자동 승인 설정 — 롱컷 시작 화면에 놓는다(playreel 원본과 같은 자리).
|
|
* 스위치는 되돌릴 수 있는 ①·③ 만 있고, 나머지는 잠금으로 이유를 알려준다.
|
|
*/
|
|
const PlayreelAutoApprovePanel: React.FC = () => {
|
|
const { t } = useTranslation();
|
|
const prefs = useAutoApprove();
|
|
|
|
return (
|
|
<div className="pr-auto">
|
|
<p className="p2v-label">{t('playreel.auto.title')}</p>
|
|
<div className="p2v-panel">
|
|
{AUTO_APPROVABLE.map((gate) => {
|
|
const name = t(`playreel.gates.${gate}.name`);
|
|
return (
|
|
<div key={gate} className="pr-auto__row">
|
|
<div className="pr-auto__text">
|
|
<p className="pr-strong">
|
|
{t('playreel.auto.gate', { step: GATE_ORDER.indexOf(gate) + 1, name })}
|
|
</p>
|
|
<p className="p2v-note">{t(`playreel.auto.${gate}`)}</p>
|
|
</div>
|
|
<button
|
|
type="button"
|
|
role="switch"
|
|
aria-checked={!!prefs[gate]}
|
|
aria-label={t('playreel.auto.switchLabel', { name })}
|
|
className={`pr-switch${prefs[gate] ? ' on' : ''}`}
|
|
onClick={() => setAutoApprove(gate, !prefs[gate])}
|
|
>
|
|
<span className="pr-switch__knob" />
|
|
</button>
|
|
</div>
|
|
);
|
|
})}
|
|
<div className="pr-auto__row pr-auto__row--locked">
|
|
<div className="pr-auto__text">
|
|
<p className="pr-strong">{t('playreel.auto.lockedTitle')}</p>
|
|
<p className="p2v-note">{t('playreel.auto.lockedDesc')}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default PlayreelAutoApprovePanel;
|