From 5584c88d1caef8c9a33e74d5c39403e596374eee Mon Sep 17 00:00:00 2001 From: lizerk Date: Mon, 13 Apr 2026 13:35:50 +0300 Subject: [PATCH] refactor(frontend): recover requests dense row --- .../components/requests/RequestListItem.tsx | 264 ++++++++++-------- .../requests/RequestListSection.tsx | 2 +- 2 files changed, 149 insertions(+), 117 deletions(-) diff --git a/frontend/src/components/requests/RequestListItem.tsx b/frontend/src/components/requests/RequestListItem.tsx index ffb04638..eaacbbbe 100644 --- a/frontend/src/components/requests/RequestListItem.tsx +++ b/frontend/src/components/requests/RequestListItem.tsx @@ -7,7 +7,17 @@ import { } from "@/hooks/useRequestsPage"; import { displayUserName, formatDate, formatDateTime, userProfileLink } from "@/lib/shared"; import type { Request, RequestComment, User } from "@/types/api"; -import { Ban, ChevronDown, ChevronRight, MessageSquare, Paperclip, Pencil, ThumbsDown, ThumbsUp, Trash2 } from "lucide-react"; +import { + Ban, + ChevronDown, + ChevronRight, + MessageSquare, + Paperclip, + Pencil, + ThumbsDown, + ThumbsUp, + Trash2, +} from "lucide-react"; import type { ReactNode, Ref } from "react"; import { RequestAvatar } from "./RequestAvatar"; import { RequestUserBadge } from "./RequestUserBadge"; @@ -54,9 +64,9 @@ type RequestAudienceRowProps = { function RequestMetaField({ label, value }: RequestMetaFieldProps) { return ( -
+

{label}

-
{value}
+
{value}
); } @@ -69,10 +79,10 @@ function RequestAudienceRow({ people, }: RequestAudienceRowProps) { return ( -
+

{label}

{people.length > 0 ? ( -
+
{people.slice(0, 2).map((person) => ( ) : ( -

{count ? count : emptyText}

+

{count ? count : emptyText}

)}
); @@ -171,9 +181,9 @@ export function RequestListItem({
-
-
-
+
+
+
-
+
-
+
{authorLink ? ( @@ -226,14 +236,20 @@ export function RequestListItem({ {authorName}
)} - + {typeLabel}
-
- @@ -244,22 +260,50 @@ export function RequestListItem({ {request.date_to ? ` - ${formatDate(request.date_to)}` : ""} Создано: {formatDate(request.created_at) || "-"} - {departmentLabels ? Отделы: {departmentLabels} : null}
{summary ? ( -

+

{summary}

) : null}
-
-
+
+
{status.label} + + {canProcess ? ( + <> + + + + ) : null} + {hasSecondaryActions ? (
- - {canProcess ? ( -
- - -
- ) : null}
{hasExpandedPanels ? ( -
- {rowOpen ? ( -
-
-

Подробности

- {attachmentUrl ? ( - - ) : null} -
+
+
+ {rowOpen ? ( +
+
+

+ Подробности +

+ {attachmentUrl ? ( + + ) : null} +
-
-
-
+
+
-} />
-
-
-
+
-
-
- ) : null} +
+ ) : null} - {commentsOpen ? ( -
-
-

Комментарии

- - {commentCount} - -
+ {commentsOpen ? ( +
+
+

+ Комментарии +

+ + {commentCount} + +
-
- {comments.length === 0 ? ( -

Комментариев пока нет

- ) : comments.map((comment) => ( -
-
- {displayUserName(comment.author)} -
- {formatDateTime(comment.created_at) || "-"} - {Boolean(comment.author?.id && currentUserId === comment.author.id) ? ( - - ) : null} +
+ {comments.length === 0 ? ( +

+ Комментариев пока нет +

+ ) : comments.map((comment) => ( +
+
+ {displayUserName(comment.author)} +
+ + {formatDateTime(comment.created_at) || "-"} + + {Boolean(comment.author?.id && currentUserId === comment.author.id) ? ( + + ) : null} +
+

+ {comment.text} +

-

{comment.text}

-
- ))} -
+ ))} +
-
- onSetCommentDraft(request.id, event.target.value)} - placeholder="Добавить комментарий" - className="app-input flex-1 rounded-lg px-3 py-2.5 text-sm" - /> - -
-
- ) : null} +
+ onSetCommentDraft(request.id, event.target.value)} + placeholder="Добавить комментарий" + className="app-input flex-1 rounded-lg px-3 py-2.5 text-sm" + /> + +
+
+ ) : null} +
) : null}
diff --git a/frontend/src/components/requests/RequestListSection.tsx b/frontend/src/components/requests/RequestListSection.tsx index dc7d946c..2cc1500d 100644 --- a/frontend/src/components/requests/RequestListSection.tsx +++ b/frontend/src/components/requests/RequestListSection.tsx @@ -65,7 +65,7 @@ export function RequestListSection({ }: RequestListSectionProps) { return ( <> -
+
{requests.length === 0 ? (