- Updated .env.example to include configuration for OnlyOffice Document Server. - Modified the workspace configuration to remove the drive-suite path. - Adjusted TypeScript environment imports for consistency. - Enhanced Next.js configuration to disable canvas in Webpack. - Updated package.json to include new dependencies for OnlyOffice and PDF.js. - Added global styles for OnlyOffice theme integration in the CSS. - Created new layout and page components for the Drive feature, including public sharing and editing functionalities. - Updated metadata handling across various layouts to reflect the new app structure.
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
"use client"
|
|
|
|
import { create } from "zustand"
|
|
import { persist } from "zustand/middleware"
|
|
import { debouncedPersistJSONStorage } from "@/lib/stores/debounced-json-storage"
|
|
|
|
export type DriveViewMode = "list" | "grid"
|
|
export type DriveSortField = "name" | "size" | "date"
|
|
export type DriveFolderPlacement = "top" | "mixed"
|
|
|
|
interface DriveSettingsState {
|
|
viewMode: DriveViewMode
|
|
sortField: DriveSortField
|
|
sortDir: "asc" | "desc"
|
|
folderPlacement: DriveFolderPlacement
|
|
setViewMode: (mode: DriveViewMode) => void
|
|
setSort: (field: DriveSortField, dir: "asc" | "desc") => void
|
|
setSortField: (field: DriveSortField) => void
|
|
setSortDir: (dir: "asc" | "desc") => void
|
|
setFolderPlacement: (placement: DriveFolderPlacement) => void
|
|
}
|
|
|
|
export const useDriveSettingsStore = create<DriveSettingsState>()(
|
|
persist(
|
|
(set) => ({
|
|
viewMode: "list",
|
|
sortField: "name",
|
|
sortDir: "asc",
|
|
folderPlacement: "top",
|
|
setViewMode: (viewMode) => set({ viewMode }),
|
|
setSort: (sortField, sortDir) => set({ sortField, sortDir }),
|
|
setSortField: (sortField) => set({ sortField }),
|
|
setSortDir: (sortDir) => set({ sortDir }),
|
|
setFolderPlacement: (folderPlacement) => set({ folderPlacement }),
|
|
}),
|
|
{
|
|
name: "ultidrive-settings",
|
|
storage: debouncedPersistJSONStorage,
|
|
merge: (persisted, current) => ({
|
|
...current,
|
|
...(persisted as Partial<DriveSettingsState>),
|
|
folderPlacement:
|
|
(persisted as Partial<DriveSettingsState>)?.folderPlacement ?? "top",
|
|
}),
|
|
}
|
|
)
|
|
)
|