Skip to content

Commit

Permalink
🎨 优化icon读取
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Jul 10, 2024
1 parent 1e82fe4 commit e0130ec
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/pages/options/routes/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,23 @@ export function ScriptIcons({ script, size = 32, style }: ScriptIconsProps) {
style = style || {};
style.display = style.display || "inline-block";
style.marginRight = style.marginRight || "8px";
let icon = "";
if (script.metadata.icon) {
[icon] = script.metadata.icon;
} else if (script.metadata.iconurl) {
[icon] = script.metadata.iconurl;
} else if (script.metadata.icon64) {
[icon] = script.metadata.icon64;
} else if (script.metadata.icon64url) {
[icon] = script.metadata.icon64url;
}
if (icon) {
return (
<Avatar size={size || 32} shape="square" style={style}>
<img src={script.metadata.icon[0]} alt={script?.name} />
<img src={icon} alt={script?.name} />
</Avatar>
);
}
// eslint-disable-next-line react/jsx-no-useless-fragment
return <></>;
}

0 comments on commit e0130ec

Please sign in to comment.