Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
feat: add a fallback icon for extensions that do not have an icon (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Oct 8, 2021
1 parent 58ceda4 commit 50de1f2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/components/atoms/Icon/Icons/plugin.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/components/atoms/Icon/icons.ts
Expand Up @@ -118,7 +118,8 @@ import MenuForDevice from "./Icons/menuForDevice.svg";
import Moon from "./Icons/moon.svg";
import Sun from "./Icons/sun.svg";

// Plugi-ins
// Plug-ins
import Plugin from "./Icons/plugin.svg";
import UploadZipPlugin from "./Icons/uploadZipPlugin.svg";
import PublicGitHubRepo from "./Icons/publicGitHubRepo.svg";
import PrivateGitHubRepo from "./Icons/privateGitHubRepo.svg";
Expand Down Expand Up @@ -228,4 +229,5 @@ export default {
privateGitHubRepo: PrivateGitHubRepo,
publicGitHubRepo: PublicGitHubRepo,
menuForDevice: MenuForDevice,
plugin: Plugin,
};
5 changes: 2 additions & 3 deletions src/components/organisms/EarthEditor/CanvasArea/convert.ts
Expand Up @@ -271,9 +271,8 @@ export const convertToBlocks = (data?: GetBlocksQuery): BlockType[] | undefined
icon:
extension.icon ||
// for official plugin
(plugin.plugin.id === "reearth"
? extension.extensionId.replace(/block$/, "")
: ""),
(plugin.plugin.id === "reearth" && extension.extensionId.replace(/block$/, "")) ||
"plugin",
name: extension.name,
description: extension.description,
pluginId: plugin.plugin.id,
Expand Down
2 changes: 1 addition & 1 deletion src/components/organisms/EarthEditor/OutlinePane/hooks.tsx
Expand Up @@ -96,7 +96,7 @@ export default () => {
enabled: !!widget?.enabled,
title: e.translatedName,
description: e.translatedDescription,
icon: e.icon || (pluginId === "reearth" ? extensionId : undefined),
icon: e.icon || (pluginId === "reearth" && extensionId) || "plugin",
};
})
.filter((w): w is Widget => !!w);
Expand Down

0 comments on commit 50de1f2

Please sign in to comment.