({ config, state })
| 380 | // --------------------------------------------------------------------------- |
| 381 | |
| 382 | const ProgressView: React.FC<{ config: ModConfig; state: ModState }> = ({ config, state }) => { |
| 383 | const allStages = Object.values(config.stages).sort((a, b) => a.stage_index - b.stage_index); |
| 384 | |
| 385 | return ( |
| 386 | <div className={styles.progressView}> |
| 387 | <div className={styles.modTitle}>{config.mod_name_en || config.mod_name}</div> |
| 388 | <div className={styles.modDesc}>{config.mod_description}</div> |
| 389 | |
| 390 | <div className={styles.stageList}> |
| 391 | {allStages.map((stage) => { |
| 392 | const isCurrent = stage.stage_index === state.current_stage_index && !state.is_finished; |
| 393 | const isCompleted = stage.stage_index < state.current_stage_index || state.is_finished; |
| 394 | |
| 395 | return ( |
| 396 | <div |
| 397 | key={stage.stage_index} |
| 398 | className={`${styles.stageCard} ${isCurrent ? styles.stageCardCurrent : ''} ${isCompleted ? styles.stageCardCompleted : ''}`} |
| 399 | > |
| 400 | <div className={styles.stageCardHeader}> |
| 401 | <span className={styles.stageCardIndex}> |
| 402 | {isCompleted ? <Check size={14} /> : stage.stage_index + 1} |
| 403 | </span> |
| 404 | <span className={styles.stageCardName}>{stage.stage_name}</span> |
| 405 | {isCurrent && <span className={styles.stageCardBadge}>Current</span>} |
| 406 | </div> |
| 407 | <div className={styles.stageCardDesc}>{stage.stage_description}</div> |
| 408 | <div className={styles.targetList}> |
| 409 | {Object.entries(stage.stage_targets).map(([id, desc]) => { |
| 410 | const completed = state.completed_targets.includes(Number(id)); |
| 411 | return ( |
| 412 | <div |
| 413 | key={id} |
| 414 | className={`${styles.targetItem} ${completed ? styles.targetCompleted : ''}`} |
| 415 | > |
| 416 | <span className={styles.targetCheck}> |
| 417 | {completed ? <Check size={12} /> : '\u25CB'} |
| 418 | </span> |
| 419 | <span>{desc}</span> |
| 420 | </div> |
| 421 | ); |
| 422 | })} |
| 423 | </div> |
| 424 | </div> |
| 425 | ); |
| 426 | })} |
| 427 | </div> |
| 428 | |
| 429 | {state.is_finished && <div className={styles.finishedBanner}>All stages completed!</div>} |
| 430 | </div> |
| 431 | ); |
| 432 | }; |
| 433 | |
| 434 | // --------------------------------------------------------------------------- |
| 435 | // Edit View |
nothing calls this directly
no outgoing calls
no test coverage detected