@betterstart/cli 0.1.46 → 0.1.48
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/cli.js +73 -11
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/templates/ui/media-upload-field.tsx +18 -4
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useUpload } from '@cms/hooks/use-upload'
|
|
4
4
|
import { cn } from '@cms/utils/cn'
|
|
5
|
-
import { Loader2, Upload, X } from 'lucide-react'
|
|
5
|
+
import { FileText, Loader2, Upload, X } from 'lucide-react'
|
|
6
6
|
import * as React from 'react'
|
|
7
7
|
import { toast } from 'sonner'
|
|
8
8
|
import { Button } from './button'
|
|
@@ -76,7 +76,11 @@ export function MediaUploadField({
|
|
|
76
76
|
validationConfig: {
|
|
77
77
|
maxSizeInBytes: maxSizeInMB * 1024 * 1024,
|
|
78
78
|
allowedTypes:
|
|
79
|
-
accept === 'image/*,video/*'
|
|
79
|
+
accept === 'image/*,video/*'
|
|
80
|
+
? MEDIA_TYPES
|
|
81
|
+
: accept === '*/*' || accept === '*'
|
|
82
|
+
? undefined
|
|
83
|
+
: accept.split(',').map((t) => t.trim()),
|
|
80
84
|
maxFiles: 1
|
|
81
85
|
},
|
|
82
86
|
onSuccess: (result) => {
|
|
@@ -178,12 +182,22 @@ export function MediaUploadField({
|
|
|
178
182
|
>
|
|
179
183
|
<track kind="captions" />
|
|
180
184
|
</video>
|
|
181
|
-
) : (
|
|
185
|
+
) : mediaType === 'image' ? (
|
|
182
186
|
<img
|
|
183
187
|
src={previewUrl}
|
|
184
188
|
alt="Preview"
|
|
185
189
|
className="w-full h-auto max-h-40 object-contain"
|
|
186
190
|
/>
|
|
191
|
+
) : (
|
|
192
|
+
<div className="flex items-center gap-3 p-4">
|
|
193
|
+
<FileText className="size-8 text-muted-foreground shrink-0" />
|
|
194
|
+
<div className="min-w-0 flex-1">
|
|
195
|
+
<p className="text-sm font-medium truncate">
|
|
196
|
+
{previewUrl.split('/').pop()?.split('?')[0] || 'Uploaded file'}
|
|
197
|
+
</p>
|
|
198
|
+
<p className="text-xs text-muted-foreground">File uploaded</p>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
187
201
|
)}
|
|
188
202
|
|
|
189
203
|
{/* Upload Progress Overlay */}
|
|
@@ -233,7 +247,7 @@ export function MediaUploadField({
|
|
|
233
247
|
<Upload className="size-6 text-primary" />
|
|
234
248
|
</div>
|
|
235
249
|
<div className="text-center">
|
|
236
|
-
<p className="text-sm font-medium">Click to upload
|
|
250
|
+
<p className="text-sm font-medium">Click to upload a file</p>
|
|
237
251
|
<p className="text-xs text-muted-foreground mt-1">Max size: {maxSizeInMB}MB</p>
|
|
238
252
|
</div>
|
|
239
253
|
</>
|