* feat: add modal troubleshooting guideline * show app, server log and device specs from user agent * add function copy app, server log and device specs * add todo device specs * update style darkmode for modal troubleshoot * resolve inconsistent message hidden * fix: model failed to load but the server started successfully (#1971) * fix: start server success but modal load failed * add information model failed load while start server successfully
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import React from 'react'
|
|
|
|
import { Button } from '@janhq/uikit'
|
|
|
|
import { CopyIcon, CheckIcon } from 'lucide-react'
|
|
|
|
import { useClipboard } from '@/hooks/useClipboard'
|
|
|
|
// TODO @Louis help add missing information device specs
|
|
const DeviceSpecs = () => {
|
|
const userAgent = window.navigator.userAgent
|
|
const clipboard = useClipboard({ timeout: 1000 })
|
|
|
|
return (
|
|
<>
|
|
<div className="absolute -top-11 right-2">
|
|
<Button
|
|
themes="outline"
|
|
className="bg-white dark:bg-secondary/50"
|
|
onClick={() => {
|
|
clipboard.copy(userAgent ?? '')
|
|
}}
|
|
>
|
|
<div className="flex items-center space-x-2">
|
|
{clipboard.copied ? (
|
|
<>
|
|
<CheckIcon size={14} className="text-green-600" />
|
|
<span>Copying...</span>
|
|
</>
|
|
) : (
|
|
<>
|
|
<CopyIcon size={14} />
|
|
<span>Copy All</span>
|
|
</>
|
|
)}
|
|
</div>
|
|
</Button>
|
|
</div>
|
|
<div>
|
|
<p className="leading-relaxed">{userAgent}</p>
|
|
</div>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default DeviceSpecs
|