+
+
+
+
+
+
+ {displayFileName}
+
+
+ {currentIcon.size ? `${(currentIcon.size / 1024).toFixed(1)} KB` : 'Icon uploaded'}
+
+
+
+
+ }
+ style={{
+ fontSize: 12,
+ display: 'flex',
+ alignItems: 'center',
+ gap: 4
+ }}
+ onClick={() => {
+ try {
+ let iconUrl = '';
+ let actualFileName = '';
+
+ const filePath = currentIcon.uploadPath || currentIcon.url || currentIcon.path || '';
+ const iconDisplayName = currentIcon.name || '';
+
+ if (iconDisplayName) {
+ actualFileName = iconDisplayName;
+ } else if (filePath) {
+ actualFileName = filePath.split('/').pop();
+ }
+
+ if (actualFileName) {
+ const fileExtension = actualFileName.split('.').pop()?.toLowerCase();
+ const folder = getFolderFromFileType(fileExtension);
+ iconUrl = getFileUrl(folder, actualFileName);
+ }
+
+ if (!iconUrl && filePath) {
+ iconUrl = filePath.startsWith('http') ? filePath : `${import.meta.env.VITE_API_SERVER}/${filePath}`;
+ }
+
+ if (iconUrl && actualFileName) {
+ const fileExtension = actualFileName.split('.').pop()?.toLowerCase();
+ const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
+ const pdfExtensions = ['pdf'];
+
+ if (imageExtensions.includes(fileExtension) || pdfExtensions.includes(fileExtension)) {
+ const viewerUrl = `/image-viewer/${encodeURIComponent(actualFileName)}`;
+ window.open(viewerUrl, '_blank', 'noopener,noreferrer');
+ } else {
+ window.open(iconUrl, '_blank', 'noopener,noreferrer');
+ }
+ } else {
+ NotifAlert({
+ icon: 'error',
+ title: 'Error',
+ message: `File URL not found. FileName: ${actualFileName}, FilePath: ${filePath}`
+ });
+ }
+ } catch (error) {
+ NotifAlert({
+ icon: 'error',
+ title: 'Error',
+ message: `Failed to open file preview: ${error.message}`
+ });
+ }
+ }}
+ />
+ }
+ style={{
+ fontSize: 12,
+ display: 'flex',
+ alignItems: 'center',
+ }}
+ onClick={handleIconRemove}
+ disabled={isErrorCodeFormReadOnly}
+ />
+
+
+