outline-root.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { useTranslation } from 'react-i18next'
  2. import OutlineList from './outline-list'
  3. import { OutlineItemData } from '@/features/ide-react/types/outline'
  4. function OutlineRoot({
  5. outline,
  6. jumpToLine,
  7. highlightedLine,
  8. }: {
  9. outline: OutlineItemData[]
  10. jumpToLine: (line: number, syncToPdf: boolean) => void
  11. highlightedLine?: number
  12. }) {
  13. const { t } = useTranslation()
  14. return (
  15. <div>
  16. {outline.length ? (
  17. <OutlineList
  18. outline={outline}
  19. jumpToLine={jumpToLine}
  20. isRoot
  21. highlightedLine={highlightedLine}
  22. containsHighlightedLine
  23. />
  24. ) : (
  25. <div className="outline-body-no-elements">
  26. {t('we_cant_find_any_sections_or_subsections_in_this_file')}.{' '}
  27. <a
  28. href="https://docs.overleaf.com/navigating-in-the-editor/selecting-and-managing-files"
  29. className="outline-body-link"
  30. target="_blank"
  31. rel="noopener noreferrer"
  32. >
  33. {t('find_out_more_about_the_file_outline')}
  34. </a>
  35. </div>
  36. )}
  37. </div>
  38. )
  39. }
  40. export default OutlineRoot