refactor: 匹配素材与换一个合并为同个按钮的不同状态
This commit is contained in:
@@ -113,37 +113,28 @@ const ShotTimeline: React.FC<ShotTimelineProps> = ({
|
||||
素材
|
||||
</span>
|
||||
{materialMatchMap[String(shot.id)] ? (
|
||||
<>
|
||||
<span style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
|
||||
✓ {userUploadedMaterials[String(shot.id)] ? '已上传' : '已匹配'}(
|
||||
{materialMatchMap[String(shot.id)]!.duration.toFixed(1)}s)
|
||||
</span>
|
||||
<button
|
||||
className="btn btn-ghost btn-sm"
|
||||
style={{ fontSize: '11px', padding: '2px 6px', color: 'var(--primary)' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onSwitchMaterial(String(shot.id));
|
||||
}}
|
||||
>
|
||||
换一个
|
||||
</button>
|
||||
</>
|
||||
<span style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
|
||||
✓ {userUploadedMaterials[String(shot.id)] ? '已上传' : '已匹配'}(
|
||||
{materialMatchMap[String(shot.id)]!.duration.toFixed(1)}s)
|
||||
</span>
|
||||
) : (
|
||||
<>
|
||||
<span>✗ 未匹配</span>
|
||||
<button
|
||||
className="btn btn-ghost btn-sm"
|
||||
style={{ fontSize: '11px', padding: '2px 6px', color: 'var(--primary)' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onMatchMaterial(String(shot.id));
|
||||
}}
|
||||
>
|
||||
匹配素材
|
||||
</button>
|
||||
</>
|
||||
<span>✗ 未匹配</span>
|
||||
)}
|
||||
<button
|
||||
className="btn btn-ghost btn-sm"
|
||||
style={{ fontSize: '11px', padding: '2px 6px', color: 'var(--primary)' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
const sid = String(shot.id);
|
||||
if (materialMatchMap[sid]) {
|
||||
onSwitchMaterial(sid);
|
||||
} else {
|
||||
onMatchMaterial(sid);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{materialMatchMap[String(shot.id)] ? '换一个' : '匹配素材'}
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-ghost btn-sm"
|
||||
style={{
|
||||
|
||||
Reference in New Issue
Block a user