- 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.
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
"use client"
|
|
|
|
import { useEffect } from "react"
|
|
import { useQueryClient } from "@tanstack/react-query"
|
|
import { useMailRoute } from "@/hooks/use-mail-route"
|
|
import { useMessage } from "@/lib/api/hooks/use-mail-queries"
|
|
import type { ApiMessageSummary } from "@/lib/api/types"
|
|
import { mailDocumentTitle } from "@/lib/suite/page-metadata"
|
|
|
|
function subjectFromListCache(
|
|
queryClient: ReturnType<typeof useQueryClient>,
|
|
messageId: string
|
|
): string | null {
|
|
const entries = queryClient.getQueriesData<{ data?: ApiMessageSummary[] }>({
|
|
queryKey: ["messages"],
|
|
})
|
|
for (const [, payload] of entries) {
|
|
const hit = payload?.data?.find((m) => m.id === messageId)
|
|
if (hit?.subject?.trim()) return hit.subject
|
|
}
|
|
return null
|
|
}
|
|
|
|
/** Sync tab title: « Boîte mail - Ultimail » or « Sujet… - Ultimail » when a message is open. */
|
|
export function MailDocumentTitle() {
|
|
const { route } = useMailRoute()
|
|
const queryClient = useQueryClient()
|
|
const { data: message } = useMessage(route.mailId)
|
|
|
|
useEffect(() => {
|
|
const cachedSubject = route.mailId
|
|
? subjectFromListCache(queryClient, route.mailId)
|
|
: null
|
|
const subject = message?.subject ?? cachedSubject
|
|
document.title = mailDocumentTitle(route.mailId ? subject : null)
|
|
}, [route.mailId, message?.subject, queryClient])
|
|
|
|
return null
|
|
}
|