|
521 | 521 | return packageCount >= 5 && hasValidName && hasValidDescription; |
522 | 522 | } |
523 | 523 |
|
| 524 | + function getPushToCommunityTooltip(config: Config): string { |
| 525 | + const packages = Array.isArray(config.packages) ? config.packages : []; |
| 526 | + const packageCount = packages.length; |
| 527 | + const hasValidName = config.name !== 'Default'; |
| 528 | + const hasValidDescription = !!config.description && config.description !== '' && config.description !== 'My default configuration'; |
| 529 | + |
| 530 | + const missing: string[] = []; |
| 531 | + |
| 532 | + if (packageCount < 5) { |
| 533 | + missing.push(`At least 5 packages required (current: ${packageCount})`); |
| 534 | + } |
| 535 | + if (!hasValidName) { |
| 536 | + missing.push('Custom name required (cannot be "Default")'); |
| 537 | + } |
| 538 | + if (!hasValidDescription) { |
| 539 | + missing.push('Description required'); |
| 540 | + } |
| 541 | + |
| 542 | + if (missing.length === 0) { |
| 543 | + return 'Push to Community'; |
| 544 | + } |
| 545 | + |
| 546 | + return 'Cannot push to community:\n' + missing.map(m => '• ' + m).join('\n'); |
| 547 | + } |
| 548 | +
|
524 | 549 | async function pushToCommunity(config: Config) { |
525 | 550 | if (!canPushToCommunity(config)) { |
526 | 551 | alert('Your configuration needs at least 5 packages, a custom name, and a description to be shared with the community.'); |
|
623 | 648 | {:else} |
624 | 649 | <button |
625 | 650 | class="push-to-community-disabled" |
626 | | - title="Add at least 5 packages, a custom name, and a description to share with the community" |
627 | 651 | disabled |
628 | 652 | > |
629 | | - <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> |
630 | | - <circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/> |
631 | | - </svg> |
| 653 | + <span class="icon-wrapper" title={getPushToCommunityTooltip(config)}> |
| 654 | + <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> |
| 655 | + <circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/> |
| 656 | + </svg> |
| 657 | + </span> |
632 | 658 | Push to Community |
633 | 659 | </button> |
634 | 660 | {/if} |
|
1126 | 1152 | flex-shrink: 0; |
1127 | 1153 | } |
1128 | 1154 |
|
| 1155 | + .push-to-community-disabled .icon-wrapper { |
| 1156 | + display: inline-flex; |
| 1157 | + cursor: help; |
| 1158 | + } |
| 1159 | +
|
1129 | 1160 | .modal-overlay { |
1130 | 1161 | position: fixed; |
1131 | 1162 | inset: 0; |
|
0 commit comments