|
@@ -2,6 +2,8 @@ import React, { useState, useEffect } from 'react'
|
|
|
import PropTypes from 'prop-types'
|
|
import PropTypes from 'prop-types'
|
|
|
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
|
|
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
|
|
|
import classNames from 'classnames'
|
|
import classNames from 'classnames'
|
|
|
|
|
+import { useTranslation, Trans } from 'react-i18next'
|
|
|
|
|
+
|
|
|
import OutlineRoot from './outline-root'
|
|
import OutlineRoot from './outline-root'
|
|
|
import localStorage from '../../../modules/localStorage'
|
|
import localStorage from '../../../modules/localStorage'
|
|
|
|
|
|
|
@@ -14,6 +16,8 @@ function OutlinePane({
|
|
|
eventTracking,
|
|
eventTracking,
|
|
|
highlightedLine
|
|
highlightedLine
|
|
|
}) {
|
|
}) {
|
|
|
|
|
+ const { t } = useTranslation()
|
|
|
|
|
+
|
|
|
const storageKey = `file_outline.expanded.${projectId}`
|
|
const storageKey = `file_outline.expanded.${projectId}`
|
|
|
const [expanded, setExpanded] = useState(() => {
|
|
const [expanded, setExpanded] = useState(() => {
|
|
|
const storedExpandedState = localStorage(storageKey) !== false
|
|
const storedExpandedState = localStorage(storageKey) !== false
|
|
@@ -45,6 +49,17 @@ function OutlinePane({
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const infoContent = (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <Trans
|
|
|
|
|
+ i18nKey="the_file_outline_is_a_new_feature_click_the_icon_to_learn_more"
|
|
|
|
|
+ components={[<strong />]}
|
|
|
|
|
+ />
|
|
|
|
|
+ .
|
|
|
|
|
+ </>
|
|
|
|
|
+ )
|
|
|
|
|
+ const tooltip = <Tooltip id="outline-info-tooltip">{infoContent}</Tooltip>
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className={headerClasses}>
|
|
<div className={headerClasses}>
|
|
|
<header className="outline-header">
|
|
<header className="outline-header">
|
|
@@ -54,7 +69,7 @@ function OutlinePane({
|
|
|
onClick={handleExpandCollapseClick}
|
|
onClick={handleExpandCollapseClick}
|
|
|
>
|
|
>
|
|
|
<i className={expandCollapseIconClasses} />
|
|
<i className={expandCollapseIconClasses} />
|
|
|
- <h4 className="outline-header-name">File outline</h4>
|
|
|
|
|
|
|
+ <h4 className="outline-header-name">{t('file_outline')}</h4>
|
|
|
{expanded ? (
|
|
{expanded ? (
|
|
|
<OverlayTrigger placement="top" overlay={tooltip} delayHide={100}>
|
|
<OverlayTrigger placement="top" overlay={tooltip} delayHide={100}>
|
|
|
<a
|
|
<a
|
|
@@ -83,14 +98,6 @@ function OutlinePane({
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const infoContent = (
|
|
|
|
|
- <>
|
|
|
|
|
- The <strong>File outline</strong> is a new feature. Click the icon to learn
|
|
|
|
|
- more.
|
|
|
|
|
- </>
|
|
|
|
|
-)
|
|
|
|
|
-const tooltip = <Tooltip id="outline-info-tooltip">{infoContent}</Tooltip>
|
|
|
|
|
-
|
|
|
|
|
OutlinePane.propTypes = {
|
|
OutlinePane.propTypes = {
|
|
|
isTexFile: PropTypes.bool.isRequired,
|
|
isTexFile: PropTypes.bool.isRequired,
|
|
|
outline: PropTypes.array.isRequired,
|
|
outline: PropTypes.array.isRequired,
|