kyd-shared-badge 0.3.124 → 0.3.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kyd-shared-badge",
3
- "version": "0.3.124",
3
+ "version": "0.3.126",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -3,7 +3,7 @@ import { useRouter } from 'next/navigation';
3
3
  import { ProviderIcon } from '../utils/provider';
4
4
  import { normalizeLinkedInInput } from './linkedin';
5
5
  import type { ConnectAccountsProps } from './types';
6
- import { CheckCircle, Link2, LinkIcon, Unlink, ArrowLeft, ExternalLink, Eye, Lock, InfoIcon } from 'lucide-react';
6
+ import { CheckCircle, Link2, LinkIcon, Unlink, ArrowLeft, ExternalLink, Eye, Lock, InfoIcon, EyeClosed, EyeOffIcon } from 'lucide-react';
7
7
  import { AnimatePresence, motion, useReducedMotion } from 'framer-motion';
8
8
  import { Button, Input, Spinner, Card, CardHeader, CardContent, CardTitle, ConnectProgress } from '../ui';
9
9
  import Link from 'next/link';
@@ -57,10 +57,18 @@ export function ConnectAccounts(props: ConnectAccountsProps) {
57
57
  const [previewAction, setPreviewAction] = useState<'connect' | 'disconnect' | null>(null);
58
58
 
59
59
  const apiBase = apiGatewayUrl || (typeof process !== 'undefined' ? (process.env.NEXT_PUBLIC_API_GATEWAY_URL as string) : '');
60
- const connectedIds = useMemo(
61
- () => new Set((connected || []).map(c => (c.id ? c.id.toLowerCase() : c.name.toLowerCase()))),
62
- [connected]
63
- );
60
+ const connectedIds = useMemo(() => {
61
+ const set = new Set((connected || []).map(c => (c.id ? c.id.toLowerCase() : c.name.toLowerCase())));
62
+ // Include virtual provider 'githubapp' when the GitHub App is installed
63
+ try {
64
+ const gh = (connected || []).find(c => (c?.name || '').toLowerCase() === 'github');
65
+ const setupAction = gh?.app_installation_info?.setupAction;
66
+ if (setupAction === 'install' || setupAction === 'created') {
67
+ set.add('githubapp');
68
+ }
69
+ } catch {}
70
+ return set;
71
+ }, [connected]);
64
72
  const reconnectIds = useMemo(() => new Set((needsReconnectIds || []).map(id => id.toLowerCase())), [needsReconnectIds]);
65
73
 
66
74
  // React to upstream changes to initialProviderId (e.g., after oauth success)
@@ -424,15 +432,24 @@ export function ConnectAccounts(props: ConnectAccountsProps) {
424
432
  </Button>
425
433
  </motion.div>
426
434
  <motion.div whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }}>
427
- <Button
428
- className="w-full sm:w-auto bg-[var(--icon-accent)] text-white transition-colors font-semibold"
429
- onClick={onGithubAppInstall}
430
- >
431
- <span className="flex items-center justify-center">
432
- <ExternalLink className="w-4 h-4 mr-2" />
433
- Yes, connect my private repos
434
- </span>
435
- </Button>
435
+ <TooltipProvider>
436
+ <Tooltip>
437
+ <TooltipTrigger asChild>
438
+ <Button
439
+ className="w-full sm:w-auto bg-[var(--icon-accent)] text-white transition-colors font-semibold"
440
+ onClick={onGithubAppInstall}
441
+ >
442
+ <span className="flex items-center justify-center">
443
+ <ExternalLink className="w-4 h-4 mr-2" />
444
+ Yes, connect my private repos
445
+ </span>
446
+ </Button>
447
+ </TooltipTrigger>
448
+ <TooltipContent>
449
+ <p>Connect your private repositories</p>
450
+ </TooltipContent>
451
+ </Tooltip>
452
+ </TooltipProvider>
436
453
  </motion.div>
437
454
  </div>
438
455
  </motion.div>
@@ -530,15 +547,24 @@ export function ConnectAccounts(props: ConnectAccountsProps) {
530
547
  </div>
531
548
  ) : (
532
549
  <motion.div whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }}>
533
- <Button
534
- onClick={() => setSelectedProviderIdAndCallback('github')}
535
- onMouseEnter={() => setPreview('github', 'connect')}
536
- onMouseLeave={clearPreview}
537
- className="bg-[var(--icon-button-secondary)] text-[var(--text-main)] hover:bg-[var(--icon-accent)] hover:text-white border-0 sm:px-4 px-3 py-1 sm:py-2 rounded-lg flex items-center gap-2"
538
- >
539
- <Eye className="size-3 sm:size-4" />
540
- <span className="sm:text-base text-sm">Connect</span>
541
- </Button>
550
+ <TooltipProvider>
551
+ <Tooltip>
552
+ <TooltipTrigger asChild>
553
+ <Button
554
+ onClick={() => setSelectedProviderIdAndCallback('github')}
555
+ onMouseEnter={() => setPreview('github', 'connect')}
556
+ onMouseLeave={clearPreview}
557
+ className="bg-[var(--icon-button-secondary)] text-[var(--text-main)] hover:bg-[var(--icon-accent)] hover:text-white border-0 sm:px-4 px-3 py-1 sm:py-2 rounded-lg flex items-center gap-2"
558
+ >
559
+ <Eye className="size-3 sm:size-4" />
560
+ <span className="sm:text-base text-sm">Connect</span>
561
+ </Button>
562
+ </TooltipTrigger>
563
+ <TooltipContent>
564
+ <p>Connect your public repositories</p>
565
+ </TooltipContent>
566
+ </Tooltip>
567
+ </TooltipProvider>
542
568
  </motion.div>
