Skip to content

Commit 8d67a83

Browse files
authored
Merge pull request #14 from venu123143/notification_popup
share files changes
2 parents d72a02e + c0c1c87 commit 8d67a83

File tree

7 files changed

+179
-249
lines changed

7 files changed

+179
-249
lines changed

src/components/file-manager/ShareFileModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function ShareFileModal({
5151
page: 1,
5252
limit: 20,
5353
is_active: true,
54-
email_verified: true
54+
email_verified: false
5555
})
5656
setUsers(Array.isArray(result) ? result : [])
5757
setShowDropdown(true)

src/components/settings/settings-content.tsx

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import { useTheme } from "@/contexts/ThemeContext"
1313
import {
1414
User,
1515
Shield,
16-
Bell,
17-
Smartphone,
1816
HardDrive,
1917
Lock,
2018
Eye,
@@ -420,82 +418,6 @@ export function SettingsContent({ activeTab }: SettingsContentProps) {
420418
</motion.div>
421419
)
422420

423-
const renderNotificationsTab = () => (
424-
<motion.div
425-
key="notifications"
426-
initial={{ opacity: 0, y: 20 }}
427-
animate={{ opacity: 1, y: 0 }}
428-
exit={{ opacity: 0, y: -20 }}
429-
transition={{ duration: 0.3 }}
430-
className="space-y-6"
431-
>
432-
{/* Email Notifications */}
433-
<Card>
434-
<CardHeader>
435-
<CardTitle className="flex items-center gap-2">
436-
<Bell className="h-5 w-5" />
437-
Email Notifications
438-
</CardTitle>
439-
<CardDescription>
440-
Choose which emails you want to receive
441-
</CardDescription>
442-
</CardHeader>
443-
<CardContent className="space-y-4">
444-
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
445-
<div className="space-y-0.5">
446-
<Label>Security Alerts</Label>
447-
<p className="text-sm text-muted-foreground">Get notified about security events</p>
448-
</div>
449-
<Switch defaultChecked />
450-
</div>
451-
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
452-
<div className="space-y-0.5">
453-
<Label>Storage Updates</Label>
454-
<p className="text-sm text-muted-foreground">Receive storage usage notifications</p>
455-
</div>
456-
<Switch defaultChecked />
457-
</div>
458-
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
459-
<div className="space-y-0.5">
460-
<Label>Product Updates</Label>
461-
<p className="text-sm text-muted-foreground">Stay informed about new features</p>
462-
</div>
463-
<Switch />
464-
</div>
465-
</CardContent>
466-
</Card>
467-
468-
{/* Push Notifications */}
469-
<Card>
470-
<CardHeader>
471-
<CardTitle className="flex items-center gap-2">
472-
<Smartphone className="h-5 w-5" />
473-
Push Notifications
474-
</CardTitle>
475-
<CardDescription>
476-
Manage notifications on your devices
477-
</CardDescription>
478-
</CardHeader>
479-
<CardContent className="space-y-4">
480-
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
481-
<div className="space-y-0.5">
482-
<Label>File Sharing</Label>
483-
<p className="text-sm text-muted-foreground">When someone shares files with you</p>
484-
</div>
485-
<Switch defaultChecked />
486-
</div>
487-
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
488-
<div className="space-y-0.5">
489-
<Label>Storage Warnings</Label>
490-
<p className="text-sm text-muted-foreground">When approaching storage limits</p>
491-
</div>
492-
<Switch defaultChecked />
493-
</div>
494-
</CardContent>
495-
</Card>
496-
</motion.div>
497-
)
498-
499421
const renderPinTab = () => {
500422
const hasPin = user?.pin_hash
501423

@@ -726,8 +648,6 @@ export function SettingsContent({ activeTab }: SettingsContentProps) {
726648
return renderSecurityTab()
727649
case "pin":
728650
return renderPinTab()
729-
case "notifications":
730-
return renderNotificationsTab()
731651
case "api-token":
732652
return renderApiTokenTab()
733653
default:

src/components/settings/settings-tabs.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const tabs = [
77
{ id: "general", label: "General" },
88
{ id: "security", label: "Security" },
99
{ id: "pin", label: "PIN" },
10-
{ id: "notifications", label: "Notifications" },
1110
{ id: "api-token", label: "API Token" },
1211
]
1312

src/lib/utils.ts

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { clsx, type ClassValue } from "clsx"
22
import { twMerge } from "tailwind-merge"
3-
import type { FileSystemNode } from "@/types/file.types"
4-
import type { StandardFileItem, DeletedFileItem, PrivateFileItem } from "@/types/file-manager"
3+
import type { FileSystemNode, SharedFileSystemNode } from "@/types/file.types"
4+
import type { StandardFileItem, DeletedFileItem, PrivateFileItem, SharedFileItem } from "@/types/file-manager"
55
import {
66
FileText,
77
FolderIcon,
@@ -192,4 +192,52 @@ export function transformFileSystemNodeToPrivateFileItem(node: FileSystemNode, p
192192
// Transform FileSystemNode array to PrivateFileItem array
193193
export function transformFileSystemNodesToPrivateFileItems(nodes: FileSystemNode[]): PrivateFileItem[] {
194194
return nodes.map(node => transformFileSystemNodeToPrivateFileItem(node))
195+
}
196+
197+
// Transform SharedFileSystemNode to SharedFileItem
198+
export function transformSharedFileSystemNodeToSharedFileItem(node: SharedFileSystemNode, parentPath: string[] = []): SharedFileItem {
199+
const isFolder = node.is_folder
200+
const fileType = node.file_info?.file_type || null
201+
const size = node.file_info?.file_size || 0
202+
const thumbnail = node.file_info?.thumbnail_path || null
203+
204+
// Handle potential null updated_at
205+
const modifiedDate = node.updated_at || node.created_at
206+
207+
return {
208+
id: node.id,
209+
name: node.name,
210+
type: isFolder ? "folder" : "file",
211+
fileType: isFolder ? "folder" : getFileTypeCategory(fileType),
212+
size: formatFileSize(size),
213+
modified: formatRelativeTime(modifiedDate),
214+
icon: isFolder ? FolderIcon : getFileIcon(fileType),
215+
thumbnail,
216+
file_info: node.file_info || undefined,
217+
starred: false, // This would need to be fetched from favorites API
218+
shared: true,
219+
parentPath,
220+
variant: "shared",
221+
sharedBy: {
222+
name: node.shared_by_user?.display_name || "Unknown",
223+
avatar: node.shared_by_user?.avatar_url || null,
224+
initials: (node.shared_by_user?.display_name || "U").charAt(0).toUpperCase(),
225+
},
226+
sharedWith: [
227+
{
228+
name: node.shared_with_user?.display_name || "Unknown",
229+
avatar: node.shared_with_user?.avatar_url || null,
230+
initials: (node.shared_with_user?.display_name || "U").charAt(0).toUpperCase(),
231+
}
232+
],
233+
permission: (node.permission_level as "view" | "edit" | "admin") || "view",
234+
sharedDate: formatRelativeTime(node.share_created_at),
235+
isOwner: false, // This will be overridden in the page component based on current user
236+
children: node.children ? node.children.map((child: SharedFileSystemNode) => transformSharedFileSystemNodeToSharedFileItem(child, [...parentPath, node.name])) : undefined,
237+
}
238+
}
239+
240+
// Transform SharedFileSystemNode array to SharedFileItem array
241+
export function transformSharedFileSystemNodesToSharedFileItems(nodes: SharedFileSystemNode[]): SharedFileItem[] {
242+
return nodes.map(node => transformSharedFileSystemNodeToSharedFileItem(node))
195243
}

0 commit comments

Comments
 (0)