mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 13:49:00 +02:00
ddfadbc474
[web] Editor redesign: Improve badge locations for Rail buttons GitOrigin-RevId: 11eef60e6ab35003b21fa1ebf0bde4588c5f7228
36 lines
917 B
TypeScript
36 lines
917 B
TypeScript
import PdfLogsViewer from '@/features/pdf-preview/components/pdf-logs-viewer'
|
|
import { PdfPreviewProvider } from '@/features/pdf-preview/components/pdf-preview-provider'
|
|
import { useDetachCompileContext as useCompileContext } from '@/shared/context/detach-compile-context'
|
|
import { RailIndicator } from './rail-indicator'
|
|
|
|
export const ErrorIndicator = () => {
|
|
const { logEntries } = useCompileContext()
|
|
|
|
if (!logEntries) {
|
|
return null
|
|
}
|
|
|
|
const errorCount = Number(logEntries.errors?.length)
|
|
const warningCount = Number(logEntries.warnings?.length)
|
|
const totalCount = errorCount + warningCount
|
|
|
|
if (totalCount === 0) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<RailIndicator
|
|
count={totalCount}
|
|
type={errorCount > 0 ? 'danger' : 'warning'}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export const ErrorPane = () => {
|
|
return (
|
|
<PdfPreviewProvider>
|
|
<PdfLogsViewer alwaysVisible />
|
|
</PdfPreviewProvider>
|
|
)
|
|
}
|