543
569
  )}
544
570
 
@@ -552,6 +578,8 @@ export function ConnectAccounts(props: ConnectAccountsProps) {
552
578
  <div className="absolute right-0 opacity-0 transition-opacity group-hover:opacity-100">
553
579
  <button
554
580
  onClick={() => { window.location.href = 'https://github.com/settings/installations'; }}
581
+ onMouseEnter={() => setPreview('githubapp', 'disconnect')}
582
+ onMouseLeave={clearPreview}
555
583
  className="inline-flex items-center gap-1.5 py-1.5 text-sm text-red-600 hover:text-red-700 hover:underline"
556
584
  >
557
585
  <Unlink className="size-3 sm:size-4" />
@@ -561,15 +589,24 @@ export function ConnectAccounts(props: ConnectAccountsProps) {
561
589
  </div>
562
590
  ) : (
563
591
  <motion.div whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }}>
564
- <Button
565
- onClick={() => setSelectedProviderIdAndCallback('githubapp')}
566
- onMouseEnter={() => setPreview('githubapp', 'connect')}
567
- onMouseLeave={clearPreview}
568
- className="bg-[var(--icon-button-secondary)] text-[var(--text-main)] hover:bg-[var(--icon-accent)] hover:text-white border-0 sm:px-4 px-3 py-1 sm:py-2 rounded-lg flex items-center gap-2"
569
- >
570
- <Lock className="size-3 sm:size-4" />
571
- <span className="sm:text-base text-sm">Connect</span>
572
- </Button>
592
+ <TooltipProvider>
593
+ <Tooltip>
594
+ <TooltipTrigger asChild>
595
+ <Button
596
+ onClick={() => setSelectedProviderIdAndCallback('githubapp')}
597
+ onMouseEnter={() => setPreview('githubapp', 'connect')}
598
+ onMouseLeave={clearPreview}
599
+ className="bg-[var(--icon-button-secondary)] text-[var(--text-main)] hover:bg-[var(--icon-accent)] hover:text-white border-0 sm:px-4 px-3 py-1 sm:py-2 rounded-lg flex items-center gap-2"
600
+ >
601
+ <EyeOffIcon className="size-3 sm:size-4" />
602
+ <span className="sm:text-base text-sm">Connect</span>
603
+ </Button>
604
+ </TooltipTrigger>
605
+ <TooltipContent>
606
+ <p>Connect your private repositories</p>
607
+ </TooltipContent>
608
+ </Tooltip>
609
+ </TooltipProvider>
573
610
  </motion.div>
574
611
  )}
575
612
  </div>
@@ -58,29 +58,7 @@ export function ConnectProgress(props: ConnectProgressProps) {
58
58
  if (previewAction === 'connect' && !has) next.add(pid)
59
59
  if (previewAction === 'disconnect' && has) next.delete(pid)
60
60
  const val = computePercent(next)
61
- if (process.env.NODE_ENV !== 'production') {
62
- try {
63
- // Debug details for preview behavior
64
- const beforePercent = progressPercent
65
- const beforeOthers = (() => {
66
- let c = 0; normalizedIds.forEach(id => { if (id !== 'github' && id !== 'githubapp' && id !== 'linkedin') c += 1 })
67
- return c
68
- })()
69
- let afterOthers = 0; next.forEach(id => { if (id !== 'github' && id !== 'githubapp' && id !== 'linkedin') afterOthers += 1 })
70
- // eslint-disable-next-line no-console
71
- console.log('[ConnectProgress] preview', {
72
- pid,
73
- previewAction,
74
- hasBefore: normalizedIds.has(pid),
75
- beforePercent,
76
- afterPercent: val,
77
- beforeOthers,
78
- afterOthers,
79
- normalizedIds: Array.from(normalizedIds),
80
- nextIds: Array.from(next),
81
- })
82
- } catch {}
83
- }
61
+
84
62
  return val === progressPercent ? null : val
85
63
  }, [previewProviderId, previewAction, normalizedIds, progressPercent])
86
64
 
@@ -130,18 +108,7 @@ export function ConnectProgress(props: ConnectProgressProps) {
130
108
  gain = 10
131
109
  }
132
110
  const to = Math.max(0, Math.min(100, progressPercent + gain))
133
- if (process.env.NODE_ENV !== 'production') {
134
- try {
135
- // eslint-disable-next-line no-console
136
- console.log('[ConnectProgress] selectedPulse', {
137
- sid,
138
- progressPercent,
139
- gain,
140
- to,
141
- othersAlready: otherConnectedCount,
142
- })
143
- } catch {}
144
- }
111
+
145
112
  return { from: progressPercent, to }
146
113
  }, [selectedProviderId, normalizedIds, progressPercent, otherConnectedCount])
147
114
 
@@ -104,7 +104,13 @@ export function ProgressCircle(props: ProgressCircleProps) {
104
104
  </svg>
105
105
  {centerIndicator ? (
106
106
  <div className={`absolute inset-0 flex items-center justify-center`} aria-hidden>
107
- <ArrowUpIcon className="w-4 h-4 text-[var(--icon-accent)]" />
107
+ <ArrowUpIcon
108
+ className={`w-4 h-4`}
109
+ style={{
110
+ color: centerIndicator === 'up' ? greenHex : redHex,
111
+ transform: centerIndicator === 'up' ? undefined : 'rotate(180deg)',
112
+ }}
113
+ />
108
114
  </div>
109
115
  ) : null}
110
116
  </div>