|
342 | 342 | /> |
343 | 343 |
|
344 | 344 | <h3>Participants</h3> |
345 | | - <ul class="section-inner"> |
| 345 | + <ul> |
346 | 346 | {#each newSession.participants as participant} |
347 | 347 | <li class="section section-inner participant"> |
348 | 348 | <input |
|
410 | 410 | {currentSession.confirmed ? 'Ended' : 'Ongoing'} |
411 | 411 | </p> |
412 | 412 | <h3>Participants ({currentSession.participants.length})</h3> |
413 | | - {#each currentSession.participants as participant} |
414 | | - <div class="section section-inner"> |
415 | | - <h4>{participant.name}</h4> |
416 | | - |
417 | | - {#if participant.description} |
418 | | - <p class="description"> |
419 | | - {participant.description} |
420 | | - </p> |
421 | | - {/if} |
422 | | - |
423 | | - {#if adminToken || participant.reasons} |
424 | | - <p><strong>Share:</strong> {participant.share || 0}</p> |
425 | | - {#if participant.reasons.length > 0} |
426 | | - <strong>Reasons:</strong> |
427 | | - <ul> |
428 | | - {#each participant.reasons as reason} |
429 | | - <li>{reason}</li> |
430 | | - {/each} |
431 | | - </ul> |
| 413 | + <ul> |
| 414 | + {#each currentSession.participants as participant} |
| 415 | + <li class="section section-inner"> |
| 416 | + <h4>{participant.name}</h4> |
| 417 | + |
| 418 | + {#if participant.description} |
| 419 | + <p class="description"> |
| 420 | + {participant.description} |
| 421 | + </p> |
432 | 422 | {/if} |
433 | | - {:else if allDescriptionsSubmitted && currentParticipant} |
434 | | - <div id="share-inputs"> |
435 | | - <input |
436 | | - bind:value={participant.share} |
437 | | - on:input={() => { |
438 | | - participant.percentage = |
439 | | - ((participant.share || 0) / currentSession.stake) * 100; |
440 | | - }} |
441 | | - type="number" |
442 | | - step="0.01" |
443 | | - min="0" |
444 | | - placeholder="Share" |
445 | | - class="share-input" |
446 | | - /> |
447 | | - |
448 | | - <input |
449 | | - bind:value={participant.percentage} |
450 | | - on:input={(e) => { |
451 | | - const raw = parseFloat( |
452 | | - (e.target as HTMLInputElement).value |
453 | | - ); |
454 | | - const percentage = isNaN(raw) ? 0 : raw; |
455 | | - participant.share = |
456 | | - (currentSession.stake * percentage) / 100; |
457 | | - }} |
458 | | - type="number" |
459 | | - step="0.01" |
460 | | - min="0" |
461 | | - placeholder="Percentage" |
462 | | - class="share-input" |
463 | | - /> |
464 | | - </div> |
465 | | - <textarea bind:value={participant.reason} placeholder="Reason" |
466 | | - ></textarea> |
467 | | - {:else if participant.voted} |
468 | | - <p><strong>Voted:</strong> Yes</p> |
469 | | - {/if} |
470 | | - {#if !currentSession.confirmed && !currentParticipant && (adminToken || !participant.description || !participant.voted)} |
471 | | - <button on:click={() => selectParticipant(participant)}> |
472 | | - This is me |
473 | | - </button> |
474 | | - {/if} |
475 | | - {#if currentParticipant && currentParticipant.id == participant.id && (adminToken || !participant.description)} |
476 | | - <textarea |
477 | | - bind:value={currentParticipant.description} |
478 | | - placeholder="Description" |
479 | | - class="input" |
480 | | - ></textarea> |
481 | | - <button on:click={() => updateCurrentParticipant()}>Submit</button |
482 | | - > |
483 | | - {/if} |
484 | | - </div> |
485 | | - {/each} |
| 423 | + |
| 424 | + {#if adminToken || participant.reasons} |
| 425 | + <p><strong>Share:</strong> {participant.share || 0}</p> |
| 426 | + {#if participant.reasons.length > 0} |
| 427 | + <strong>Reasons:</strong> |
| 428 | + <ul> |
| 429 | + {#each participant.reasons as reason} |
| 430 | + <li>{reason}</li> |
| 431 | + {/each} |
| 432 | + </ul> |
| 433 | + {/if} |
| 434 | + {:else if allDescriptionsSubmitted && currentParticipant} |
| 435 | + <div id="share-inputs"> |
| 436 | + <input |
| 437 | + bind:value={participant.share} |
| 438 | + on:input={() => { |
| 439 | + participant.percentage = |
| 440 | + ((participant.share || 0) / currentSession.stake) * 100; |
| 441 | + }} |
| 442 | + type="number" |
| 443 | + step="0.01" |
| 444 | + min="0" |
| 445 | + placeholder="Share" |
| 446 | + class="share-input" |
| 447 | + /> |
| 448 | + |
| 449 | + <input |
| 450 | + bind:value={participant.percentage} |
| 451 | + on:input={(e) => { |
| 452 | + const raw = parseFloat( |
| 453 | + (e.target as HTMLInputElement).value |
| 454 | + ); |
| 455 | + const percentage = isNaN(raw) ? 0 : raw; |
| 456 | + participant.share = |
| 457 | + (currentSession.stake * percentage) / 100; |
| 458 | + }} |
| 459 | + type="number" |
| 460 | + step="0.01" |
| 461 | + min="0" |
| 462 | + placeholder="Percentage" |
| 463 | + class="share-input" |
| 464 | + /> |
| 465 | + </div> |
| 466 | + <textarea bind:value={participant.reason} placeholder="Reason" |
| 467 | + ></textarea> |
| 468 | + {:else if participant.voted} |
| 469 | + <p><strong>Voted:</strong> Yes</p> |
| 470 | + {/if} |
| 471 | + {#if !currentSession.confirmed && !currentParticipant && (adminToken || !participant.description || !participant.voted)} |
| 472 | + <button on:click={() => selectParticipant(participant)}> |
| 473 | + This is me |
| 474 | + </button> |
| 475 | + {/if} |
| 476 | + {#if currentParticipant && currentParticipant.id == participant.id && (adminToken || !participant.description)} |
| 477 | + <textarea |
| 478 | + bind:value={currentParticipant.description} |
| 479 | + placeholder="Description" |
| 480 | + class="input" |
| 481 | + ></textarea> |
| 482 | + <button on:click={() => updateCurrentParticipant()} |
| 483 | + >Submit</button |
| 484 | + > |
| 485 | + {/if} |
| 486 | + </li> |
| 487 | + {/each} |
| 488 | + </ul> |
486 | 489 | {#if currentParticipant?.reasons} |
487 | 490 | {#if !adminToken} |
488 | 491 | <button |
|
672 | 675 |
|
673 | 676 | border-radius: 1rem; |
674 | 677 |
|
675 | | - .participant { |
| 678 | + .section-inner { |
676 | 679 | padding: 0.5rem; |
677 | 680 | } |
678 | 681 | } |
|
0 commit comments