Skip to content

Commit

Permalink
#285 Use RmgAppClip from rmg-components
Browse files Browse the repository at this point in the history
  • Loading branch information
wongchito committed May 7, 2023
1 parent 2ba4386 commit 8c7439c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@chakra-ui/react": "^2.6.0",
"@emotion/react": "^11.10.8",
"@emotion/styled": "^11.10.8",
"@railmapgen/rmg-components": "^7.1.2",
"@railmapgen/rmg-components": "^7.1.4",
"@railmapgen/rmg-runtime": "^5.0.1",
"@railmapgen/rmg-templates-resources": "file:package/dist",
"@railmapgen/rmg-translate": "^2.0.2",
Expand Down
25 changes: 15 additions & 10 deletions src/components/app-clip/rmg-param-app-clip.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import { Modal, ModalContent, ModalOverlay } from '@chakra-ui/react';
import { SystemStyleObject } from '@chakra-ui/react';
import { useEffect, useState } from 'react';
import rmgRuntime from '@railmapgen/rmg-runtime';
import { useRootDispatch } from '../../redux';
import { RmgAppClip } from '@railmapgen/rmg-components';

const CHANNEL_PREFIX = 'rmg-bridge--';

const styles: SystemStyleObject = {
h: 500,
maxH: '70%',

'& iframe': {
h: '100%',
w: '100%',
},
};

interface RmgAppClipProps {
templateId?: string;
onClose: () => void;
Expand All @@ -14,8 +24,6 @@ interface RmgAppClipProps {
export default function RmgParamAppClip(props: RmgAppClipProps) {
const { templateId, onClose, onImport } = props;

const dispatch = useRootDispatch();

const [appClipId] = useState(crypto.randomUUID());
const frameUrl =
'/rmg/import?' +
Expand All @@ -42,11 +50,8 @@ export default function RmgParamAppClip(props: RmgAppClipProps) {
}, [templateId]);

return (
<Modal isOpen={!!templateId} onClose={onClose}>
<ModalOverlay />
<ModalContent h={500} maxH="70%">
<iframe src={frameUrl} loading="lazy" width="100%" height="100%" />
</ModalContent>
</Modal>
<RmgAppClip isOpen={!!templateId} onClose={onClose} sx={styles}>
<iframe src={frameUrl} loading="lazy" />
</RmgAppClip>
);
}
1 change: 1 addition & 0 deletions src/i18n/translations/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"Please provide suitable source and justification.": "请您提供适当的来源和理由。",
"Railway company": "铁路公司",
"Remove": "删除",
"Remove this line": "删除此线路",
"Size": "大小",
"Style": "风格",
"Submit templates": "提交模板",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/translations/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"Please provide suitable source and justification.": "請你提供適當的來源及理由。",
"Railway company": "鐵路公司",
"Remove": "移除",
"Remove this line": "移除此路線",
"Size": "大小",
"Style": "風格",
"Submit templates": "提交範本",
Expand Down

0 comments on commit 8c7439c

Please sign in to comment.