2024-08-12 05:50:54 -04:00
|
|
|
import { FC, memo, useState } from 'react'
|
|
|
|
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-08-12 05:50:54 -04:00
|
|
|
|
|
|
|
export type SubView = 'cur_file' | 'overview'
|
|
|
|
|
2024-08-22 05:44:22 -04:00
|
|
|
const ReviewPanel: FC<{ mini?: boolean }> = ({ mini = false }) => {
|
2024-08-12 05:50:54 -04:00
|
|
|
const [subView, setSubView] = useState<SubView>('cur_file')
|
|
|
|
|
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,
|
|
|
|
'review-panel-subview-overview': subView === 'overview',
|
|
|
|
})
|
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
|
|
|
|
|
|
|
{subView === 'cur_file' && <ReviewPanelCurrentFile />}
|
|
|
|
{subView === 'overview' && <ReviewPanelOverview />}
|
|
|
|
|
2024-08-22 05:44:22 -04:00
|
|
|
<div className="review-panel-footer">
|
2024-08-12 05:50:54 -04:00
|
|
|
<ReviewPanelTabs subView={subView} setSubView={setSubView} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default memo(ReviewPanel)
|