Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update frontend/src/pages/Profile.jsx
Browse files- frontend/src/pages/Profile.jsx +70 -36
frontend/src/pages/Profile.jsx
CHANGED
|
@@ -684,46 +684,80 @@ export const Profile = () => {
|
|
| 684 |
className="hidden"
|
| 685 |
/>
|
| 686 |
|
| 687 |
-
{reportLogoUrl
|
| 688 |
-
<
|
| 689 |
-
<
|
| 690 |
-
|
| 691 |
-
|
| 692 |
-
|
| 693 |
-
|
| 694 |
-
|
| 695 |
-
e.target.dataset.retried
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
|
|
|
|
|
|
|
| 702 |
}
|
| 703 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 704 |
}}
|
| 705 |
-
|
| 706 |
-
|
| 707 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 708 |
|
| 709 |
-
|
| 710 |
-
|
| 711 |
-
|
| 712 |
-
|
| 713 |
-
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
|
| 717 |
-
|
| 718 |
-
<span className={`material-symbols-outlined text-[18px] ${uploadingLogo ? 'animate-spin' : ''}`}>
|
| 719 |
-
{uploadingLogo ? 'sync' : 'upload_file'}
|
| 720 |
-
</span>
|
| 721 |
-
<span>{uploadingLogo ? 'Uploading...' : 'Upload Here (Change Logo)'}</span>
|
| 722 |
-
</button>
|
| 723 |
|
| 724 |
-
|
| 725 |
-
|
| 726 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 727 |
</div>
|
| 728 |
</div>
|
| 729 |
</div>
|
|
|
|
| 684 |
className="hidden"
|
| 685 |
/>
|
| 686 |
|
| 687 |
+
{reportLogoUrl ? (
|
| 688 |
+
<>
|
| 689 |
+
<div className="mb-6 p-4 bg-white rounded-xl border border-[#e5e7eb] shadow-xs flex items-center justify-center max-w-sm w-full pointer-events-auto">
|
| 690 |
+
<img
|
| 691 |
+
src={reportLogoUrl}
|
| 692 |
+
alt="Organization Logo"
|
| 693 |
+
className="max-h-24 max-w-full object-contain"
|
| 694 |
+
onError={(e) => {
|
| 695 |
+
if (reportLogoUrl && !e.target.dataset.retried) {
|
| 696 |
+
e.target.dataset.retried = '1';
|
| 697 |
+
if (reportLogoUrl.startsWith('/uploads/')) {
|
| 698 |
+
e.target.src = `/api/auth${reportLogoUrl}`;
|
| 699 |
+
} else if (reportLogoUrl.startsWith('/api/auth/uploads/')) {
|
| 700 |
+
e.target.src = reportLogoUrl.replace('/api/auth', '');
|
| 701 |
+
} else if (!reportLogoUrl.startsWith('http')) {
|
| 702 |
+
e.target.src = `/uploads/logos/${reportLogoUrl.split('/').pop()}`;
|
| 703 |
+
}
|
| 704 |
}
|
| 705 |
+
}}
|
| 706 |
+
/>
|
| 707 |
+
</div>
|
| 708 |
+
|
| 709 |
+
<button
|
| 710 |
+
type="button"
|
| 711 |
+
disabled={uploadingLogo}
|
| 712 |
+
onClick={(e) => {
|
| 713 |
+
e.stopPropagation();
|
| 714 |
+
fileInputRef.current?.click();
|
| 715 |
}}
|
| 716 |
+
className="relative z-20 bg-[#2563eb] hover:bg-[#1d4ed8] text-white font-semibold px-6 py-2.5 rounded-lg flex items-center gap-2 text-sm shadow-xs transition-colors cursor-pointer mb-4 disabled:opacity-50"
|
| 717 |
+
>
|
| 718 |
+
<span className={`material-symbols-outlined text-[18px] ${uploadingLogo ? 'animate-spin' : ''}`}>
|
| 719 |
+
{uploadingLogo ? 'sync' : 'upload_file'}
|
| 720 |
+
</span>
|
| 721 |
+
<span>{uploadingLogo ? 'Uploading...' : 'Upload Here (Change Logo)'}</span>
|
| 722 |
+
</button>
|
| 723 |
|
| 724 |
+
<p className="text-[#6b7280] text-sm m-0 font-normal pointer-events-none">
|
| 725 |
+
Or drag and drop a new logo file above (PNG, JPG, WebP, SVG up to 5MB)
|
| 726 |
+
</p>
|
| 727 |
+
</>
|
| 728 |
+
) : (
|
| 729 |
+
<>
|
| 730 |
+
<div className="w-12 h-12 rounded-full bg-[#eff6ff] flex items-center justify-center mb-3">
|
| 731 |
+
<span className="material-symbols-outlined text-[#2563eb] text-[28px]">cloud_upload</span>
|
| 732 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 733 |
|
| 734 |
+
<h4 className="font-bold text-[#111827] text-base mb-1 m-0">
|
| 735 |
+
Upload Organization Logo
|
| 736 |
+
</h4>
|
| 737 |
+
<p className="text-[#6b7280] text-xs mb-5 m-0 font-normal">
|
| 738 |
+
Upload your custom logo to brand all PDF security reports
|
| 739 |
+
</p>
|
| 740 |
+
|
| 741 |
+
<button
|
| 742 |
+
type="button"
|
| 743 |
+
disabled={uploadingLogo}
|
| 744 |
+
onClick={(e) => {
|
| 745 |
+
e.stopPropagation();
|
| 746 |
+
fileInputRef.current?.click();
|
| 747 |
+
}}
|
| 748 |
+
className="relative z-20 bg-[#2563eb] hover:bg-[#1d4ed8] text-white font-semibold px-6 py-2.5 rounded-lg flex items-center gap-2 text-sm shadow-xs transition-colors cursor-pointer mb-4 disabled:opacity-50"
|
| 749 |
+
>
|
| 750 |
+
<span className={`material-symbols-outlined text-[18px] ${uploadingLogo ? 'animate-spin' : ''}`}>
|
| 751 |
+
{uploadingLogo ? 'sync' : 'upload_file'}
|
| 752 |
+
</span>
|
| 753 |
+
<span>{uploadingLogo ? 'Uploading...' : 'Upload Here'}</span>
|
| 754 |
+
</button>
|
| 755 |
+
|
| 756 |
+
<p className="text-[#6b7280] text-xs m-0 font-normal pointer-events-none">
|
| 757 |
+
Supported formats: PNG, JPG, WebP, SVG (Max 5MB)
|
| 758 |
+
</p>
|
| 759 |
+
</>
|
| 760 |
+
)}
|
| 761 |
</div>
|
| 762 |
</div>
|
| 763 |
</div>
|