"use client"

import { useEffect } from "react"
import { SUITE_TITLE_SEP } from "@/lib/suite/page-metadata"

export function useDriveDocumentTitle(titleSegment: string) {
  useEffect(() => {
    const trimmed = titleSegment.trim()
    if (!trimmed) return
    const previous = document.title
    document.title = `${trimmed}${SUITE_TITLE_SEP}UltiDrive`
    return () => {
      document.title = previous
    }
  }, [titleSegment])
}
