@j2inn/app-react
Version:
React implementation of the j2inn-app framework
25 lines (24 loc) • 951 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
/*
* Copyright (c) 2025, J2 Innovations. All Rights Reserved
*/
import { getIcon, hasIcon, icons } from '@j2inn/ui';
import { RemoteResources } from './RemoteResources';
import { RemoteView } from './RemoteView';
export const RemoteAppIconRenderer = ({ view, appProps, }) => {
const path = view.iconPath;
if (!path) {
return _jsx(icons.DefaultIcon, {});
}
const isReact = isReactComponent(path);
// Optimize the call so no remote scripts are loaded just to display
// the application icon.
if (!isReact && hasIcon(path)) {
const RemoteIcon = getIcon(path);
return _jsx(RemoteIcon, {});
}
return (_jsx(RemoteResources, { scope: view.podName, urls: view.resourcesUrls, children: _jsx(RemoteView, { isReactComponent: isReact, path: path, view: view, ...appProps }) }));
};
function isReactComponent(path) {
return path.startsWith('./');
}