@moontra/moonui-pro 2.20.1 → 2.20.3
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/dist/index.d.ts +691 -261
- package/dist/index.mjs +7418 -4934
- package/package.json +11 -5
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postbuild.js +27 -0
- package/scripts/postinstall.js +176 -23
- package/src/__tests__/use-intersection-observer.test.tsx +0 -216
- package/src/__tests__/use-local-storage.test.tsx +0 -174
- package/src/__tests__/use-pro-access.test.tsx +0 -183
- package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
- package/src/components/advanced-chart/index.tsx +0 -1242
- package/src/components/advanced-forms/index.tsx +0 -426
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -372
- package/src/components/calendar/index.tsx +0 -1073
- 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 -462
- 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 -222
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -344
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/metric-card.tsx +0 -343
- 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/data-table.test.tsx +0 -187
- package/src/components/data-table/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/enhanced/badge.tsx +0 -191
- package/src/components/enhanced/button.tsx +0 -362
- package/src/components/enhanced/card.tsx +0 -266
- package/src/components/enhanced/dialog.tsx +0 -246
- package/src/components/enhanced/index.ts +0 -4
- package/src/components/error-boundary/index.tsx +0 -109
- package/src/components/file-upload/file-upload.test.tsx +0 -243
- 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 -307
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -298
- 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 -76
- 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 -516
- 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 -513
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -530
- package/src/components/index.ts +0 -128
- 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 -1684
- 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 -29
- package/src/components/magnetic-button/index.tsx +0 -167
- package/src/components/memory-efficient-data/index.tsx +0 -1016
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -589
- package/src/components/performance-monitor/index.tsx +0 -794
- package/src/components/phone-number-input/index.tsx +0 -338
- 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-old-backup.tsx +0 -437
- package/src/components/rich-text-editor/index.tsx +0 -2324
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -220
- 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 -865
- 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 -1148
- package/src/components/ui/accordion.tsx +0 -73
- 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 -153
- package/src/components/ui/badge.tsx +0 -228
- package/src/components/ui/breadcrumb.tsx +0 -214
- package/src/components/ui/button.tsx +0 -222
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -214
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -135
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -225
- package/src/components/ui/dialog.tsx +0 -334
- package/src/components/ui/dropdown-menu.tsx +0 -218
- 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 -190
- package/src/components/ui/input.tsx +0 -222
- 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 -612
- package/src/components/ui/pagination.tsx +0 -123
- 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 -374
- 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 -329
- package/src/components/ui/tabs.tsx +0 -198
- 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 -14
- 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 -85
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- package/src/types/moonui.d.ts +0 -22
- 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
package/src/use-pro-access.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
// Pro Access Hook
|
|
2
|
-
// Kullanıcının pro componentlere erişim durumunu kontrol eder
|
|
3
|
-
|
|
4
|
-
import React from 'react'
|
|
5
|
-
import { useSession } from 'next-auth/react'
|
|
6
|
-
import { useQuery } from '@tanstack/react-query'
|
|
7
|
-
import { getComponentAccess } from '@/lib/component-metadata'
|
|
8
|
-
|
|
9
|
-
interface UserSubscription {
|
|
10
|
-
userId: string
|
|
11
|
-
plan: 'free' | 'pro_monthly' | 'pro_annual' | 'pro_lifetime'
|
|
12
|
-
status: 'active' | 'expired' | 'cancelled' | 'trial'
|
|
13
|
-
expiresAt: Date | null // lifetime için null
|
|
14
|
-
createdAt: Date
|
|
15
|
-
updatedAt: Date
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface ProAccessStatus {
|
|
19
|
-
hasProAccess: boolean
|
|
20
|
-
subscription: UserSubscription | null | undefined
|
|
21
|
-
isLoading: boolean
|
|
22
|
-
error: Error | null
|
|
23
|
-
daysUntilExpiry: number | null
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Subscription durumunu API'den çek
|
|
27
|
-
async function fetchSubscriptionStatus(): Promise<UserSubscription | null> {
|
|
28
|
-
const response = await fetch('/api/user/subscription-status')
|
|
29
|
-
|
|
30
|
-
if (!response.ok) {
|
|
31
|
-
throw new Error('Subscription status fetch failed')
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const data = await response.json()
|
|
35
|
-
return data.subscription
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Pro erişim durumunu hesapla
|
|
39
|
-
function calculateProAccess(subscription: UserSubscription | null | undefined): {
|
|
40
|
-
hasProAccess: boolean
|
|
41
|
-
daysUntilExpiry: number | null
|
|
42
|
-
} {
|
|
43
|
-
if (!subscription) {
|
|
44
|
-
return { hasProAccess: false, daysUntilExpiry: null }
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Lifetime üyelik
|
|
48
|
-
if (subscription.plan === 'pro_lifetime') {
|
|
49
|
-
return { hasProAccess: true, daysUntilExpiry: null }
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Aktif olmayan subscription
|
|
53
|
-
if (subscription.status !== 'active') {
|
|
54
|
-
return { hasProAccess: false, daysUntilExpiry: null }
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Süre kontrolü
|
|
58
|
-
if (subscription.expiresAt) {
|
|
59
|
-
const now = new Date()
|
|
60
|
-
const expiryDate = new Date(subscription.expiresAt)
|
|
61
|
-
const daysUntilExpiry = Math.ceil((expiryDate.getTime() - now.getTime()) / (1000 * 60 * 60 * 24))
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
hasProAccess: daysUntilExpiry > 0,
|
|
65
|
-
daysUntilExpiry: daysUntilExpiry > 0 ? daysUntilExpiry : 0
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return { hasProAccess: false, daysUntilExpiry: null }
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function useProAccess(): ProAccessStatus {
|
|
73
|
-
const { data: session, status } = useSession()
|
|
74
|
-
|
|
75
|
-
const {
|
|
76
|
-
data: subscription,
|
|
77
|
-
isLoading,
|
|
78
|
-
error
|
|
79
|
-
} = useQuery({
|
|
80
|
-
queryKey: ['subscription-status', session?.user?.id],
|
|
81
|
-
queryFn: fetchSubscriptionStatus,
|
|
82
|
-
enabled: !!session?.user?.id && status === 'authenticated',
|
|
83
|
-
staleTime: 5 * 60 * 1000, // 5 dakika cache
|
|
84
|
-
refetchInterval: 10 * 60 * 1000, // 10 dakikada bir otomatik refresh
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
const { hasProAccess, daysUntilExpiry } = calculateProAccess(subscription)
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
hasProAccess,
|
|
91
|
-
subscription,
|
|
92
|
-
isLoading: status === 'loading' || isLoading,
|
|
93
|
-
error: error as Error | null,
|
|
94
|
-
daysUntilExpiry
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Component erişim kontrolü için helper hook
|
|
99
|
-
export function useComponentAccess(componentId: string) {
|
|
100
|
-
const { hasProAccess, isLoading } = useProAccess()
|
|
101
|
-
|
|
102
|
-
const access = React.useMemo(() => {
|
|
103
|
-
return getComponentAccess(componentId, hasProAccess ? 'pro' : 'free')
|
|
104
|
-
}, [componentId, hasProAccess])
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
...access,
|
|
108
|
-
isLoading,
|
|
109
|
-
canUse: access.access === 'unlocked',
|
|
110
|
-
isLocked: access.access === 'locked'
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Subscription durumu için utility functions
|
|
115
|
-
export function getSubscriptionDisplayName(plan: string): string {
|
|
116
|
-
switch (plan) {
|
|
117
|
-
case 'pro_monthly':
|
|
118
|
-
return 'Pro Monthly'
|
|
119
|
-
case 'pro_annual':
|
|
120
|
-
return 'Pro Annual'
|
|
121
|
-
case 'pro_lifetime':
|
|
122
|
-
return 'Pro Lifetime'
|
|
123
|
-
default:
|
|
124
|
-
return 'Free'
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export function getSubscriptionColor(status: string): string {
|
|
129
|
-
switch (status) {
|
|
130
|
-
case 'active':
|
|
131
|
-
return 'green'
|
|
132
|
-
case 'trial':
|
|
133
|
-
return 'blue'
|
|
134
|
-
case 'expired':
|
|
135
|
-
return 'red'
|
|
136
|
-
case 'cancelled':
|
|
137
|
-
return 'gray'
|
|
138
|
-
default:
|
|
139
|
-
return 'gray'
|
|
140
|
-
}
|
|
141
|
-
}
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useEffect, useRef, useState } from 'react'
|
|
4
|
-
import { useInView, useScroll, useTransform } from 'framer-motion'
|
|
5
|
-
|
|
6
|
-
interface UseScrollAnimationOptions {
|
|
7
|
-
threshold?: number
|
|
8
|
-
triggerOnce?: boolean
|
|
9
|
-
rootMargin?: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function useScrollAnimation(options: UseScrollAnimationOptions = {}) {
|
|
13
|
-
const ref = useRef<HTMLElement>(null)
|
|
14
|
-
const isInView = useInView(ref, {
|
|
15
|
-
amount: options.threshold || 0.1,
|
|
16
|
-
once: options.triggerOnce ?? true,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
return { ref, isInView }
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function useScrollProgress() {
|
|
23
|
-
const { scrollYProgress } = useScroll()
|
|
24
|
-
return scrollYProgress
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function useScrollBasedAnimation() {
|
|
28
|
-
const { scrollY } = useScroll()
|
|
29
|
-
const y = useTransform(scrollY, [0, 300], [0, -50])
|
|
30
|
-
const opacity = useTransform(scrollY, [0, 300], [1, 0])
|
|
31
|
-
const scale = useTransform(scrollY, [0, 300], [1, 0.8])
|
|
32
|
-
|
|
33
|
-
return { y, opacity, scale, scrollY }
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function useParallaxScroll(speed: number = 0.5) {
|
|
37
|
-
const ref = useRef<HTMLElement>(null)
|
|
38
|
-
const { scrollYProgress } = useScroll({
|
|
39
|
-
target: ref,
|
|
40
|
-
offset: ['start end', 'end start']
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
const y = useTransform(scrollYProgress, [0, 1], [`-${speed * 100}%`, `${speed * 100}%`])
|
|
44
|
-
|
|
45
|
-
return { ref, y }
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function useScrollDirection() {
|
|
49
|
-
const [scrollDirection, setScrollDirection] = useState<'up' | 'down'>('down')
|
|
50
|
-
const [scrollY, setScrollY] = useState(0)
|
|
51
|
-
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
let ticking = false
|
|
54
|
-
|
|
55
|
-
const updateScrollDirection = () => {
|
|
56
|
-
const newScrollY = window.scrollY
|
|
57
|
-
|
|
58
|
-
if (Math.abs(newScrollY - scrollY) < 5) {
|
|
59
|
-
ticking = false
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
setScrollDirection(newScrollY > scrollY ? 'down' : 'up')
|
|
64
|
-
setScrollY(newScrollY)
|
|
65
|
-
ticking = false
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const handleScroll = () => {
|
|
69
|
-
if (!ticking) {
|
|
70
|
-
requestAnimationFrame(updateScrollDirection)
|
|
71
|
-
ticking = true
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
window.addEventListener('scroll', handleScroll)
|
|
76
|
-
return () => window.removeEventListener('scroll', handleScroll)
|
|
77
|
-
}, [scrollY])
|
|
78
|
-
|
|
79
|
-
return { scrollDirection, scrollY }
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function useScrollToElement() {
|
|
83
|
-
const scrollToElement = (elementId: string, offset: number = 0) => {
|
|
84
|
-
const element = document.getElementById(elementId)
|
|
85
|
-
if (element) {
|
|
86
|
-
const elementPosition = element.offsetTop - offset
|
|
87
|
-
window.scrollTo({
|
|
88
|
-
top: elementPosition,
|
|
89
|
-
behavior: 'smooth'
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return { scrollToElement }
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
interface UseInfiniteScrollOptions {
|
|
98
|
-
threshold?: number
|
|
99
|
-
rootMargin?: string
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export function useInfiniteScroll(
|
|
103
|
-
callback: () => void,
|
|
104
|
-
options: UseInfiniteScrollOptions = {}
|
|
105
|
-
) {
|
|
106
|
-
const ref = useRef<HTMLElement>(null)
|
|
107
|
-
const isInView = useInView(ref, {
|
|
108
|
-
amount: options.threshold || 0.1,
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
if (isInView) {
|
|
113
|
-
callback()
|
|
114
|
-
}
|
|
115
|
-
}, [isInView, callback])
|
|
116
|
-
|
|
117
|
-
return ref
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export function useScrollBasedScale() {
|
|
121
|
-
const ref = useRef<HTMLElement>(null)
|
|
122
|
-
const { scrollYProgress } = useScroll({
|
|
123
|
-
target: ref,
|
|
124
|
-
offset: ['start end', 'end start']
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
const scale = useTransform(scrollYProgress, [0, 0.5, 1], [0.8, 1, 0.8])
|
|
128
|
-
const opacity = useTransform(scrollYProgress, [0, 0.2, 0.8, 1], [0, 1, 1, 0])
|
|
129
|
-
|
|
130
|
-
return { ref, scale, opacity }
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export function useScrollBasedRotation() {
|
|
134
|
-
const ref = useRef<HTMLElement>(null)
|
|
135
|
-
const { scrollYProgress } = useScroll({
|
|
136
|
-
target: ref,
|
|
137
|
-
offset: ['start end', 'end start']
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
const rotate = useTransform(scrollYProgress, [0, 1], [0, 360])
|
|
141
|
-
|
|
142
|
-
return { ref, rotate }
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export function useScrollTriggeredCounter(
|
|
146
|
-
endValue: number,
|
|
147
|
-
duration: number = 2000
|
|
148
|
-
) {
|
|
149
|
-
const [count, setCount] = useState(0)
|
|
150
|
-
const [isVisible, setIsVisible] = useState(false)
|
|
151
|
-
const ref = useRef<HTMLElement>(null)
|
|
152
|
-
|
|
153
|
-
const isInView = useInView(ref, {
|
|
154
|
-
amount: 0.5,
|
|
155
|
-
once: true
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
useEffect(() => {
|
|
159
|
-
if (isInView && !isVisible) {
|
|
160
|
-
setIsVisible(true)
|
|
161
|
-
let startTime: number
|
|
162
|
-
|
|
163
|
-
const animate = (currentTime: number) => {
|
|
164
|
-
if (!startTime) startTime = currentTime
|
|
165
|
-
const elapsed = currentTime - startTime
|
|
166
|
-
const progress = Math.min(elapsed / duration, 1)
|
|
167
|
-
|
|
168
|
-
// Easing function for smooth animation
|
|
169
|
-
const easeOutQuart = 1 - Math.pow(1 - progress, 4)
|
|
170
|
-
setCount(Math.floor(easeOutQuart * endValue))
|
|
171
|
-
|
|
172
|
-
if (progress < 1) {
|
|
173
|
-
requestAnimationFrame(animate)
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
requestAnimationFrame(animate)
|
|
178
|
-
}
|
|
179
|
-
}, [isInView, endValue, duration, isVisible])
|
|
180
|
-
|
|
181
|
-
return { ref, count }
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export function useScrollBasedBlur() {
|
|
185
|
-
const { scrollY } = useScroll()
|
|
186
|
-
const blur = useTransform(scrollY, [0, 300], [0, 10])
|
|
187
|
-
|
|
188
|
-
return blur
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export function useScrollSnapPoints(snapPoints: number[]) {
|
|
192
|
-
const [currentSnap, setCurrentSnap] = useState(0)
|
|
193
|
-
|
|
194
|
-
useEffect(() => {
|
|
195
|
-
const handleScroll = () => {
|
|
196
|
-
const scrollPosition = window.scrollY
|
|
197
|
-
const closest = snapPoints.reduce((prev, curr, index) => {
|
|
198
|
-
return Math.abs(curr - scrollPosition) < Math.abs(snapPoints[prev] - scrollPosition)
|
|
199
|
-
? index
|
|
200
|
-
: prev
|
|
201
|
-
}, 0)
|
|
202
|
-
setCurrentSnap(closest)
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
window.addEventListener('scroll', handleScroll)
|
|
206
|
-
return () => window.removeEventListener('scroll', handleScroll)
|
|
207
|
-
}, [snapPoints])
|
|
208
|
-
|
|
209
|
-
const scrollToSnap = (index: number) => {
|
|
210
|
-
if (index >= 0 && index < snapPoints.length) {
|
|
211
|
-
window.scrollTo({
|
|
212
|
-
top: snapPoints[index],
|
|
213
|
-
behavior: 'smooth'
|
|
214
|
-
})
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return { currentSnap, scrollToSnap }
|
|
219
|
-
}
|
package/src/use-subscription.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useSession } from "next-auth/react";
|
|
2
|
-
|
|
3
|
-
export function useSubscription() {
|
|
4
|
-
const { data: session, status } = useSession();
|
|
5
|
-
|
|
6
|
-
const isLoading = status === "loading";
|
|
7
|
-
const isAuthenticated = status === "authenticated";
|
|
8
|
-
|
|
9
|
-
// Admin kullanıcılar her zaman pro erişime sahip
|
|
10
|
-
const isAdmin = session?.user?.role === "admin";
|
|
11
|
-
|
|
12
|
-
// Pro abonelik kontrolü
|
|
13
|
-
const hasProAccess = isAdmin || session?.user?.subscription?.status === "active";
|
|
14
|
-
const subscriptionPlan = session?.user?.subscription?.plan || (isAdmin ? "lifetime" : "free");
|
|
15
|
-
|
|
16
|
-
// Debug bilgisi
|
|
17
|
-
if (process.env.NODE_ENV === 'development') {
|
|
18
|
-
console.log('🔍 useSubscription Debug:', {
|
|
19
|
-
email: session?.user?.email,
|
|
20
|
-
role: session?.user?.role,
|
|
21
|
-
isAdmin,
|
|
22
|
-
subscription: session?.user?.subscription,
|
|
23
|
-
hasProAccess,
|
|
24
|
-
subscriptionPlan,
|
|
25
|
-
status
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
isLoading,
|
|
31
|
-
isAuthenticated,
|
|
32
|
-
isAdmin,
|
|
33
|
-
hasProAccess,
|
|
34
|
-
subscriptionPlan,
|
|
35
|
-
subscription: session?.user?.subscription,
|
|
36
|
-
};
|
|
37
|
-
}
|
package/src/use-toast.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Toast hook - şimdilik basit bir implementasyon
|
|
2
|
-
// Gerçek implementasyonda Toaster component'i ile entegre olacak
|
|
3
|
-
|
|
4
|
-
interface ToastOptions {
|
|
5
|
-
title: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
variant?: 'default' | 'destructive';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function toast(options: ToastOptions) {
|
|
11
|
-
// Şimdilik console'a yazdıralım
|
|
12
|
-
// Gerçek implementasyonda toast notification gösterilecek
|
|
13
|
-
console.log('Toast:', options);
|
|
14
|
-
|
|
15
|
-
// Browser'da alert gösterelim (geçici çözüm)
|
|
16
|
-
if (typeof window !== 'undefined') {
|
|
17
|
-
const message = options.description
|
|
18
|
-
? `${options.title}\n\n${options.description}`
|
|
19
|
-
: options.title;
|
|
20
|
-
|
|
21
|
-
// Variant'a göre stil belirle
|
|
22
|
-
if (options.variant === 'destructive') {
|
|
23
|
-
console.error(message);
|
|
24
|
-
} else {
|
|
25
|
-
console.log(message);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const useToast = () => {
|
|
31
|
-
return { toast };
|
|
32
|
-
};
|