Skip to content

Commit eded910

Browse files
committed
Fix/esigner and ereference issues (#736)
* fix: ereference & esigner cosmetic changes * fix: UTC time instead of local * fix: UTC time explicitly set at backend
1 parent 5305943 commit eded910

File tree

5 files changed

+49
-27
lines changed

5 files changed

+49
-27
lines changed

platforms/eReputation-api/src/controllers/DashboardController.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ export class DashboardController {
1212
this.calculationService = new CalculationService();
1313
}
1414

15+
/**
16+
* Maps reference status from DB format to display format.
17+
*/
18+
private mapReferenceStatus(status: string): string {
19+
switch (status?.toLowerCase()) {
20+
case "revoked":
21+
return "Revoked";
22+
case "signed":
23+
case "active":
24+
return "Signed";
25+
case "pending":
26+
return "Pending";
27+
default:
28+
return "Unknown";
29+
}
30+
}
31+
1532
getStats = async (req: Request, res: Response) => {
1633
try {
1734
const userId = req.user!.id;
@@ -58,7 +75,7 @@ export class DashboardController {
5875
target: ref.targetName,
5976
targetType: ref.targetType,
6077
date: ref.createdAt,
61-
status: ref.status === 'revoked' ? 'Revoked' : 'Signed',
78+
status: this.mapReferenceStatus(ref.status),
6279
data: ref
6380
});
6481
});
@@ -76,7 +93,7 @@ export class DashboardController {
7693
target: authorName,
7794
targetType: 'user',
7895
date: ref.createdAt,
79-
status: ref.status === 'revoked' ? 'Revoked' : 'Signed',
96+
status: this.mapReferenceStatus(ref.status),
8097
data: ref
8198
});
8299
});

platforms/esigner-api/src/services/FileService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ export class FileService {
118118
}
119119
}
120120

121+
// Sort by creation time, newest first (so new files from others appear at top)
122+
allFiles.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
123+
121124
// Hide soft-deleted (File Manager delete workaround: name [[deleted]])
122125
return allFiles.filter((f) => f.name !== SOFT_DELETED_FILE_NAME);
123126
}

platforms/esigner/src/routes/(protected)/files/[id]/+page.svelte

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,14 @@
336336
<!-- Main Content: Split Layout -->
337337
<main class="min-h-[calc(100vh-5rem)] flex flex-col overflow-hidden">
338338
<!-- Page Header -->
339-
<div class="bg-white border-b border-gray-200 px-4 sm:px-6 py-4 flex-shrink-0">
339+
<div class="bg-white border-b border-gray-200 px-4 sm:px-6 py-4 flex-shrink-0 min-w-0 overflow-hidden">
340340
<a href="/files" class="inline-flex items-center gap-2 text-blue-600 hover:text-blue-700 text-sm font-medium mb-2">
341341
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
342342
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
343343
</svg>
344344
Back to Signature Containers
345345
</a>
346-
<h1 class="text-xl sm:text-2xl font-bold text-gray-900 break-words">{file?.displayName || file?.name || 'Signature Container'}</h1>
346+
<h1 class="text-xl sm:text-2xl font-bold text-gray-900 break-words min-w-0">{file?.displayName || file?.name || 'Signature Container'}</h1>
347347
{#if file?.description}
348348
<p class="text-sm text-gray-600 mt-1">{file.description}</p>
349349
{/if}
@@ -401,8 +401,8 @@
401401
</div>
402402

403403
<!-- Right Side: Metadata Sidebar (30%) - Full width on mobile -->
404-
<div class="flex-1 lg:flex-[0.3] bg-white border-t lg:border-t-0 lg:border-l border-gray-200 overflow-y-auto">
405-
<div class="p-4 sm:p-6 space-y-6">
404+
<div class="flex-1 lg:flex-[0.3] bg-white border-t lg:border-t-0 lg:border-l border-gray-200 overflow-y-auto min-w-0">
405+
<div class="p-4 sm:p-6 space-y-6 min-w-0">
406406
<!-- Mobile Preview Button -->
407407
<div class="lg:hidden mb-4">
408408
{#if previewUrl && (file.mimeType?.startsWith('image/') || file.mimeType === 'application/pdf')}
@@ -420,10 +420,10 @@
420420
</div>
421421

422422
<!-- Signature Container Info -->
423-
<div>
423+
<div class="min-w-0">
424424
<h2 class="text-sm font-semibold text-gray-900 mb-3">Signature Container</h2>
425425
<div class="space-y-3">
426-
<div>
426+
<div class="min-w-0">
427427
<p class="text-xs text-gray-500 mb-1">Name</p>
428428
<p class="text-sm font-medium text-gray-900 break-words">{file.displayName || file.name}</p>
429429
</div>
@@ -440,9 +440,9 @@
440440
<div class="border-t border-gray-200 pt-6">
441441
<h2 class="text-sm font-semibold text-gray-900 mb-3">File Information</h2>
442442
<div class="space-y-2 text-sm">
443-
<div class="flex justify-between gap-2">
443+
<div class="flex justify-between gap-2 min-w-0">
444444
<span class="text-gray-600 flex-shrink-0">File Name:</span>
445-
<span class="text-gray-900 font-medium truncate text-right" title={file.name}>{file.name}</span>
445+
<span class="text-gray-900 font-medium truncate text-right min-w-0" title={file.name}>{file.name}</span>
446446
</div>
447447
<div class="flex justify-between gap-2">
448448
<span class="text-gray-600 flex-shrink-0">Size:</span>

platforms/esigner/src/routes/(protected)/files/new/+page.svelte

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,16 @@
298298
displayName = file.displayName || file.name;
299299
description = file.description || '';
300300
}}
301-
class={`p-4 border-2 rounded-lg text-left transition-colors ${
302-
selectedFile?.id === file.id
303-
? 'border-blue-600 bg-blue-50'
304-
: 'border-gray-200 hover:border-gray-300'
305-
}`}
306-
>
307-
<div class="flex items-center gap-3">
308-
<span class="text-2xl">{getFileIcon(file.mimeType)}</span>
309-
<div class="flex-1 min-w-0">
310-
<p class="font-medium text-gray-900 truncate">{file.displayName || file.name}</p>
301+
class={`p-4 border-2 rounded-lg text-left transition-colors min-w-0 overflow-hidden ${
302+
selectedFile?.id === file.id
303+
? 'border-blue-600 bg-blue-50'
304+
: 'border-gray-200 hover:border-gray-300'
305+
}`}
306+
>
307+
<div class="flex items-center gap-3 min-w-0">
308+
<span class="text-2xl flex-shrink-0">{getFileIcon(file.mimeType)}</span>
309+
<div class="flex-1 min-w-0 overflow-hidden">
310+
<p class="font-medium text-gray-900 truncate" title={file.displayName || file.name}>{file.displayName || file.name}</p>
311311
<p class="text-sm text-gray-600">{formatFileSize(file.size)}</p>
312312
</div>
313313
</div>
@@ -395,11 +395,11 @@
395395
<h2 class="text-2xl font-bold text-gray-900 mb-6">Invite Signees</h2>
396396

