feature/IO-3291-Tasks-Notifications: Checkpoint
This commit is contained in:
@@ -2,11 +2,10 @@ import { Virtuoso } from "react-virtuoso";
|
|||||||
import { Badge, Spin, Typography } from "antd";
|
import { Badge, Spin, Typography } from "antd";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { forwardRef, useMemo, useRef } from "react";
|
import { forwardRef, useMemo, useRef } from "react";
|
||||||
import { DateTimeFormat } from "../../utils/DateFormatter.jsx";
|
|
||||||
import day from "../../utils/day.js";
|
import day from "../../utils/day.js";
|
||||||
import "./task-center.styles.scss";
|
import "./task-center.styles.scss";
|
||||||
|
|
||||||
const { Text, Title } = Typography;
|
const { Title } = Typography;
|
||||||
|
|
||||||
const TaskCenterComponent = forwardRef(({ visible, tasks, loading, onTaskClick, onLoadMore, totalTasks }, ref) => {
|
const TaskCenterComponent = forwardRef(({ visible, tasks, loading, onTaskClick, onLoadMore, totalTasks }, ref) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -51,31 +50,30 @@ const TaskCenterComponent = forwardRef(({ visible, tasks, loading, onTaskClick,
|
|||||||
const priorityColor = getPriorityColor(task.priority);
|
const priorityColor = getPriorityColor(task.priority);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={`${task.id}-${index}`} className="task-item task-incomplete" onClick={handleClick}>
|
<div key={`${task.id}-${index}`} className="task-item" onClick={handleClick}>
|
||||||
<Badge dot color={priorityColor || undefined} style={priorityColor ? {} : { display: "none" }}>
|
<Badge color={priorityColor || undefined} dot={!!priorityColor} offset={[-4, 4]}>
|
||||||
<div className="task-content">
|
<div className="task-content">
|
||||||
<Text strong className="task-body">
|
<div className="task-header-row">
|
||||||
{task.title}
|
<span className="task-title">{task.title}</span>
|
||||||
</Text>
|
|
||||||
|
|
||||||
<div className="task-meta">
|
|
||||||
<div className="ro-number">
|
|
||||||
{t("notifications.labels.ro-number", {
|
|
||||||
ro_number: task.job?.ro_number || t("general.labels.na")
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
{task.due_date && (
|
{task.due_date && (
|
||||||
<Text type="secondary" className="relative-time" title={DateTimeFormat(task.due_date)}>
|
<span className="task-due-date">
|
||||||
{day(task.due_date).fromNow()}
|
{t("tasks.labels.due")}: {day(task.due_date).fromNow()}
|
||||||
</Text>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/*{task.description && <div className="task-description">{task.description}</div>}*/}
|
||||||
|
|
||||||
|
<div className="task-ro-number">
|
||||||
|
{t("notifications.labels.ro-number", {
|
||||||
|
ro_number: task.job?.ro_number || t("general.labels.na")
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderItem = (index, item) => {
|
const renderItem = (index, item) => {
|
||||||
if (item.type === "header") {
|
if (item.type === "header") {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -40,10 +40,7 @@ const TaskCenterContainer = ({ visible, onClose, bodyshop, currentUser, setTaskU
|
|||||||
},
|
},
|
||||||
skip: !bodyshop?.id || !assignedToId || !isEmployee || !currentUser?.email,
|
skip: !bodyshop?.id || !assignedToId || !isEmployee || !currentUser?.email,
|
||||||
fetchPolicy: "cache-and-network",
|
fetchPolicy: "cache-and-network",
|
||||||
pollInterval: isConnected ? 0 : POLL_INTERVAL,
|
pollInterval: isConnected ? 0 : POLL_INTERVAL
|
||||||
onError: (error) => {
|
|
||||||
console.error("Query error:", error);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.task-header {
|
.task-header {
|
||||||
padding: 8px 16px;
|
padding: 4px 10px;
|
||||||
border-bottom: 1px solid #f0f0f0;
|
border-bottom: 1px solid #f0f0f0;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -27,20 +27,20 @@
|
|||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 14px;
|
font-size: 13px;
|
||||||
color: rgba(0, 0, 0, 0.85);
|
color: rgba(0, 0, 0, 0.85);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-section {
|
.task-section {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
padding: 8px 16px;
|
padding: 3px 10px;
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 14px;
|
font-size: 12px;
|
||||||
color: rgba(0, 0, 0, 0.85);
|
color: rgba(0, 0, 0, 0.85);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
border-bottom: 1px solid #e8e8e8;
|
border-bottom: 1px solid #e8e8e8;
|
||||||
@@ -49,84 +49,75 @@
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-meta {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 4px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: rgba(0, 0, 0, 0.45);
|
|
||||||
|
|
||||||
.ro-number {
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.relative-time {
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.task-item {
|
.task-item {
|
||||||
padding: 12px 16px;
|
padding: 6px 10px;
|
||||||
border-bottom: 1px solid #f0f0f0;
|
border-bottom: 1px solid #f0f0f0;
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
cursor: pointer;
|
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #fafafa;
|
background: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-content {
|
.task-content {
|
||||||
width: 100%;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-title {
|
.task-header-row {
|
||||||
margin: 0;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
.ro-number {
|
.task-title {
|
||||||
margin: 0;
|
font-size: 13px;
|
||||||
color: #1677ff;
|
font-weight: 600;
|
||||||
font-weight: 500;
|
color: rgba(0, 0, 0, 0.9);
|
||||||
flex-shrink: 0;
|
margin-right: 6px;
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.relative-time {
|
.task-due-date {
|
||||||
font-size: 12px;
|
font-size: 11px;
|
||||||
color: rgba(0, 0, 0, 0.45);
|
color: rgba(0, 0, 0, 0.45);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex-shrink: 0;
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-body {
|
.task-description {
|
||||||
margin-top: 4px;
|
font-size: 12px;
|
||||||
color: rgba(0, 0, 0, 0.85);
|
color: rgba(0, 0, 0, 0.65);
|
||||||
font-weight: 500;
|
}
|
||||||
font-size: 14px;
|
|
||||||
|
.task-ro-number {
|
||||||
|
font-size: 11px;
|
||||||
|
color: rgba(0, 0, 0, 0.45);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-badge {
|
.ant-badge {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
.ant-badge-dot {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
top: 2px;
|
||||||
|
right: 2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
margin: 16px auto;
|
margin: 8px auto;
|
||||||
display: block;
|
padding: 4px 10px;
|
||||||
padding: 8px 16px;
|
|
||||||
background-color: #1677ff;
|
background-color: #1677ff;
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-size: 14px;
|
font-size: 12px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|||||||
Reference in New Issue
Block a user