@moontra/moonui-pro 2.20.2 → 2.20.4
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 +8 -3
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postinstall.js +191 -23
- package/src/components/advanced-chart/index.tsx +0 -1246
- package/src/components/advanced-forms/index.tsx +0 -585
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -377
- package/src/components/calendar/index.tsx +0 -1220
- package/src/components/calendar-pro/index.tsx +0 -1697
- package/src/components/color-picker/index.tsx +0 -432
- package/src/components/credit-card-input/index.tsx +0 -406
- package/src/components/dashboard/dashboard-grid.tsx +0 -480
- package/src/components/dashboard/demo.tsx +0 -425
- package/src/components/dashboard/index.tsx +0 -1046
- package/src/components/dashboard/time-range-picker.tsx +0 -336
- package/src/components/dashboard/types.ts +0 -225
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -349
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/comparison-widget.tsx +0 -177
- package/src/components/dashboard/widgets/index.ts +0 -5
- package/src/components/dashboard/widgets/metric-card.tsx +0 -363
- package/src/components/dashboard/widgets/progress-widget.tsx +0 -113
- package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
- package/src/components/data-table/data-table-column-toggle.tsx +0 -169
- package/src/components/data-table/data-table-export.ts +0 -156
- package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
- package/src/components/data-table/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/error-boundary/index.tsx +0 -232
- package/src/components/file-upload/index.tsx +0 -1660
- package/src/components/floating-action-button/index.tsx +0 -206
- package/src/components/form-wizard/form-wizard-context.tsx +0 -335
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -329
- package/src/components/form-wizard/form-wizard-step.tsx +0 -111
- package/src/components/form-wizard/index.tsx +0 -102
- package/src/components/form-wizard/types.ts +0 -77
- package/src/components/gesture-drawer/index.tsx +0 -551
- package/src/components/github-stars/github-api.ts +0 -426
- package/src/components/github-stars/hooks.ts +0 -517
- package/src/components/github-stars/index.tsx +0 -375
- package/src/components/github-stars/types.ts +0 -148
- package/src/components/github-stars/variants.tsx +0 -515
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -529
- package/src/components/index.ts +0 -130
- package/src/components/internal/index.ts +0 -78
- package/src/components/kanban/add-card-modal.tsx +0 -502
- package/src/components/kanban/card-detail-modal.tsx +0 -761
- package/src/components/kanban/index.ts +0 -13
- package/src/components/kanban/kanban.tsx +0 -1689
- package/src/components/kanban/types.ts +0 -168
- package/src/components/lazy-component/index.tsx +0 -823
- package/src/components/license-error/index.tsx +0 -31
- package/src/components/magnetic-button/index.tsx +0 -216
- package/src/components/memory-efficient-data/index.tsx +0 -1018
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/navbar/index.tsx +0 -781
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -613
- package/src/components/performance-monitor/index.tsx +0 -808
- package/src/components/phone-number-input/index.tsx +0 -343
- package/src/components/phone-number-input/phone-number-input-simple.tsx +0 -167
- package/src/components/pinch-zoom/index.tsx +0 -566
- package/src/components/quiz-form/index.tsx +0 -479
- package/src/components/rich-text-editor/index.tsx +0 -2322
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -230
- package/src/components/rich-text-editor/slash-commands.css +0 -35
- package/src/components/rich-text-editor/table-styles.css +0 -65
- package/src/components/sidebar/index.tsx +0 -884
- package/src/components/spotlight-card/index.tsx +0 -191
- package/src/components/swipeable-card/index.tsx +0 -100
- package/src/components/timeline/index.tsx +0 -1183
- package/src/components/ui/accordion.tsx +0 -581
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -141
- package/src/components/ui/aspect-ratio.tsx +0 -245
- package/src/components/ui/avatar.tsx +0 -155
- package/src/components/ui/badge.tsx +0 -230
- package/src/components/ui/breadcrumb.tsx +0 -216
- package/src/components/ui/button.tsx +0 -228
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -216
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -631
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -948
- package/src/components/ui/dialog.tsx +0 -752
- package/src/components/ui/dropdown-menu.tsx +0 -706
- package/src/components/ui/gesture-drawer.tsx +0 -11
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/index.ts +0 -222
- package/src/components/ui/input.tsx +0 -224
- package/src/components/ui/label.tsx +0 -29
- package/src/components/ui/lightbox.tsx +0 -606
- package/src/components/ui/magnetic-button.tsx +0 -129
- package/src/components/ui/media-gallery.tsx +0 -611
- package/src/components/ui/navigation-menu.tsx +0 -130
- package/src/components/ui/pagination.tsx +0 -125
- package/src/components/ui/popover.tsx +0 -185
- package/src/components/ui/progress.tsx +0 -30
- package/src/components/ui/radio-group.tsx +0 -257
- package/src/components/ui/scroll-area.tsx +0 -47
- package/src/components/ui/select.tsx +0 -378
- package/src/components/ui/separator.tsx +0 -145
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/skeleton.tsx +0 -20
- package/src/components/ui/slider.tsx +0 -354
- package/src/components/ui/spotlight-card.tsx +0 -119
- package/src/components/ui/switch.tsx +0 -86
- package/src/components/ui/table.tsx +0 -331
- package/src/components/ui/tabs-pro.tsx +0 -542
- package/src/components/ui/tabs.tsx +0 -54
- package/src/components/ui/textarea.tsx +0 -28
- package/src/components/ui/toast.tsx +0 -317
- package/src/components/ui/toggle.tsx +0 -119
- package/src/components/ui/tooltip.tsx +0 -151
- package/src/components/virtual-list/index.tsx +0 -668
- package/src/hooks/use-chart.ts +0 -205
- package/src/hooks/use-data-table.ts +0 -182
- package/src/hooks/use-docs-pro-access.ts +0 -13
- package/src/hooks/use-license-check.ts +0 -65
- package/src/hooks/use-subscription.ts +0 -19
- package/src/hooks/use-toast.ts +0 -15
- package/src/index.ts +0 -22
- package/src/lib/ai-providers.ts +0 -377
- package/src/lib/component-metadata.ts +0 -18
- package/src/lib/micro-interactions.ts +0 -255
- package/src/lib/paddle.ts +0 -17
- package/src/lib/utils.ts +0 -6
- package/src/patterns/login-form/index.tsx +0 -276
- package/src/patterns/login-form/types.ts +0 -67
- package/src/setupTests.ts +0 -41
- package/src/styles/advanced-chart.css +0 -239
- package/src/styles/calendar.css +0 -35
- package/src/styles/design-system.css +0 -363
- package/src/styles/index.css +0 -681
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- package/src/types/next-auth.d.ts +0 -21
- package/src/use-intersection-observer.tsx +0 -154
- package/src/use-local-storage.tsx +0 -71
- package/src/use-paddle.ts +0 -138
- package/src/use-performance-optimizer.ts +0 -389
- package/src/use-pro-access.ts +0 -141
- package/src/use-scroll-animation.ts +0 -219
- package/src/use-subscription.ts +0 -37
- package/src/use-toast.ts +0 -32
- package/src/utils/chart-helpers.ts +0 -357
- package/src/utils/cn.ts +0 -6
- package/src/utils/data-processing.ts +0 -151
- package/src/utils/license-validator.tsx +0 -183
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import React, { useMemo } from "react"
|
|
4
|
-
import { Card, CardContent } from "../ui/card"
|
|
5
|
-
import { Button } from "../ui/button"
|
|
6
|
-
import { MoonUISkeletonPro as Skeleton } from "../ui/skeleton"
|
|
7
|
-
import { cn } from "../../lib/utils"
|
|
8
|
-
import { Lock, Sparkles, RefreshCw, Github, Download, FileJson, FileSpreadsheet } from "lucide-react"
|
|
9
|
-
import { useSubscription } from "../../hooks/use-subscription"
|
|
10
|
-
import { useGitHubData, useGitHubNotifications } from "./hooks"
|
|
11
|
-
import { exportData, exportAsCSV } from "./github-api"
|
|
12
|
-
import {
|
|
13
|
-
MinimalVariant,
|
|
14
|
-
CompactVariant,
|
|
15
|
-
CardVariant,
|
|
16
|
-
DetailedVariant,
|
|
17
|
-
} from "./variants"
|
|
18
|
-
import type { GitHubStarsProps } from "./types"
|
|
19
|
-
import { motion, AnimatePresence } from "framer-motion"
|
|
20
|
-
import confetti from "canvas-confetti"
|
|
21
|
-
|
|
22
|
-
const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
|
|
23
|
-
username = "",
|
|
24
|
-
repository,
|
|
25
|
-
repositories,
|
|
26
|
-
token,
|
|
27
|
-
useMockData = false,
|
|
28
|
-
variant = "card",
|
|
29
|
-
layout = "grid",
|
|
30
|
-
showDescription = true,
|
|
31
|
-
showTopics = true,
|
|
32
|
-
showStats = true,
|
|
33
|
-
showOwner = true,
|
|
34
|
-
showLanguage = true,
|
|
35
|
-
showActivity = false,
|
|
36
|
-
showTrending = false,
|
|
37
|
-
showMilestones = false,
|
|
38
|
-
showComparison = false,
|
|
39
|
-
showHistory = false,
|
|
40
|
-
sortBy = "stars",
|
|
41
|
-
maxItems = 6,
|
|
42
|
-
autoRefresh = false,
|
|
43
|
-
refreshInterval = 300000,
|
|
44
|
-
enableNotifications = false,
|
|
45
|
-
enableExport = true,
|
|
46
|
-
enableAnalytics = false,
|
|
47
|
-
cacheEnabled = true,
|
|
48
|
-
cacheDuration = 300000,
|
|
49
|
-
animation = "fade",
|
|
50
|
-
animationDuration = 0.3,
|
|
51
|
-
staggerDelay = 0.05,
|
|
52
|
-
milestones = [10, 50, 100, 500, 1000, 5000, 10000],
|
|
53
|
-
celebrateAt = [100, 1000, 10000],
|
|
54
|
-
onRepositoryClick,
|
|
55
|
-
onStarClick,
|
|
56
|
-
onMilestoneReached,
|
|
57
|
-
onDataUpdate,
|
|
58
|
-
onError,
|
|
59
|
-
className,
|
|
60
|
-
theme = "auto",
|
|
61
|
-
size = "md",
|
|
62
|
-
customColors,
|
|
63
|
-
}) => {
|
|
64
|
-
// Docs mode tespiti
|
|
65
|
-
// Check if component has valid props to render
|
|
66
|
-
const hasValidProps = useMockData || username || (repositories && repositories.length > 0)
|
|
67
|
-
|
|
68
|
-
// If useMockData is false and no valid data props, don't render
|
|
69
|
-
if (!useMockData && !hasValidProps) {
|
|
70
|
-
return null
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const isDocsMode = typeof window !== "undefined" &&
|
|
74
|
-
(window.location.pathname.includes("/docs/") ||
|
|
75
|
-
window.location.pathname.includes("/components/"))
|
|
76
|
-
|
|
77
|
-
// Override some features in docs mode
|
|
78
|
-
const effectiveAutoRefresh = isDocsMode ? false : autoRefresh
|
|
79
|
-
const effectiveNotifications = isDocsMode ? false : enableNotifications
|
|
80
|
-
const effectiveRefreshInterval = isDocsMode ? 3600000 : refreshInterval // 1 hour in docs mode
|
|
81
|
-
const { notify } = useGitHubNotifications(effectiveNotifications)
|
|
82
|
-
|
|
83
|
-
// onMilestoneReached callback'ini memoize et
|
|
84
|
-
const handleMilestoneReached = React.useCallback((milestone: any) => {
|
|
85
|
-
// Handle milestone reached
|
|
86
|
-
if (celebrateAt?.includes(milestone.count)) {
|
|
87
|
-
// Trigger celebration animation
|
|
88
|
-
confetti({
|
|
89
|
-
particleCount: 100,
|
|
90
|
-
spread: 70,
|
|
91
|
-
origin: { y: 0.6 },
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
// Show notification
|
|
95
|
-
notify(`🎉 Milestone Reached!`, {
|
|
96
|
-
body: `${milestone.count} stars achieved!`,
|
|
97
|
-
tag: `milestone-${milestone.count}`,
|
|
98
|
-
})
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
onMilestoneReached?.(milestone)
|
|
102
|
-
}, [celebrateAt, notify, onMilestoneReached])
|
|
103
|
-
|
|
104
|
-
const {
|
|
105
|
-
repos,
|
|
106
|
-
stats,
|
|
107
|
-
loading,
|
|
108
|
-
error,
|
|
109
|
-
rateLimitInfo,
|
|
110
|
-
lastUpdated,
|
|
111
|
-
refresh,
|
|
112
|
-
} = useGitHubData({
|
|
113
|
-
username,
|
|
114
|
-
repository,
|
|
115
|
-
repositories,
|
|
116
|
-
token,
|
|
117
|
-
autoRefresh: effectiveAutoRefresh,
|
|
118
|
-
refreshInterval: effectiveRefreshInterval,
|
|
119
|
-
sortBy,
|
|
120
|
-
maxItems,
|
|
121
|
-
onError,
|
|
122
|
-
onDataUpdate,
|
|
123
|
-
onMilestoneReached: handleMilestoneReached,
|
|
124
|
-
milestones,
|
|
125
|
-
docsMode: isDocsMode, // Docs mode flag'ini gönder
|
|
126
|
-
mockDataFallback: true, // Use mock data in docs mode
|
|
127
|
-
forceMockData: useMockData, // Force mock data if true
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
const handleExport = React.useCallback((format: "json" | "csv") => {
|
|
131
|
-
if (!enableExport) return
|
|
132
|
-
|
|
133
|
-
const timestamp = new Date().toISOString().split("T")[0]
|
|
134
|
-
|
|
135
|
-
if (format === "json") {
|
|
136
|
-
exportData(
|
|
137
|
-
{ repositories: repos, statistics: stats, exportDate: new Date() },
|
|
138
|
-
`github-stars-${username}-${timestamp}.json`
|
|
139
|
-
)
|
|
140
|
-
} else {
|
|
141
|
-
exportAsCSV(repos, `github-stars-${username}-${timestamp}.csv`)
|
|
142
|
-
}
|
|
143
|
-
}, [enableExport, repos, stats, username])
|
|
144
|
-
|
|
145
|
-
// handleDetailedExport fonksiyonunu memoize et
|
|
146
|
-
const handleDetailedExport = React.useCallback((e: React.MouseEvent) => {
|
|
147
|
-
if (!enableExport) return
|
|
148
|
-
|
|
149
|
-
// Show export dropdown
|
|
150
|
-
const dropdown = document.createElement("div")
|
|
151
|
-
dropdown.className = "absolute z-50 mt-2 w-48 rounded-md shadow-lg bg-popover border"
|
|
152
|
-
dropdown.innerHTML = `
|
|
153
|
-
<div class="py-1">
|
|
154
|
-
<button class="w-full text-left px-4 py-2 text-sm hover:bg-accent" data-format="json">
|
|
155
|
-
Export as JSON
|
|
156
|
-
</button>
|
|
157
|
-
<button class="w-full text-left px-4 py-2 text-sm hover:bg-accent" data-format="csv">
|
|
158
|
-
Export as CSV
|
|
159
|
-
</button>
|
|
160
|
-
</div>
|
|
161
|
-
`
|
|
162
|
-
|
|
163
|
-
dropdown.addEventListener("click", (e) => {
|
|
164
|
-
const target = e.target as HTMLElement
|
|
165
|
-
const format = target.getAttribute("data-format")
|
|
166
|
-
if (format === "json" || format === "csv") {
|
|
167
|
-
handleExport(format)
|
|
168
|
-
dropdown.remove()
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
document.body.appendChild(dropdown)
|
|
173
|
-
|
|
174
|
-
// Position dropdown
|
|
175
|
-
const rect = (e.target as HTMLElement).getBoundingClientRect()
|
|
176
|
-
dropdown.style.top = `${rect.bottom + window.scrollY}px`
|
|
177
|
-
dropdown.style.left = `${rect.left + window.scrollX}px`
|
|
178
|
-
|
|
179
|
-
// Remove on outside click
|
|
180
|
-
setTimeout(() => {
|
|
181
|
-
document.addEventListener("click", () => dropdown.remove(), { once: true })
|
|
182
|
-
}, 0)
|
|
183
|
-
}, [enableExport, handleExport])
|
|
184
|
-
|
|
185
|
-
// Loading state
|
|
186
|
-
if (loading) {
|
|
187
|
-
return (
|
|
188
|
-
<Card className={cn("w-full", className)}>
|
|
189
|
-
<CardContent className="p-6">
|
|
190
|
-
<div className="space-y-4">
|
|
191
|
-
<div className="flex items-center justify-between">
|
|
192
|
-
<Skeleton className="h-6 w-48" />
|
|
193
|
-
<Skeleton className="h-8 w-20" />
|
|
194
|
-
</div>
|
|
195
|
-
<div className={cn(
|
|
196
|
-
layout === "grid"
|
|
197
|
-
? "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"
|
|
198
|
-
: "space-y-4"
|
|
199
|
-
)}>
|
|
200
|
-
{Array.from({ length: maxItems || 6 }).map((_, index) => (
|
|
201
|
-
<Card key={index}>
|
|
202
|
-
<CardContent className="p-4">
|
|
203
|
-
<div className="space-y-3">
|
|
204
|
-
<Skeleton className="h-5 w-3/4" />
|
|
205
|
-
<Skeleton className="h-4 w-full" />
|
|
206
|
-
<Skeleton className="h-4 w-2/3" />
|
|
207
|
-
<div className="flex gap-2">
|
|
208
|
-
<Skeleton className="h-6 w-16" />
|
|
209
|
-
<Skeleton className="h-6 w-16" />
|
|
210
|
-
<Skeleton className="h-6 w-16" />
|
|
211
|
-
</div>
|
|
212
|
-
</div>
|
|
213
|
-
</CardContent>
|
|
214
|
-
</Card>
|
|
215
|
-
))}
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
</CardContent>
|
|
219
|
-
</Card>
|
|
220
|
-
)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Error state
|
|
224
|
-
if (error) {
|
|
225
|
-
return (
|
|
226
|
-
<Card className={cn("w-full", className)}>
|
|
227
|
-
<CardContent className="p-6 text-center">
|
|
228
|
-
<div className="space-y-4">
|
|
229
|
-
<div className="text-destructive">
|
|
230
|
-
<Github className="h-12 w-12 mx-auto mb-2" />
|
|
231
|
-
<h3 className="font-semibold">Failed to load repositories</h3>
|
|
232
|
-
<p className="text-sm text-muted-foreground">{error}</p>
|
|
233
|
-
{rateLimitInfo && rateLimitInfo.remaining === 0 && (
|
|
234
|
-
<p className="text-xs text-muted-foreground mt-2">
|
|
235
|
-
Rate limit will reset at {new Date(rateLimitInfo.reset).toLocaleTimeString()}
|
|
236
|
-
</p>
|
|
237
|
-
)}
|
|
238
|
-
</div>
|
|
239
|
-
<Button onClick={refresh} variant="outline">
|
|
240
|
-
<RefreshCw className="h-4 w-4 mr-2" />
|
|
241
|
-
Try Again
|
|
242
|
-
</Button>
|
|
243
|
-
</div>
|
|
244
|
-
</CardContent>
|
|
245
|
-
</Card>
|
|
246
|
-
)
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// Render based on variant
|
|
250
|
-
const renderVariant = () => {
|
|
251
|
-
const baseProps = {
|
|
252
|
-
repos,
|
|
253
|
-
stats,
|
|
254
|
-
loading,
|
|
255
|
-
className,
|
|
256
|
-
onRepositoryClick,
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
switch (variant) {
|
|
260
|
-
case "minimal":
|
|
261
|
-
return <MinimalVariant {...baseProps} />
|
|
262
|
-
case "compact":
|
|
263
|
-
return <CompactVariant {...baseProps} />
|
|
264
|
-
case "detailed":
|
|
265
|
-
return (
|
|
266
|
-
<DetailedVariant
|
|
267
|
-
{...baseProps}
|
|
268
|
-
onExport={() => handleDetailedExport({} as React.MouseEvent)}
|
|
269
|
-
/>
|
|
270
|
-
)
|
|
271
|
-
case "card":
|
|
272
|
-
default:
|
|
273
|
-
return <CardVariant {...baseProps} />
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// Apply animation wrapper
|
|
278
|
-
const animationVariants = {
|
|
279
|
-
bounce: {
|
|
280
|
-
initial: { scale: 0.9, opacity: 0 },
|
|
281
|
-
animate: { scale: 1, opacity: 1 },
|
|
282
|
-
transition: { type: "spring", stiffness: 300, damping: 20 },
|
|
283
|
-
},
|
|
284
|
-
pulse: {
|
|
285
|
-
initial: { scale: 0.95, opacity: 0 },
|
|
286
|
-
animate: { scale: 1, opacity: 1 },
|
|
287
|
-
transition: { duration: animationDuration },
|
|
288
|
-
},
|
|
289
|
-
fade: {
|
|
290
|
-
initial: { opacity: 0 },
|
|
291
|
-
animate: { opacity: 1 },
|
|
292
|
-
transition: { duration: animationDuration },
|
|
293
|
-
},
|
|
294
|
-
scale: {
|
|
295
|
-
initial: { scale: 0, opacity: 0 },
|
|
296
|
-
animate: { scale: 1, opacity: 1 },
|
|
297
|
-
transition: { duration: animationDuration },
|
|
298
|
-
},
|
|
299
|
-
slide: {
|
|
300
|
-
initial: { x: -20, opacity: 0 },
|
|
301
|
-
animate: { x: 0, opacity: 1 },
|
|
302
|
-
transition: { duration: animationDuration },
|
|
303
|
-
},
|
|
304
|
-
none: {
|
|
305
|
-
initial: {},
|
|
306
|
-
animate: {},
|
|
307
|
-
transition: {},
|
|
308
|
-
},
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
const selectedAnimation = animationVariants[animation]
|
|
312
|
-
|
|
313
|
-
return (
|
|
314
|
-
<motion.div
|
|
315
|
-
{...selectedAnimation}
|
|
316
|
-
className={cn("w-full", className)}
|
|
317
|
-
>
|
|
318
|
-
{renderVariant()}
|
|
319
|
-
|
|
320
|
-
{/* Rate limit warning - Don't show in docs mode */}
|
|
321
|
-
{!isDocsMode && rateLimitInfo && rateLimitInfo.remaining < 10 && (
|
|
322
|
-
<div className="mt-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-md text-sm">
|
|
323
|
-
<p className="text-yellow-800 dark:text-yellow-200">
|
|
324
|
-
⚠️ Low API rate limit: {rateLimitInfo.remaining} requests remaining.
|
|
325
|
-
{token ? "" : " Consider adding a GitHub token for higher limits."}
|
|
326
|
-
</p>
|
|
327
|
-
</div>
|
|
328
|
-
)}
|
|
329
|
-
|
|
330
|
-
{/* Docs mode indicator - only show in development mode */}
|
|
331
|
-
{isDocsMode && process.env.NODE_ENV === "development" && (
|
|
332
|
-
<div className="mt-2 text-xs text-muted-foreground text-center">
|
|
333
|
-
📚 Docs Mode: API requests optimized
|
|
334
|
-
</div>
|
|
335
|
-
)}
|
|
336
|
-
</motion.div>
|
|
337
|
-
)
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
export const GitHubStars: React.FC<GitHubStarsProps> = ({ className, ...props }) => {
|
|
341
|
-
// Check if we're in docs mode or have pro access
|
|
342
|
-
const { hasProAccess, isLoading } = useSubscription()
|
|
343
|
-
|
|
344
|
-
// If not in docs mode and no pro access, show upgrade prompt
|
|
345
|
-
if (!isLoading && !hasProAccess) {
|
|
346
|
-
return (
|
|
347
|
-
<Card className={cn("w-fit", className)}>
|
|
348
|
-
<CardContent className="py-6 text-center">
|
|
349
|
-
<div className="space-y-4">
|
|
350
|
-
<div className="rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto">
|
|
351
|
-
<Lock className="h-6 w-6 text-purple-600 dark:text-purple-400" />
|
|
352
|
-
</div>
|
|
353
|
-
<div>
|
|
354
|
-
<h3 className="font-semibold text-sm mb-2">Pro Feature</h3>
|
|
355
|
-
<p className="text-muted-foreground text-xs mb-4">
|
|
356
|
-
GitHub Stars is available exclusively to MoonUI Pro subscribers.
|
|
357
|
-
</p>
|
|
358
|
-
<a href="/pricing">
|
|
359
|
-
<Button size="sm">
|
|
360
|
-
<Sparkles className="mr-2 h-4 w-4" />
|
|
361
|
-
Upgrade to Pro
|
|
362
|
-
</Button>
|
|
363
|
-
</a>
|
|
364
|
-
</div>
|
|
365
|
-
</div>
|
|
366
|
-
</CardContent>
|
|
367
|
-
</Card>
|
|
368
|
-
)
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
return <GitHubStarsInternal className={className} {...props} />
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
export type { GitHubRepository, GitHubStarsProps } from "./types"
|
|
375
|
-
export { LANGUAGE_COLORS } from "./github-api"
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
export interface GitHubRepository {
|
|
2
|
-
id: number
|
|
3
|
-
name: string
|
|
4
|
-
full_name: string
|
|
5
|
-
description: string | null
|
|
6
|
-
html_url: string
|
|
7
|
-
homepage: string | null
|
|
8
|
-
stargazers_count: number
|
|
9
|
-
watchers_count: number
|
|
10
|
-
forks_count: number
|
|
11
|
-
language: string | null
|
|
12
|
-
topics: string[]
|
|
13
|
-
created_at: string
|
|
14
|
-
updated_at: string
|
|
15
|
-
pushed_at: string
|
|
16
|
-
size: number
|
|
17
|
-
open_issues_count: number
|
|
18
|
-
license: {
|
|
19
|
-
key: string
|
|
20
|
-
name: string
|
|
21
|
-
spdx_id: string
|
|
22
|
-
url: string
|
|
23
|
-
} | null
|
|
24
|
-
owner: {
|
|
25
|
-
login: string
|
|
26
|
-
avatar_url: string
|
|
27
|
-
html_url: string
|
|
28
|
-
type: string
|
|
29
|
-
}
|
|
30
|
-
private: boolean
|
|
31
|
-
// Extended properties
|
|
32
|
-
contributors_count?: number
|
|
33
|
-
commits_count?: number
|
|
34
|
-
releases_count?: number
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface GitHubStats {
|
|
38
|
-
totalStars: number
|
|
39
|
-
totalForks: number
|
|
40
|
-
totalWatchers: number
|
|
41
|
-
totalIssues: number
|
|
42
|
-
avgStarsPerRepo: number
|
|
43
|
-
mostStarredRepo: GitHubRepository | null
|
|
44
|
-
recentActivity: GitHubActivity[]
|
|
45
|
-
languages: LanguageStats[]
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface GitHubActivity {
|
|
49
|
-
type: "star" | "fork" | "issue" | "pr" | "release"
|
|
50
|
-
repository: string
|
|
51
|
-
timestamp: string
|
|
52
|
-
actor?: string
|
|
53
|
-
description?: string
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface LanguageStats {
|
|
57
|
-
language: string
|
|
58
|
-
count: number
|
|
59
|
-
percentage: number
|
|
60
|
-
color: string
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface StarHistory {
|
|
64
|
-
date: string
|
|
65
|
-
count: number
|
|
66
|
-
repository?: string
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface Milestone {
|
|
70
|
-
count: number
|
|
71
|
-
reached: boolean
|
|
72
|
-
date?: string
|
|
73
|
-
celebration?: boolean
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export type DisplayVariant = "compact" | "full" | "minimal" | "detailed" | "card"
|
|
77
|
-
export type AnimationOption = "bounce" | "pulse" | "fade" | "scale" | "slide" | "none"
|
|
78
|
-
export type SortOption = "stars" | "forks" | "updated" | "created" | "name" | "issues"
|
|
79
|
-
export type LayoutOption = "grid" | "list" | "masonry" | "carousel"
|
|
80
|
-
|
|
81
|
-
export interface GitHubStarsProps {
|
|
82
|
-
// Basic props
|
|
83
|
-
username?: string
|
|
84
|
-
repository?: string // For single repo mode
|
|
85
|
-
repositories?: string[] // For multiple repos
|
|
86
|
-
token?: string // GitHub token for higher rate limits
|
|
87
|
-
useMockData?: boolean // Force mock data instead of API requests
|
|
88
|
-
|
|
89
|
-
// Display options
|
|
90
|
-
variant?: DisplayVariant
|
|
91
|
-
layout?: LayoutOption
|
|
92
|
-
showDescription?: boolean
|
|
93
|
-
showTopics?: boolean
|
|
94
|
-
showStats?: boolean
|
|
95
|
-
showOwner?: boolean
|
|
96
|
-
showLanguage?: boolean
|
|
97
|
-
showActivity?: boolean
|
|
98
|
-
showTrending?: boolean
|
|
99
|
-
showMilestones?: boolean
|
|
100
|
-
showComparison?: boolean
|
|
101
|
-
showHistory?: boolean
|
|
102
|
-
|
|
103
|
-
// Behavior options
|
|
104
|
-
sortBy?: SortOption
|
|
105
|
-
maxItems?: number
|
|
106
|
-
autoRefresh?: boolean
|
|
107
|
-
refreshInterval?: number
|
|
108
|
-
enableNotifications?: boolean
|
|
109
|
-
enableExport?: boolean
|
|
110
|
-
enableAnalytics?: boolean
|
|
111
|
-
cacheEnabled?: boolean
|
|
112
|
-
cacheDuration?: number
|
|
113
|
-
|
|
114
|
-
// Animation options
|
|
115
|
-
animation?: AnimationOption
|
|
116
|
-
animationDuration?: number
|
|
117
|
-
staggerDelay?: number
|
|
118
|
-
|
|
119
|
-
// Milestone configuration
|
|
120
|
-
milestones?: number[]
|
|
121
|
-
celebrateAt?: number[]
|
|
122
|
-
|
|
123
|
-
// Callbacks
|
|
124
|
-
onRepositoryClick?: (repo: GitHubRepository) => void
|
|
125
|
-
onStarClick?: (repo: GitHubRepository) => void
|
|
126
|
-
onMilestoneReached?: (milestone: Milestone) => void
|
|
127
|
-
onDataUpdate?: (stats: GitHubStats) => void
|
|
128
|
-
onError?: (error: Error) => void
|
|
129
|
-
|
|
130
|
-
// Styling
|
|
131
|
-
className?: string
|
|
132
|
-
theme?: "light" | "dark" | "auto"
|
|
133
|
-
size?: "sm" | "md" | "lg" | "xl"
|
|
134
|
-
customColors?: Record<string, string>
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export interface CacheEntry {
|
|
138
|
-
data: any
|
|
139
|
-
timestamp: number
|
|
140
|
-
expiresAt: number
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export interface RateLimitInfo {
|
|
144
|
-
limit: number
|
|
145
|
-
remaining: number
|
|
146
|
-
reset: number
|
|
147
|
-
used: number
|
|
148
|
-
}
|