Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix journal image problem #2291

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iSunFA",
"version": "0.8.0+66",
"version": "0.8.0+67",
"private": false,
"scripts": {
"dev": "next dev",
Expand Down
10 changes: 6 additions & 4 deletions src/components/journal_detail/journal_detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,11 @@ const JournalDetail = ({ journalId }: IJournalDetailProps) => {
};
});

// Info: (20240726 - Murky) 如果略過 OCR,預覽圖片會是預設的圖片
const invoicePreviewSrc = imgSrcHasError
? '/elements/default_certificate.svg'
: (journalDetail?.imageUrl ?? '');
/* Info: (20240726 - Murky) 如果略過 OCR,預覽圖片會是預設的圖片
* 順序是:畫面載入 => journalDetail 不存在 => 預設圖片 => journalDetail載入 => 頁面更新
*/
const invoicePreviewSrc =
journalDetail && !imgSrcHasError ? journalDetail.imageUrl : '/elements/default_certificate.svg';

const copyTokenContractHandler = () => {
navigator.clipboard.writeText(contractId);
Expand Down Expand Up @@ -569,6 +570,7 @@ const JournalDetail = ({ journalId }: IJournalDetailProps) => {
width={236}
height={300}
alt="certificate"
priority
onError={(e) => {
if (e && !imgSrcHasError) {
setImgSrcHasError(true);
Expand Down