Fix board priority sorting and attachment preview controls
This commit is contained in:
parent
463342bf6e
commit
26fa3a5301
@ -97,13 +97,6 @@ function boardGroupPosition(
|
||||
return board.group_positions?.[String(groupId)];
|
||||
}
|
||||
|
||||
function boardGroupSortKey(
|
||||
board: TaskBoardSummary,
|
||||
groupId: number,
|
||||
): string | undefined {
|
||||
return board.group_sort_keys?.[String(groupId)];
|
||||
}
|
||||
|
||||
function compareBoardNames(first: TaskBoardSummary, second: TaskBoardSummary): number {
|
||||
return first.name.localeCompare(second.name, "ru") || first.id - second.id;
|
||||
}
|
||||
@ -519,14 +512,18 @@ export default function TaskBoardNavigator({
|
||||
(effectiveBoardSort === "priority" || effectiveBoardSort === "priority-desc")
|
||||
&& typeof effectiveGroupFilter === "number"
|
||||
) {
|
||||
const firstRank = boardGroupSortKey(first, effectiveGroupFilter);
|
||||
const secondRank = boardGroupSortKey(second, effectiveGroupFilter);
|
||||
if (firstRank && secondRank && firstRank !== secondRank) {
|
||||
const firstPosition = boardGroupPosition(first, effectiveGroupFilter);
|
||||
const secondPosition = boardGroupPosition(second, effectiveGroupFilter);
|
||||
if (
|
||||
firstPosition !== undefined
|
||||
&& secondPosition !== undefined
|
||||
&& firstPosition !== secondPosition
|
||||
) {
|
||||
const direction = effectiveBoardSort === "priority-desc" ? -1 : 1;
|
||||
return (firstRank < secondRank ? -1 : 1) * direction;
|
||||
return (firstPosition - secondPosition) * direction;
|
||||
}
|
||||
if (firstRank && !secondRank) return -1;
|
||||
if (!firstRank && secondRank) return 1;
|
||||
if (firstPosition !== undefined && secondPosition === undefined) return -1;
|
||||
if (firstPosition === undefined && secondPosition !== undefined) return 1;
|
||||
}
|
||||
|
||||
if (effectiveBoardSort === "name-desc") {
|
||||
|
||||
@ -98,7 +98,7 @@ export default function TaskCommentAttachment({
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void openPreview()}
|
||||
disabled={!thumbnailSource || thumbnailFailed || previewLoading}
|
||||
disabled={previewLoading}
|
||||
className="group relative block aspect-video min-h-32 w-full overflow-hidden bg-[var(--surface-secondary)] outline-none focus-visible:ring-2 focus-visible:ring-sky-400/70 disabled:cursor-default"
|
||||
title={`Просмотреть ${attachment.file_name}`}
|
||||
>
|
||||
@ -113,7 +113,15 @@ export default function TaskCommentAttachment({
|
||||
/>
|
||||
) : (
|
||||
<span className="app-text-muted absolute inset-0 flex items-center justify-center">
|
||||
{thumbnailFailed ? <FileText size={20} /> : <Loader2 size={18} className="animate-spin" />}
|
||||
{previewLoading ? (
|
||||
<Loader2 size={20} className="animate-spin" />
|
||||
) : thumbnailFailed ? (
|
||||
<span className="app-selected inline-flex h-11 w-11 items-center justify-center rounded-full">
|
||||
{video ? <Play size={20} fill="currentColor" /> : <Eye size={20} />}
|
||||
</span>
|
||||
) : (
|
||||
<Loader2 size={18} className="animate-spin" />
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
{thumbnailSource ? (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user