add view any columns and view mode for ideas
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-15 11:41:01 +03:00
parent 890d6de92e
commit 684e416588
8 changed files with 856 additions and 7 deletions

View File

@ -36,6 +36,7 @@ import {
Collapse,
} from '@mui/material';
import { Inbox } from '@mui/icons-material';
import { ColumnVisibility } from './ColumnVisibility';
import {
useIdeasQuery,
useDeleteIdea,
@ -55,10 +56,11 @@ import { DraggableRow } from './DraggableRow';
import { CommentsPanel } from '../CommentsPanel';
import { AiEstimateModal } from '../AiEstimateModal';
import { SpecificationModal } from '../SpecificationModal';
import { IdeaDetailModal } from '../IdeaDetailModal';
import type { EstimateResult } from '../../services/ai';
import type { Idea } from '../../types/idea';
import type { Idea, UpdateIdeaDto } from '../../types/idea';
const SKELETON_COLUMNS_COUNT = 10;
const SKELETON_COLUMNS_COUNT = 13;
export function IdeasTable() {
const { data, isLoading, isError } = useIdeasQuery();
@ -91,6 +93,9 @@ export function IdeasTable() {
const [generatingSpecificationId, setGeneratingSpecificationId] = useState<
string | null
>(null);
// Детальный просмотр идеи
const [detailModalOpen, setDetailModalOpen] = useState(false);
const [detailIdea, setDetailIdea] = useState<Idea | null>(null);
// История ТЗ
const specificationHistory = useSpecificationHistory(
@ -211,6 +216,41 @@ export function IdeasTable() {
});
};
const handleViewDetails = useCallback((idea: Idea) => {
setDetailIdea(idea);
setDetailModalOpen(true);
}, []);
const handleCloseDetailModal = () => {
setDetailModalOpen(false);
setDetailIdea(null);
};
const handleSaveDetail = (id: string, dto: UpdateIdeaDto) => {
updateIdea.mutate(
{ id, dto },
{
onSuccess: (updatedIdea) => {
setDetailIdea(updatedIdea);
},
},
);
};
const handleOpenSpecificationFromDetail = (idea: Idea) => {
handleCloseDetailModal();
handleSpecification(idea);
};
const handleOpenEstimateFromDetail = (idea: Idea) => {
handleCloseDetailModal();
if (idea.estimatedHours) {
handleViewEstimate(idea);
} else {
handleEstimate(idea.id);
}
};
const columns = useMemo(
() =>
createColumns({
@ -219,6 +259,7 @@ export function IdeasTable() {
onEstimate: handleEstimate,
onViewEstimate: handleViewEstimate,
onSpecification: handleSpecification,
onViewDetails: handleViewDetails,
expandedId,
estimatingId,
generatingSpecificationId,
@ -230,6 +271,7 @@ export function IdeasTable() {
generatingSpecificationId,
handleEstimate,
handleSpecification,
handleViewDetails,
],
);
@ -316,6 +358,19 @@ export function IdeasTable() {
sx={{ width: '100%', overflow: 'hidden' }}
data-testid="ideas-table-container"
>
<Box
sx={{
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'center',
px: 2,
py: 1,
borderBottom: 1,
borderColor: 'divider',
}}
>
<ColumnVisibility table={table} />
</Box>
<DndContext
sensors={sensors}
collisionDetection={closestCenter}
@ -500,6 +555,15 @@ export function IdeasTable() {
onRestoreFromHistory={handleRestoreFromHistory}
isRestoring={restoreSpecificationFromHistory.isPending}
/>
<IdeaDetailModal
open={detailModalOpen}
onClose={handleCloseDetailModal}
idea={detailIdea}
onSave={handleSaveDetail}
isSaving={updateIdea.isPending}
onOpenSpecification={handleOpenSpecificationFromDetail}
onOpenEstimate={handleOpenEstimateFromDetail}
/>
</Paper>
);
}