Skip to content
Extraits de code Groupes Projets
Valider cf9c8101 rédigé par NassihWalid's avatar NassihWalid
Parcourir les fichiers

resolving merge issues

parent eeaf63e2
Aucune requête de fusion associée trouvée
......@@ -128,31 +128,6 @@ export function KanbanColumnToolBar({
</MenuList>
</CustomPopover>
{/* <ConfirmDialog
open={confirmDialog.value}
onClose={confirmDialog.onFalse}
title="Delete"
content={
<>
Are you sure want to delete column?
<Box sx={{ typography: 'caption', color: 'error.main', mt: 2 }}>
<strong> NOTE: </strong> All tasks related to this category will also be deleted.
</Box>
</>
}
action={
<Button
variant="contained"
color="error"
onClick={() => {
onDeleteColumn?.();
confirmDialog.onFalse();
}}
>
Delete
</Button>
}
/> */}
</>
);
}
\ No newline at end of file
import { useState, useCallback } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
faTrash,
faChevronLeft,
faChevronDown
import {
faTrash,
faChevronLeft,
faChevronDown
} from '@fortawesome/free-solid-svg-icons';
import Stack from '@mui/material/Stack';
......@@ -67,7 +67,9 @@ export function KanbanDetailsToolbar({
{!smUp && (
<Tooltip title="Back">
<IconButton onClick={onCloseDetails} sx={{ mr: 1 }}>
<FontAwesomeIcon icon={faChevronLeft} />
{faChevronLeft ?
<FontAwesomeIcon icon={faChevronLeft} /> :
<span></span>}
</IconButton>
</Tooltip>
)}
......@@ -86,7 +88,7 @@ export function KanbanDetailsToolbar({
<Tooltip title="Supprimer">
<IconButton onClick={confirm.onTrue}>
<FontAwesomeIcon icon={faTrash} />
<FontAwesomeIcon icon={faTrash} />
</IconButton>
</Tooltip>
......
......@@ -40,13 +40,6 @@ import type { IKanbanTask } from '../types/kanban';
// ----------------------------------------------------------------------
// const SUBTASKS = [
// 'Complete project proposal',
// 'Conduct market research',
// 'Design user interface mockups',
// 'Develop backend api',
// 'Implement authentication system',
// ];
const StyledLabel = styled('span')(({ theme }) => ({
...theme.typography.caption,
......@@ -116,14 +109,6 @@ export function KanbanDetails({
setPriority(newValue);
}, []);
// subtask is removed
// const handleClickSubtaskComplete = (taskId: string) => {
// const selected = subtaskCompleted.includes(taskId)
// ? subtaskCompleted.filter((value) => value !== taskId)
// : [...subtaskCompleted, taskId];
// setSubtaskCompleted(selected);
// };
const renderToolbar = (
<KanbanDetailsToolbar
......@@ -199,48 +184,36 @@ export function KanbanDetails({
</Box>
</Box>
{/* Label */}
{/* <Box sx={{ display: 'flex' }}>
<StyledLabel sx={{ height: 24, lineHeight: '24px' }}>Labels</StyledLabel>
{!!task.labels.length && (
<Box sx={{ gap: 1, display: 'flex', flexWrap: 'wrap' }}>
{task.labels.map((label) => (
<Chip key={label} color="info" label={label} size="small" variant="soft" />
))}
</Box>
)}
</Box> */}
{/* Category - Modified for Moderation with Dropdown */}
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<StyledLabel sx={{ height: 40, lineHeight: '40px' }}>Catégorie</StyledLabel>
<FormControl fullWidth size="small">
<Select
value={task.labels.length ? task.labels[0] : 'spam'}
onChange={(e) => {
onUpdateTask({ ...task, labels: [e.target.value] });
}}
displayEmpty
>
<MenuItem value="contenu inapproprié">
<Stack direction="row" alignItems="center" spacing={1}>
<Chip size="small" label="Contenu inapproprié" color="error" variant="soft" />
</Stack>
</MenuItem>
<MenuItem value="hors-sujet">
<Stack direction="row" alignItems="center" spacing={1}>
<Chip size="small" label="Hors-sujet" color="warning" variant="soft" />
</Stack>
</MenuItem>
<MenuItem value="spam">
<Stack direction="row" alignItems="center" spacing={1}>
<Chip size="small" label="Spam" color="info" variant="soft" />
</Stack>
</MenuItem>
</Select>
</FormControl>
</Box>
{/* Category - Modified for Moderation with Dropdown */}
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<StyledLabel sx={{ height: 40, lineHeight: '40px' }}>Catégorie</StyledLabel>
<FormControl fullWidth size="small">
<Select
value={task.labels.length ? task.labels[0] : 'spam'}
onChange={(e) => {
onUpdateTask({ ...task, labels: [e.target.value] });
}}
displayEmpty
>
<MenuItem value="contenu inapproprié">
<Stack direction="row" alignItems="center" spacing={1}>
<Chip size="small" label="Contenu inapproprié" color="error" variant="soft" />
</Stack>
</MenuItem>
<MenuItem value="hors-sujet">
<Stack direction="row" alignItems="center" spacing={1}>
<Chip size="small" label="Hors-sujet" color="warning" variant="soft" />
</Stack>
</MenuItem>
<MenuItem value="spam">
<Stack direction="row" alignItems="center" spacing={1}>
<Chip size="small" label="Spam" color="info" variant="soft" />
</Stack>
</MenuItem>
</Select>
</FormControl>
</Box>
......@@ -329,12 +302,11 @@ export function KanbanDetails({
{renderTabs}
<Scrollbar fillContent sx={{ py: 3, px: 2.5 }}>
{tabs.value === 'overview' && renderTabOverview}
{/* {tabs.value === 'subTasks' && renderTabSubtasks} */}
{tabs.value === 'comments' && renderTabComments}
{tabs.value === 'overview' ? renderTabOverview : <></>}
{tabs.value === 'comments' ? renderTabComments : <></>}
</Scrollbar>
{tabs.value === 'comments' && <KanbanDetailsCommentInput />}
{tabs.value === 'comments' ? <KanbanDetailsCommentInput /> : <></>}
</Drawer>
);
}
......@@ -30,7 +30,7 @@ export function ModerationSearch({ query, results, onSearch, loading }: Props) {
const handleKeyUp = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (query && event.key === 'Enter') {
const selectItem = results.find((task) =>
const selectItem = results.find((task) =>
task.name.toLowerCase().includes(query.toLowerCase()) ||
(task.description && task.description.toLowerCase().includes(query.toLowerCase()))
);
......@@ -105,19 +105,19 @@ export function ModerationSearch({ query, results, onSearch, loading }: Props) {
fontWeight: part.highlight ? 'fontWeightSemiBold' : 'fontWeightMedium',
}}
>
{part.text}
{part.text ? part.text : <></>}
</Typography>
))}
{task.description && (
{task.description ? (
<Typography variant="body2" color="text.secondary">
{partsDesc.map((part, index) => (
<span key={index} style={{ fontWeight: part.highlight ? 'bold' : 'normal' }}>
{part.text}
{part.text ? part.text : <></>}
</span>
))}
</Typography>
)}
) : <></>}
</div>
</Box>
);
......
......@@ -42,10 +42,6 @@ import { EmptyContent } from 'src/shared/components/empty-content';
import { moveTask, moveColumn, useGetBoard } from 'src/shared/sections/moderation/actions/kanban';
import type { IKanbanTask } from '../types/kanban';
// If you have a useSearchModerations hook similar to useSearchAmeliorations, import it here
// import { useSearchModerations } from 'src/shared/actions/moderation';
import { kanbanClasses } from '../classes';
import { coordinateGetter } from '../utils';
import { KanbanColumn } from '../column/kanban-column';
......@@ -54,19 +50,12 @@ import { KanbanTaskItem } from '../item/kanban-task-item';
import { KanbanColumnSkeleton } from '../components/kanban-skeleton';
import { KanbanDragOverlay } from '../components/kanban-drag-overlay';
import type { IKanbanTask } from '../types/kanban';
// ----------------------------------------------------------------------
const PLACEHOLDER_ID = 'placeholder';
// const cssVars = {
// '--item-gap': '16px',
// '--item-radius': '12px',
// '--column-gap': '24px',
// '--column-width': '336px',
// '--column-radius': '16px',
// '--column-padding': '20px 16px 16px 16px',
// };
const cssVars = {
'--item-gap': '16px',
'--item-radius': '12px',
......@@ -102,27 +91,27 @@ export function KanbanView() {
priority: '',
category: '',
});
// Search function implementation
const searchModerationTasks = useCallback(() => {
if (!debouncedQuery) return [];
const queryLower = debouncedQuery.toLowerCase();
// Use flatMap to get all tasks from all columns
return board.columns
.flatMap(column => board.tasks[column.id] || [])
.filter(task => {
const matchName = task.name.toLowerCase().includes(queryLower);
const matchDescription = task.description &&
const matchDescription = task.description &&
task.description.toLowerCase().includes(queryLower);
return matchName || matchDescription;
});
}, [board.columns, board.tasks, debouncedQuery]);
const [searchLoading, setSearchLoading] = useState(false);
const [searchResults, setSearchResults] = useState<IKanbanTask[]>([]);
// Effect to update search results when query changes
useEffect(() => {
const performSearch = async () => {
......@@ -138,7 +127,7 @@ export function KanbanView() {
setSearchLoading(false);
}
};
if (debouncedQuery) {
performSearch();
} else {
......@@ -169,7 +158,7 @@ export function KanbanView() {
const intersections =
pointerIntersections.length > 0
? // If there are droppables intersecting with the pointer, return those
pointerIntersections
pointerIntersections
: rectIntersection(args);
let overId = getFirstCollision(intersections, 'id');
......@@ -353,7 +342,7 @@ export function KanbanView() {
searchLoading={searchLoading}
/>
);
const modifiedColumns = board.columns.map((column) => {
let modifiedName = column.name;
if (modifiedName === 'To do') modifiedName = 'Nouveau';
......@@ -362,12 +351,12 @@ export function KanbanView() {
if (modifiedName === 'Done') modifiedName = 'Rejeter';
return { ...column, name: modifiedName };
});
// Apply column filter
const filteredColumns = filters.state.columns?.length
? modifiedColumns.filter(column => filters.state.columns.includes(column.name))
: modifiedColumns;
const renderList = (
<DndContext
id="dnd-kanban"
......@@ -405,14 +394,14 @@ export function KanbanView() {
// Apply task filters and search
const filteredTasks = board.tasks[column.id].filter(task => {
const priorityMatch = !filters.state.priority || task.priority === filters.state.priority;
const categoryMatch = !filters.state.category ||
const categoryMatch = !filters.state.category ||
(task.labels && task.labels.includes(filters.state.category));
// Apply search filter if there's a search query
const searchMatch = !debouncedQuery ||
const searchMatch = !debouncedQuery ||
task.name.toLowerCase().includes(debouncedQuery.toLowerCase()) ||
(task.description && task.description.toLowerCase().includes(debouncedQuery.toLowerCase()));
return priorityMatch && categoryMatch && searchMatch;
});
......@@ -438,7 +427,7 @@ export function KanbanView() {
</Stack>
</Stack>
</Stack>
<KanbanDragOverlay
columns={modifiedColumns}
tasks={board?.tasks}
......@@ -447,7 +436,7 @@ export function KanbanView() {
/>
</DndContext>
);
return (
<DashboardContent
......@@ -471,19 +460,7 @@ export function KanbanView() {
>
<Typography variant="h4">Moderation et Signalement</Typography>
{/* <FormControlLabel
label="Column fixed"
labelPlacement="start"
control={
<Switch
checked={columnFixed}
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
setColumnFixed(event.target.checked);
}}
inputProps={{ id: 'column-fixed-switch' }}
/>
}
/> */}
</Stack>
{/* Added filters */}
......
0% ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter