Skip to content

Commit c92cf04

Browse files
committed
feat: add openUrl function when clicking external url
1 parent 634fe5d commit c92cf04

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/entities/slope/model/model.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type WebcamRaw = {
1717
number: number;
1818
description: string;
1919
url: string;
20+
isExternal?: boolean;
2021
};
2122

2223
export type SlopeResponse = {

src/features/slope/ui/slope-camera.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface SlopeWebcamProps {
2424

2525
const SlopeCamera = ({
2626
isWebview = false,
27-
webcam: { scale, name, position, url, id },
27+
webcam: { scale, name, position, url, id, isExternal },
2828
webcamScale,
2929
isOpen,
3030
containerRef,
@@ -45,8 +45,6 @@ const SlopeCamera = ({
4545
}, [id, updateCameraPosition, cameraRef]);
4646

4747
const openVideo = () => {
48-
setOpenCamera();
49-
5048
if (!url) {
5149
postAppMessage('showToast', '선택한 웹캠은 아직 준비중 이에요', isWebview, (message) =>
5250
toast(
@@ -55,6 +53,13 @@ const SlopeCamera = ({
5553
</>
5654
)
5755
);
56+
return;
57+
}
58+
59+
if (isExternal) {
60+
postAppMessage('openUrl', url, isWebview, () => window.open(url, '_blank'));
61+
} else {
62+
setOpenCamera();
5863
}
5964
};
6065

0 commit comments

Comments
 (0)