397397
<!-- Selected File Info -->
398-
<div class="mb-6 p-4 bg-gray-50 rounded-lg">
399-
<div class="flex items-center gap-3">
400-
<span class="text-2xl">{getFileIcon(selectedFile?.mimeType || '')}</span>
401-
<div>
402-
<p class="font-medium text-gray-900">{selectedFile?.name}</p>
398+
<div class="mb-6 p-4 bg-gray-50 rounded-lg min-w-0 overflow-hidden">
399+
<div class="flex items-center gap-3 min-w-0">
400+
<span class="text-2xl flex-shrink-0">{getFileIcon(selectedFile?.mimeType || '')}</span>
401+
<div class="min-w-0 flex-1 overflow-hidden">
402+
<p class="font-medium text-gray-900 truncate" title={selectedFile?.displayName || selectedFile?.name}>{selectedFile?.displayName || selectedFile?.name}</p>
403403
<p class="text-sm text-gray-600">{formatFileSize(selectedFile?.size || 0)}</p>
404404
</div>
405405
</div>

platforms/evoting-api/src/services/MessageService.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Message } from "../database/entities/Message";
33
import { User } from "../database/entities/User";
44
import { Group } from "../database/entities/Group";
55

6+
const UTC_OPTIONS: { timeZone: 'UTC' } = { timeZone: 'UTC' };
7+
68
export class MessageService {
79
public messageRepository = AppDataSource.getRepository(Message);
810
private userRepository = AppDataSource.getRepository(User);
@@ -66,7 +68,7 @@ export class MessageService {
6668
*/
6769
async createVoteCreatedMessage(groupId: string, voteTitle: string, voteId: string, creatorName: string, deadline?: Date | null): Promise<Message> {
6870
const deadlineText = deadline
69-
? `\nDeadline: ${deadline.toLocaleDateString()} at ${deadline.toLocaleTimeString()}`
71+
? `\nDeadline: ${deadline.toLocaleDateString(undefined, UTC_OPTIONS)} at ${deadline.toLocaleTimeString(undefined, UTC_OPTIONS)} UTC`
7072
: '\nNo deadline set';
7173

7274
const voteUrl = `${process.env.PUBLIC_EVOTING_URL || 'http://localhost:3000'}/${voteId}`;
@@ -81,7 +83,7 @@ export class MessageService {
8183
* Create a system message for vote deadline crossing
8284
*/
8385
async createVoteDeadlineMessage(groupId: string, voteTitle: string, voteId: string, creatorName: string, deadline: Date): Promise<Message> {
84-
const deadlineText = `\nOriginal Deadline: ${deadline.toLocaleDateString()} at ${deadline.toLocaleTimeString()}`;
86+
const deadlineText = `\nOriginal Deadline: ${deadline.toLocaleDateString(undefined, UTC_OPTIONS)} at ${deadline.toLocaleTimeString(undefined, UTC_OPTIONS)} UTC`;
8587

8688
return await this.createSystemMessage({
8789
text: `eVoting Platform: Vote deadline passed!\n\n"${voteTitle}"\n\nVote ID: ${voteId}\n\nCreated by: ${creatorName}${deadlineText}\n\nThis vote has ended. Check the results!`,

0 commit comments

Comments
 (0)