@m5kdev/web-ui 0.1.0
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/LICENSE +621 -0
- package/README.md +17 -0
- package/package.json +169 -0
- package/src/animations/card.motion.ts +9 -0
- package/src/components/AvatarUpload.tsx +133 -0
- package/src/components/Button.tsx +14 -0
- package/src/components/Calendar.css +684 -0
- package/src/components/Calendar.tsx +32 -0
- package/src/components/CardsSelect.tsx +155 -0
- package/src/components/CollapsibleSidebarMenuItem.tsx +57 -0
- package/src/components/ColorPicker.tsx +56 -0
- package/src/components/CopyButton.tsx +45 -0
- package/src/components/CropDialog.tsx +154 -0
- package/src/components/DialogProvider.tsx +105 -0
- package/src/components/ErrorFallback.tsx +17 -0
- package/src/components/FileDropzone.tsx +120 -0
- package/src/components/MultiSelectDropdown.tsx +233 -0
- package/src/components/Orb.tsx +288 -0
- package/src/components/PageAlert.tsx +121 -0
- package/src/components/SelectChips.tsx +40 -0
- package/src/components/SidebarItem.tsx +26 -0
- package/src/components/Steps.tsx +340 -0
- package/src/components/TablerIconPicker.tsx +4260 -0
- package/src/components/app-header.tsx +40 -0
- package/src/components/blur-card.tsx +132 -0
- package/src/components/features-section-demo-1.tsx +127 -0
- package/src/components/features-section-demo-2.tsx +102 -0
- package/src/components/features-section-demo-3.tsx +272 -0
- package/src/components/mode-toggle.tsx +31 -0
- package/src/components/nav-main.tsx +69 -0
- package/src/components/pricing-cards.tsx +133 -0
- package/src/components/shared/ButtonCopy.tsx +50 -0
- package/src/components/team-switcher.tsx +83 -0
- package/src/components/theme-provider.tsx +74 -0
- package/src/components/typewriter.tsx +90 -0
- package/src/components/ui/alert-dialog.tsx +133 -0
- package/src/components/ui/alert.tsx +60 -0
- package/src/components/ui/avatar.tsx +47 -0
- package/src/components/ui/badge.tsx +33 -0
- package/src/components/ui/bento-grid.tsx +54 -0
- package/src/components/ui/bento-grid2.tsx +66 -0
- package/src/components/ui/breadcrumb.tsx +101 -0
- package/src/components/ui/button.tsx +50 -0
- package/src/components/ui/card.tsx +55 -0
- package/src/components/ui/checkbox.tsx +26 -0
- package/src/components/ui/collapsible.tsx +9 -0
- package/src/components/ui/dialog.tsx +119 -0
- package/src/components/ui/dropdown-menu.tsx +186 -0
- package/src/components/ui/floating-navbar.tsx +78 -0
- package/src/components/ui/form.tsx +167 -0
- package/src/components/ui/image.tsx +55 -0
- package/src/components/ui/input.tsx +22 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/pagination.tsx +105 -0
- package/src/components/ui/progress.tsx +23 -0
- package/src/components/ui/resizable-navbar.tsx +260 -0
- package/src/components/ui/segment-control.tsx +143 -0
- package/src/components/ui/select.tsx +153 -0
- package/src/components/ui/separator.tsx +24 -0
- package/src/components/ui/sheet.tsx +121 -0
- package/src/components/ui/sidebar.tsx +736 -0
- package/src/components/ui/skeleton.tsx +7 -0
- package/src/components/ui/slider.tsx +23 -0
- package/src/components/ui/sonner.tsx +27 -0
- package/src/components/ui/spinner.tsx +45 -0
- package/src/components/ui/switch.tsx +27 -0
- package/src/components/ui/table.tsx +90 -0
- package/src/components/ui/tabs.tsx +52 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/timeline.tsx +95 -0
- package/src/components/ui/toast.tsx +126 -0
- package/src/components/ui/tooltip.tsx +55 -0
- package/src/components/ui/typewriter-effect.tsx +181 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/hooks/useDialog.ts +25 -0
- package/src/icons/GoogleIcon.tsx +32 -0
- package/src/icons/LinkedInIcon.tsx +30 -0
- package/src/icons/MicrosoftIcon.tsx +21 -0
- package/src/lib/chatwoot.ts +51 -0
- package/src/lib/utils.ts +6 -0
- package/src/modules/app/components/AppLoader.tsx +9 -0
- package/src/modules/app/components/AppShell.tsx +21 -0
- package/src/modules/app/components/AppSidebar.tsx +26 -0
- package/src/modules/app/components/AppSidebarContent.tsx +73 -0
- package/src/modules/app/components/AppSidebarHeader.tsx +57 -0
- package/src/modules/app/components/AppSidebarInvites.tsx +32 -0
- package/src/modules/app/components/AppSidebarUser.tsx +128 -0
- package/src/modules/auth/components/AdminUserManagement.tsx +1136 -0
- package/src/modules/auth/components/AdminWaitlist.tsx +358 -0
- package/src/modules/auth/components/AuthLayout.tsx +13 -0
- package/src/modules/auth/components/AuthProviders.tsx +105 -0
- package/src/modules/auth/components/AuthRouter.tsx +29 -0
- package/src/modules/auth/components/ClaimAccountRoute.tsx +242 -0
- package/src/modules/auth/components/ErrorAuthRoute.tsx +121 -0
- package/src/modules/auth/components/ForgotPasswordForm.tsx +58 -0
- package/src/modules/auth/components/ForgotPasswordRoute.tsx +27 -0
- package/src/modules/auth/components/InviteFriends.tsx +273 -0
- package/src/modules/auth/components/LastUsedBadge.tsx +22 -0
- package/src/modules/auth/components/LoginForm.tsx +104 -0
- package/src/modules/auth/components/LoginRoute.tsx +31 -0
- package/src/modules/auth/components/LogoutRoute.tsx +21 -0
- package/src/modules/auth/components/OrganizationAcceptInvitationRoute.tsx +161 -0
- package/src/modules/auth/components/OrganizationMembersRoute.tsx +730 -0
- package/src/modules/auth/components/OrganizationSettingsRoute.tsx +280 -0
- package/src/modules/auth/components/OrganizationSwitcher.tsx +148 -0
- package/src/modules/auth/components/ProfileRoute.tsx +104 -0
- package/src/modules/auth/components/RangeNuqsDatePicker.tsx +365 -0
- package/src/modules/auth/components/ResetPasswordForm.tsx +103 -0
- package/src/modules/auth/components/ResetPasswordRoute.tsx +27 -0
- package/src/modules/auth/components/SignupFormRoute.tsx +189 -0
- package/src/modules/auth/components/SignupRoute.tsx +53 -0
- package/src/modules/auth/components/UserPreferences.tsx +144 -0
- package/src/modules/auth/components/WaitlistCard.tsx +78 -0
- package/src/modules/auth/components/WaitlistCodeValidation.tsx +79 -0
- package/src/modules/billing/components/BillingBetaPage.tsx +124 -0
- package/src/modules/billing/components/BillingInvoicePage.tsx +180 -0
- package/src/modules/billing/components/BillingPlanSelect.tsx +14 -0
- package/src/modules/billing/components/BillingRouter.tsx +20 -0
- package/src/modules/billing/components/BillingSinglePlanSelect.tsx +172 -0
- package/src/modules/table/components/ColumnOrderAndVisibility.tsx +127 -0
- package/src/modules/table/components/NuqsTable.tsx +396 -0
- package/src/modules/table/components/TableFiltering.tsx +520 -0
- package/src/modules/table/components/TablePagination.tsx +59 -0
- package/src/modules/table/components/table.types.ts +11 -0
- package/src/modules/table/filterTransformers.ts +323 -0
- package/src/types.ts +4 -0
- package/src/vite-env.d.ts +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@m5kdev/web-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "GPL-3.0-only",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/michalkow/m5kdev.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/michalkow/m5kdev#readme",
|
|
10
|
+
"bugs": "https://github.com/michalkow/m5kdev/issues",
|
|
11
|
+
"files": [
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@dnd-kit/core": "6.3.1",
|
|
16
|
+
"@dnd-kit/sortable": "10.0.0",
|
|
17
|
+
"@dnd-kit/utilities": "3.2.2",
|
|
18
|
+
"@heroui/react": "2.8.8",
|
|
19
|
+
"@heroui/theme": "2.4.23",
|
|
20
|
+
"@radix-ui/react-alert-dialog": "1.1.6",
|
|
21
|
+
"@radix-ui/react-avatar": "1.1.2",
|
|
22
|
+
"@radix-ui/react-checkbox": "1.1.3",
|
|
23
|
+
"@radix-ui/react-collapsible": "1.1.2",
|
|
24
|
+
"@radix-ui/react-dialog": "1.1.5",
|
|
25
|
+
"@radix-ui/react-dropdown-menu": "2.1.5",
|
|
26
|
+
"@radix-ui/react-label": "2.1.1",
|
|
27
|
+
"@radix-ui/react-progress": "1.1.1",
|
|
28
|
+
"@radix-ui/react-select": "2.1.5",
|
|
29
|
+
"@radix-ui/react-separator": "1.1.1",
|
|
30
|
+
"@radix-ui/react-slider": "1.2.3",
|
|
31
|
+
"@radix-ui/react-slot": "1.1.1",
|
|
32
|
+
"@radix-ui/react-switch": "1.1.2",
|
|
33
|
+
"@radix-ui/react-tabs": "1.1.3",
|
|
34
|
+
"@radix-ui/react-toast": "1.2.5",
|
|
35
|
+
"@radix-ui/react-tooltip": "1.1.7",
|
|
36
|
+
"@tabler/icons-react": "3.31.0",
|
|
37
|
+
"@tanstack/react-table": "8.21.2",
|
|
38
|
+
"@uiw/color-convert": "2.7.3",
|
|
39
|
+
"@uiw/react-color-colorful": "2.7.3",
|
|
40
|
+
"class-variance-authority": "0.7.1",
|
|
41
|
+
"clsx": "2.1.1",
|
|
42
|
+
"cobe": "0.6.3",
|
|
43
|
+
"dayjs": "1.11.19",
|
|
44
|
+
"chart.js": "4.4.0",
|
|
45
|
+
"luxon": "3.7.1",
|
|
46
|
+
"dicons": "1.1.7",
|
|
47
|
+
"@internationalized/date": "3.8.2",
|
|
48
|
+
"framer-motion": "12.23.12",
|
|
49
|
+
"lucide-react": "0.488.0",
|
|
50
|
+
"motion": "12.11.3",
|
|
51
|
+
"next-themes": "0.4.4",
|
|
52
|
+
"ogl": "1.0.11",
|
|
53
|
+
"nuqs": "2.4.3",
|
|
54
|
+
"posthog-js": "1.258.2",
|
|
55
|
+
"react": "19.2.1",
|
|
56
|
+
"react-big-calendar": "1.19.4",
|
|
57
|
+
"react-chartjs-2": "5.3.1",
|
|
58
|
+
"react-dom": "19.2.1",
|
|
59
|
+
"react-dropzone": "14.3.8",
|
|
60
|
+
"react-easy-crop": "5.5.0",
|
|
61
|
+
"react-hook-form": "7.61.1",
|
|
62
|
+
"react-i18next": "15.6.1",
|
|
63
|
+
"react-router": "7.10.1",
|
|
64
|
+
"sonner": "1.7.4",
|
|
65
|
+
"tailwind-merge": "^3.0.1",
|
|
66
|
+
"tailwindcss-animate": "1.0.7",
|
|
67
|
+
"zod": "4.2.1",
|
|
68
|
+
"@tanstack/react-query": "5.83.0",
|
|
69
|
+
"@trpc/tanstack-react-query": "11.4.3"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@trpc/server": "11.4.3",
|
|
73
|
+
"@types/luxon": "3.7.1",
|
|
74
|
+
"@types/react": "19.2.7",
|
|
75
|
+
"@types/react-big-calendar": "1.16.3",
|
|
76
|
+
"@types/react-dom": "19.2.3",
|
|
77
|
+
"globals": "16.3.0",
|
|
78
|
+
"vite": "7.0.4",
|
|
79
|
+
"@m5kdev/backend": "0.1.0",
|
|
80
|
+
"@m5kdev/commons": "0.1.0",
|
|
81
|
+
"@m5kdev/frontend": "0.1.0",
|
|
82
|
+
"@m5kdev/config": "0.0.0"
|
|
83
|
+
},
|
|
84
|
+
"imports": {
|
|
85
|
+
"#components/*": "./src/components/*.tsx",
|
|
86
|
+
"#components/ui/*": "./src/components/ui/*.tsx",
|
|
87
|
+
"#components/shared/*": "./src/components/ui/shared/*.tsx",
|
|
88
|
+
"#animations/*": "./src/animations/*.ts",
|
|
89
|
+
"#modules/auth/components/*": "./src/modules/auth/components/*.tsx",
|
|
90
|
+
"#modules/auth/types": "./src/modules/auth/types.ts",
|
|
91
|
+
"#modules/billing/components/*": "./src/modules/billing/components/*.tsx",
|
|
92
|
+
"#modules/app/components/*": "./src/modules/app/components/*.tsx",
|
|
93
|
+
"#icons/*": "./src/icons/*.tsx",
|
|
94
|
+
"#modules/charts/components/*": "./src/modules/charts/components/*.tsx",
|
|
95
|
+
"#modules/table/components/*": "./src/modules/table/components/*.tsx",
|
|
96
|
+
"#hooks/*": "./src/hooks/*.ts",
|
|
97
|
+
"#utils": "./src/lib/utils.ts",
|
|
98
|
+
"#lib/*": "./src/lib/*.ts",
|
|
99
|
+
"#types": "./src/types.ts"
|
|
100
|
+
},
|
|
101
|
+
"exports": {
|
|
102
|
+
"./components/*": {
|
|
103
|
+
"types": "./dist/src/components/*.d.ts",
|
|
104
|
+
"default": "./dist/src/components/*.js"
|
|
105
|
+
},
|
|
106
|
+
"./components/ui/*": {
|
|
107
|
+
"types": "./dist/src/components/ui/*.d.ts",
|
|
108
|
+
"default": "./dist/src/components/ui/*.js"
|
|
109
|
+
},
|
|
110
|
+
"./components/shared/*": {
|
|
111
|
+
"types": "./dist/src/components/ui/shared/*.d.ts",
|
|
112
|
+
"default": "./dist/src/components/ui/shared/*.js"
|
|
113
|
+
},
|
|
114
|
+
"./animations/*": {
|
|
115
|
+
"types": "./dist/src/animations/*.d.ts",
|
|
116
|
+
"default": "./dist/src/animations/*.js"
|
|
117
|
+
},
|
|
118
|
+
"./modules/auth/components/*": {
|
|
119
|
+
"types": "./dist/src/modules/auth/components/*.d.ts",
|
|
120
|
+
"default": "./dist/src/modules/auth/components/*.js"
|
|
121
|
+
},
|
|
122
|
+
"./modules/auth/types": {
|
|
123
|
+
"types": "./dist/src/modules/auth/types.d.ts",
|
|
124
|
+
"default": "./dist/src/modules/auth/types.js"
|
|
125
|
+
},
|
|
126
|
+
"./modules/billing/components/*": {
|
|
127
|
+
"types": "./dist/src/modules/billing/components/*.d.ts",
|
|
128
|
+
"default": "./dist/src/modules/billing/components/*.js"
|
|
129
|
+
},
|
|
130
|
+
"./modules/app/components/*": {
|
|
131
|
+
"types": "./dist/src/modules/app/components/*.d.ts",
|
|
132
|
+
"default": "./dist/src/modules/app/components/*.js"
|
|
133
|
+
},
|
|
134
|
+
"./modules/charts/components/*": {
|
|
135
|
+
"types": "./dist/src/modules/charts/components/*.d.ts",
|
|
136
|
+
"default": "./dist/src/modules/charts/components/*.js"
|
|
137
|
+
},
|
|
138
|
+
"./modules/table/components/*": {
|
|
139
|
+
"types": "./dist/src/modules/table/components/*.d.ts",
|
|
140
|
+
"default": "./dist/src/modules/table/components/*.js"
|
|
141
|
+
},
|
|
142
|
+
"./modules/table/filterTransformers": {
|
|
143
|
+
"types": "./dist/src/modules/table/filterTransformers.d.ts",
|
|
144
|
+
"default": "./dist/src/modules/table/filterTransformers.js"
|
|
145
|
+
},
|
|
146
|
+
"./hooks/*": {
|
|
147
|
+
"types": "./dist/src/hooks/*.d.ts",
|
|
148
|
+
"default": "./dist/src/hooks/*.js"
|
|
149
|
+
},
|
|
150
|
+
"./icons/*": {
|
|
151
|
+
"types": "./dist/src/icons/*.d.ts",
|
|
152
|
+
"default": "./dist/src/icons/*.js"
|
|
153
|
+
},
|
|
154
|
+
"./utils": {
|
|
155
|
+
"types": "./dist/src/lib/utils.d.ts",
|
|
156
|
+
"default": "./dist/src/lib/utils.js"
|
|
157
|
+
},
|
|
158
|
+
"./lib/*": {
|
|
159
|
+
"types": "./dist/src/lib/*.d.ts",
|
|
160
|
+
"default": "./dist/src/lib/*.js"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"scripts": {
|
|
164
|
+
"lint": "biome check .",
|
|
165
|
+
"lint:fix": "biome check . --write",
|
|
166
|
+
"check-types": "tsc --noEmit",
|
|
167
|
+
"build": "tsc --build"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MotionNodeOptions } from "framer-motion";
|
|
2
|
+
|
|
3
|
+
export const cardMotion: Partial<MotionNodeOptions> = {
|
|
4
|
+
layout: true,
|
|
5
|
+
initial: { opacity: 0, scale: 0.98 },
|
|
6
|
+
animate: { opacity: 1, scale: 1 },
|
|
7
|
+
exit: { opacity: 0, scale: 0.98, transition: { duration: 0.12 } },
|
|
8
|
+
transition: { type: "spring", stiffness: 160, damping: 28 },
|
|
9
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { useFileUpload } from "@m5kdev/frontend/modules/file/hooks/useUpload";
|
|
2
|
+
import { Edit2, User } from "lucide-react";
|
|
3
|
+
import { type ChangeEvent, useRef, useState } from "react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { CropDialog } from "#components/CropDialog";
|
|
6
|
+
import { Avatar, AvatarFallback, AvatarImage } from "#components/ui/avatar";
|
|
7
|
+
import { Progress } from "#components/ui/progress";
|
|
8
|
+
import { cn } from "#utils";
|
|
9
|
+
|
|
10
|
+
interface AvatarUploadProps {
|
|
11
|
+
currentAvatarUrl?: string | null;
|
|
12
|
+
onUploadComplete?: (avatarUrl: string) => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function AvatarUpload({ currentAvatarUrl, onUploadComplete, className }: AvatarUploadProps) {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
19
|
+
const [selectedFile, setSelectedFile] = useState<File | null>(null);
|
|
20
|
+
const [previewUrl, setPreviewUrl] = useState<string | null>(currentAvatarUrl || null);
|
|
21
|
+
const [showCropDialog, setShowCropDialog] = useState(false);
|
|
22
|
+
|
|
23
|
+
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
24
|
+
const { upload, status, progress, errorMessage, reset } = useFileUpload();
|
|
25
|
+
|
|
26
|
+
const handleFileSelect = (event: ChangeEvent<HTMLInputElement>) => {
|
|
27
|
+
const file = event.target.files?.[0];
|
|
28
|
+
if (file) {
|
|
29
|
+
// Validate file type
|
|
30
|
+
if (!["image/jpeg", "image/png", "image/webp", "image/jpg"].includes(file.type)) {
|
|
31
|
+
alert(t("web-ui:upload.errors.invalidType"));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// Validate file size (5MB)
|
|
35
|
+
if (file.size > 5 * 1024 * 1024) {
|
|
36
|
+
alert(t("web-ui:upload.errors.tooLarge"));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
setSelectedFile(file);
|
|
40
|
+
const objectUrl = URL.createObjectURL(file);
|
|
41
|
+
setPreviewUrl(objectUrl);
|
|
42
|
+
setShowCropDialog(true);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const handleCropComplete = async (croppedBlob: Blob) => {
|
|
47
|
+
const croppedFile = new File([croppedBlob], selectedFile?.name || "cropped-image.jpg", {
|
|
48
|
+
type: "image/jpeg",
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
setSelectedFile(croppedFile);
|
|
52
|
+
const croppedObjectUrl = URL.createObjectURL(croppedFile);
|
|
53
|
+
setPreviewUrl(croppedObjectUrl);
|
|
54
|
+
setShowCropDialog(false);
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
const res = await upload<{
|
|
58
|
+
url: string;
|
|
59
|
+
minetype: string;
|
|
60
|
+
size: number;
|
|
61
|
+
}>("image", croppedFile);
|
|
62
|
+
console.log({ res });
|
|
63
|
+
onUploadComplete?.(res.url);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error("Error uploading image:", error);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const removeFile = () => {
|
|
70
|
+
if (previewUrl && previewUrl !== currentAvatarUrl) {
|
|
71
|
+
URL.revokeObjectURL(previewUrl);
|
|
72
|
+
}
|
|
73
|
+
setSelectedFile(null);
|
|
74
|
+
setPreviewUrl(currentAvatarUrl || null);
|
|
75
|
+
setShowCropDialog(false);
|
|
76
|
+
reset();
|
|
77
|
+
if (fileInputRef.current) {
|
|
78
|
+
fileInputRef.current.value = "";
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
<div
|
|
85
|
+
role="dialog"
|
|
86
|
+
className={cn("relative inline-block", className)}
|
|
87
|
+
onMouseEnter={() => setIsHovered(true)}
|
|
88
|
+
onMouseLeave={() => setIsHovered(false)}
|
|
89
|
+
>
|
|
90
|
+
<Avatar className="h-24 w-24 cursor-pointer" onClick={() => fileInputRef.current?.click()}>
|
|
91
|
+
{previewUrl ? (
|
|
92
|
+
<AvatarImage src={previewUrl} alt={t("web-ui:avatar.preview.alt")} />
|
|
93
|
+
) : (
|
|
94
|
+
<AvatarFallback>
|
|
95
|
+
<User className="h-12 w-12" />
|
|
96
|
+
</AvatarFallback>
|
|
97
|
+
)}
|
|
98
|
+
{isHovered && (
|
|
99
|
+
<div className="absolute inset-0 flex items-center justify-center bg-black/50 rounded-full">
|
|
100
|
+
<Edit2 className="h-6 w-6 text-white" />
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
</Avatar>
|
|
104
|
+
|
|
105
|
+
<input
|
|
106
|
+
ref={fileInputRef}
|
|
107
|
+
type="file"
|
|
108
|
+
className="hidden"
|
|
109
|
+
accept="image/jpeg,image/png,image/webp"
|
|
110
|
+
onChange={handleFileSelect}
|
|
111
|
+
/>
|
|
112
|
+
|
|
113
|
+
{status === "uploading" && (
|
|
114
|
+
<div className="mt-2 w-full">
|
|
115
|
+
<Progress value={progress} className="h-2" />
|
|
116
|
+
</div>
|
|
117
|
+
)}
|
|
118
|
+
{status === "error" && <p className="mt-2 text-sm text-red-500">{errorMessage}</p>}
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
{previewUrl && (
|
|
122
|
+
<CropDialog
|
|
123
|
+
open={showCropDialog}
|
|
124
|
+
onOpenChange={setShowCropDialog}
|
|
125
|
+
imageUrl={previewUrl}
|
|
126
|
+
onCropComplete={handleCropComplete}
|
|
127
|
+
onCancel={removeFile}
|
|
128
|
+
isLoading={status === "uploading"}
|
|
129
|
+
/>
|
|
130
|
+
)}
|
|
131
|
+
</>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Button as ButtonPrimitive, type ButtonProps as ButtonPrimitiveProps } from "./ui/button";
|
|
2
|
+
|
|
3
|
+
export interface ButtonProps extends ButtonPrimitiveProps {
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function Button({ loading, children, ...props }: ButtonProps) {
|
|
8
|
+
return (
|
|
9
|
+
<ButtonPrimitive {...props} disabled={loading || props.disabled}>
|
|
10
|
+
{loading && <i className="ti ti-refresh animate-spin" />}
|
|
11
|
+
{children}
|
|
12
|
+
</ButtonPrimitive>
|
|
13
|
+
);
|
|
14
|
+
}
|