2024-10-10 09:13:01 -04:00
|
|
|
import { FC, memo, useMemo } from 'react'
|
2024-08-12 05:50:54 -04:00
|
|
|
import ReviewPanelTabs from './review-panel-tabs'
|
|
|
|
import ReviewPanelHeader from './review-panel-header'
|
|
|
|
import ReviewPanelCurrentFile from './review-panel-current-file'
|
|
|
|
import { ReviewPanelOverview } from './review-panel-overview'
|
|
|
|
import classnames from 'classnames'
|
2024-08-22 05:44:22 -04:00
|
|
|
import { useReviewPanelStyles } from '@/features/review-panel-new/hooks/use-review-panel-styles'
|
2024-10-10 09:13:01 -04:00
|
|
|
import { useReviewPanelViewContext } from '../context/review-panel-view-context'
|
2024-08-12 05:50:54 -04:00
|
|
|
|
2024-08-22 05:44:22 -04:00
|
|
|
const ReviewPanel: FC<{ mini?: boolean }> = ({ mini = false }) => {
|
2024-10-10 09:13:01 -04:00
|
|
|
const choosenSubView = useReviewPanelViewContext()
|
|
|
|
|
2024-09-26 10:14:51 -04:00
|
|
|
const activeSubView = useMemo(
|
|
|
|
() => (mini ? 'cur_file' : choosenSubView),
|
|
|
|
[choosenSubView, mini]
|
|
|
|
)
|
2024-08-12 05:50:54 -04:00
|
|
|
|
2024-08-22 05:44:22 -04:00
|
|
|
const style = useReviewPanelStyles(mini)
|
|
|
|
|
|
|
|
const className = classnames('review-panel-new', 'review-panel-container', {
|
|
|
|
'review-panel-mini': mini,
|
2024-09-26 10:14:51 -04:00
|
|
|
'review-panel-subview-overview': activeSubView === 'overview',
|
2024-08-22 05:44:22 -04:00
|
|
|
})
|
2024-08-12 05:50:54 -04:00
|
|
|
|
|
|
|
return (
|
2024-08-22 05:44:22 -04:00
|
|
|
<div className={className} style={style}>
|
|
|
|
<div className="review-panel-inner">
|
|
|
|
{!mini && <ReviewPanelHeader />}
|
2024-08-12 05:50:54 -04:00
|
|
|
|
2024-09-26 10:14:51 -04:00
|
|
|
{activeSubView === 'cur_file' && <ReviewPanelCurrentFile />}
|
|
|
|
{activeSubView === 'overview' && <ReviewPanelOverview />}
|
2024-08-12 05:50:54 -04:00
|
|
|
|
2024-08-22 05:44:22 -04:00
|
|
|
<div className="review-panel-footer">
|
2024-10-10 09:13:01 -04:00
|
|
|
<ReviewPanelTabs />
|
2024-08-12 05:50:54 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default memo(ReviewPanel)
|