Clean up unused state variables and imports
This commit is contained in:
parent
a03cf5c8ed
commit
6d65014a45
@ -1,175 +1,37 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useState, useEffect, useCallback } from "react"
|
import { useState, useEffect, useCallback } from "react"
|
||||||
import { useRouter, useSearchParams } from "next/navigation"
|
|
||||||
import { Card, CardContent } from "@/components/ui/card"
|
import { Card, CardContent } from "@/components/ui/card"
|
||||||
import { Badge } from "@/components/ui/badge"
|
import { Badge } from "@/components/ui/badge"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Input } from "@/components/ui/input"
|
import { Input } from "@/components/ui/input"
|
||||||
import { Label } from "@/components/ui/label"
|
|
||||||
import { Checkbox } from "@/components/ui/checkbox"
|
|
||||||
import { Textarea } from "@/components/ui/textarea"
|
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
|
||||||
import {
|
import {
|
||||||
Folder,
|
Folder,
|
||||||
FolderOpen,
|
|
||||||
Grid3X3,
|
|
||||||
List,
|
|
||||||
Search,
|
Search,
|
||||||
Filter,
|
|
||||||
Share2,
|
|
||||||
Trash2,
|
|
||||||
Users,
|
|
||||||
FileText,
|
|
||||||
Clock,
|
|
||||||
Star,
|
|
||||||
ChevronRight,
|
|
||||||
FolderPlus,
|
FolderPlus,
|
||||||
Upload,
|
Clock,
|
||||||
Download,
|
ChevronRight,
|
||||||
Lock,
|
|
||||||
SortAsc,
|
SortAsc,
|
||||||
SortDesc,
|
SortDesc,
|
||||||
X,
|
X,
|
||||||
UserPlus,
|
|
||||||
Crown,
|
|
||||||
Shield,
|
|
||||||
User,
|
|
||||||
CheckCircle,
|
|
||||||
XCircle,
|
|
||||||
Info,
|
|
||||||
CloudUpload,
|
|
||||||
Cloud,
|
|
||||||
HardDrive,
|
|
||||||
FileQuestion,
|
|
||||||
Timer,
|
|
||||||
ShieldCheck,
|
|
||||||
Archive,
|
|
||||||
FileCheck,
|
|
||||||
} from "lucide-react"
|
} from "lucide-react"
|
||||||
import { FolderData, FolderCreated, FolderPrivateFields, setDefaultFolderRoles } from "@/lib/4nk/models/FolderData"
|
import { FolderData, FolderCreated, FolderPrivateFields, setDefaultFolderRoles } from "@/lib/4nk/models/FolderData"
|
||||||
import MessageBus from "@/lib/4nk/MessageBus"
|
import MessageBus from "@/lib/4nk/MessageBus"
|
||||||
import { iframeUrl } from "@/app/page"
|
import { iframeUrl } from "@/app/page"
|
||||||
import UserStore from "@/lib/4nk/UserStore"
|
import UserStore from "@/lib/4nk/UserStore"
|
||||||
import EventBus from "@/lib/4nk/EventBus"
|
|
||||||
import FolderModal from "@/components/4nk/FolderModal"
|
import FolderModal from "@/components/4nk/FolderModal"
|
||||||
import AuthModal from "@/components/4nk/AuthModal"
|
import AuthModal from "@/components/4nk/AuthModal"
|
||||||
import Iframe from "@/components/4nk/Iframe"
|
import Iframe from "@/components/4nk/Iframe"
|
||||||
|
|
||||||
interface FolderData {
|
type FolderType = 'contrat' | 'projet' | 'rapport' | 'finance' | 'rh' | 'marketing' | 'autre';
|
||||||
id: number
|
|
||||||
name: string
|
|
||||||
description: string
|
|
||||||
documentsCount: number
|
|
||||||
subfoldersCount: number
|
|
||||||
size: string
|
|
||||||
created: Date
|
|
||||||
modified: Date
|
|
||||||
owner: string
|
|
||||||
access: "shared" | "private"
|
|
||||||
members: string[]
|
|
||||||
tags: string[]
|
|
||||||
color: string
|
|
||||||
favorite: boolean
|
|
||||||
storageType: "temporary" | "permanent"
|
|
||||||
status: "active" | "archived" | "pending" | "completed" | "validated"
|
|
||||||
type: string
|
|
||||||
expectedDocuments: Array<{
|
|
||||||
name: string
|
|
||||||
required: boolean
|
|
||||||
assignedRole: "owner" | "editor" | "validator" | "contributor"
|
|
||||||
status: "missing" | "pending" | "received"
|
|
||||||
}>
|
|
||||||
activity: Array<{
|
|
||||||
user: string
|
|
||||||
action: string
|
|
||||||
item: string
|
|
||||||
time: string
|
|
||||||
}>
|
|
||||||
permissions: {
|
|
||||||
canView: boolean
|
|
||||||
canEdit: boolean
|
|
||||||
canDelete: boolean
|
|
||||||
canInvite: boolean
|
|
||||||
canArchive: boolean
|
|
||||||
canAnalyze: boolean
|
|
||||||
}
|
|
||||||
temporaryStorageConfig?: {
|
|
||||||
duration: number // en jours
|
|
||||||
dataUsage: string
|
|
||||||
thirdPartyAccess: string
|
|
||||||
}
|
|
||||||
documents?: Array<{
|
|
||||||
id: string
|
|
||||||
name: string
|
|
||||||
hasCertificate: boolean
|
|
||||||
certificateId?: string
|
|
||||||
}>
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ActionModal {
|
|
||||||
type:
|
|
||||||
| "invite"
|
|
||||||
| "delete"
|
|
||||||
| "create"
|
|
||||||
| "edit"
|
|
||||||
| "archive"
|
|
||||||
| "request_document"
|
|
||||||
| "storage_config"
|
|
||||||
| "certificate"
|
|
||||||
| "documents_certificates"
|
|
||||||
| null
|
|
||||||
folder: FolderData | null
|
|
||||||
folders: FolderData[]
|
|
||||||
}
|
|
||||||
|
|
||||||
interface UserWithRoles {
|
|
||||||
id: string
|
|
||||||
name: string
|
|
||||||
email: string
|
|
||||||
avatar: string
|
|
||||||
folderRoles: {
|
|
||||||
[folderId: string]: {
|
|
||||||
role: "owner" | "editor" | "viewer" | "validator" | "contributor"
|
|
||||||
assignedDate: Date
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spaceRole: "admin" | "manager" | "user" | "guest"
|
|
||||||
spaceRoles: {
|
|
||||||
[spaceId: string]: {
|
|
||||||
role: "admin" | "manager" | "user" | "guest"
|
|
||||||
spaceName: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Role {
|
|
||||||
id: string
|
|
||||||
name: string
|
|
||||||
description: string
|
|
||||||
level: "folder" | "space" | "global"
|
|
||||||
}
|
|
||||||
|
|
||||||
type FolderType = string;
|
|
||||||
|
|
||||||
export default function FoldersPage() {
|
export default function FoldersPage() {
|
||||||
const router = useRouter()
|
|
||||||
const searchParams = useSearchParams()
|
|
||||||
const [viewMode, setViewMode] = useState<'list'>('list')
|
|
||||||
const [searchTerm, setSearchTerm] = useState("")
|
const [searchTerm, setSearchTerm] = useState("")
|
||||||
const [selectedFolders, setSelectedFolders] = useState<number[]>([])
|
const [sortBy, setSortBy] = useState("updated_at")
|
||||||
const [sortBy, setSortBy] = useState("modified")
|
|
||||||
const [sortOrder, setSortOrder] = useState<"asc" | "desc">("desc")
|
const [sortOrder, setSortOrder] = useState<"asc" | "desc">("desc")
|
||||||
const [filterAccess, setFilterAccess] = useState("all")
|
|
||||||
const [filterOwner, setFilterOwner] = useState("all")
|
|
||||||
const [filterStorage, setFilterStorage] = useState("all")
|
|
||||||
const [showFilters, setShowFilters] = useState(false)
|
|
||||||
const [currentPath, setCurrentPath] = useState<string[]>(["Racine"])
|
const [currentPath, setCurrentPath] = useState<string[]>(["Racine"])
|
||||||
const [actionModal, setActionModal] = useState<ActionModal>({ type: null, folder: null, folders: [] })
|
|
||||||
const [showCreateFolderModal, setShowCreateFolderModal] = useState(false)
|
|
||||||
const [folderType, setFolderType] = useState<FolderType | null>(null);
|
const [folderType, setFolderType] = useState<FolderType | null>(null);
|
||||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
const [menuOpen, setMenuOpen] = useState(false);
|
|
||||||
|
|
||||||
// 4NK Integration states
|
// 4NK Integration states
|
||||||
const [isConnected, setIsConnected] = useState(false)
|
const [isConnected, setIsConnected] = useState(false)
|
||||||
@ -183,26 +45,8 @@ export default function FoldersPage() {
|
|||||||
const [loadingFolders, setLoadingFolders] = useState(false)
|
const [loadingFolders, setLoadingFolders] = useState(false)
|
||||||
|
|
||||||
// Modal states
|
// Modal states
|
||||||
const [inviteMessage, setInviteMessage] = useState("")
|
|
||||||
const [selectedUser, setSelectedUser] = useState("")
|
|
||||||
const [selectedRole, setSelectedRole] = useState("")
|
|
||||||
const [inviteScope, setInviteScope] = useState<"user" | "role">("user")
|
|
||||||
const [folderName, setFolderName] = useState("")
|
|
||||||
const [folderDescription, setFolderDescription] = useState("")
|
|
||||||
const [folderColor, setFolderColor] = useState("blue")
|
|
||||||
const [folderTags, setFolderTags] = useState("")
|
|
||||||
const [folderAccess, setFolderAccess] = useState<"shared" | "private">("private")
|
|
||||||
const [archiveReason, setArchiveReason] = useState("")
|
|
||||||
const [retentionPeriod, setRetentionPeriod] = useState("5")
|
|
||||||
const [selectedDocument, setSelectedDocument] = useState("")
|
|
||||||
const [requestMessage, setRequestMessage] = useState("")
|
|
||||||
const [notification, setNotification] = useState<{ type: "success" | "error" | "info"; message: string } | null>(null)
|
const [notification, setNotification] = useState<{ type: "success" | "error" | "info"; message: string } | null>(null)
|
||||||
|
|
||||||
// Storage config modal states
|
|
||||||
const [storageDuration, setStorageDuration] = useState("30")
|
|
||||||
const [dataUsage, setDataUsage] = useState("")
|
|
||||||
const [thirdPartyAccess, setThirdPartyAccess] = useState("")
|
|
||||||
|
|
||||||
const [folders, setFolders] = useState<FolderData[]>([])
|
const [folders, setFolders] = useState<FolderData[]>([])
|
||||||
const [stats, setStats] = useState({
|
const [stats, setStats] = useState({
|
||||||
total: 0
|
total: 0
|
||||||
@ -211,7 +55,7 @@ export default function FoldersPage() {
|
|||||||
// Notification system
|
// Notification system
|
||||||
const showNotification = (type: "success" | "error" | "info", message: string) => {
|
const showNotification = (type: "success" | "error" | "info", message: string) => {
|
||||||
setNotification({ type, message })
|
setNotification({ type, message })
|
||||||
setTimeout(() => setNotification(null), 3000)
|
setTimeout(() => setNotification(null), 5000)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to fetch folder private data
|
// Function to fetch folder private data
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user