Skip to content

Commit

Permalink
fix: 영상 공개, 비공개 처리시 url 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
milk717 committed Nov 24, 2023
1 parent 09b6fc0 commit 3594bae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { truncateText } from '@/utils/textUtils';
type VideoShareModalProps = {
videoId: number;
videoName: string;
isPublic: boolean;
hash: string | null;
isOpen: boolean;
closeModal: () => void;
};
const VideoShareModal: React.FC<VideoShareModalProps> = ({
videoId,
videoName,
isPublic,
hash,
isOpen,
closeModal,
}) => {
Expand All @@ -43,11 +43,11 @@ const VideoShareModal: React.FC<VideoShareModalProps> = ({
'로딩중' //TODO 디자인은 임시입니다.
) : (
<ShareRangeSetting
isPublic={isPublic}
isPublic={!!hash}
onClick={handleVideoShareToggleClick}
/>
)}
<VideoShareModalFooter hashUrl={data?.hash} closeModal={closeModal} />
<VideoShareModalFooter hash={hash} closeModal={closeModal} />
</div>
</Modal>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@ import Button from '@foundation/Button/Button';
import { theme } from '@styles/theme';
import { css } from '@emotion/react';
import LightButton from '@common/LightButton/LightButton';
import { BASE_URL } from '@constants/api';
import { PATH } from '@constants/path';

type VideoShareModalFooterProps = {
hashUrl?: string | null;
hash?: string | null;
closeModal: () => void;
};

const VideoShareModalFooter: React.FC<VideoShareModalFooterProps> = ({
hashUrl,
closeModal,
hash,
}) => {
const handleCopyLink = async () => {
if (hashUrl) {
if (hash) {
try {
await navigator.clipboard.writeText(
`${BASE_URL}${PATH.INTERVIEW_VIDEO_PUBLIC(hashUrl)}`
`https://gomterview.com${PATH.INTERVIEW_VIDEO_PUBLIC(hash)}`
);
alert('링크 복사됨'); //TODO 현재는 alert이지만 추후에 Toast로 변경 예정
} catch (e) {
Expand All @@ -37,7 +36,7 @@ const VideoShareModalFooter: React.FC<VideoShareModalFooterProps> = ({
>
<LightButton
onClick={() => void handleCopyLink()}
disabled={!hashUrl}
disabled={!hash}
css={css`
border: 1px solid ${theme.colors.border.default};
background-color: transparent;
Expand Down
2 changes: 1 addition & 1 deletion FE/src/page/interviewVideoPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const InterviewVideoPage: React.FC = () => {
<VideoShareModal
videoId={Number(data.id)}
videoName={data.videoName}
isPublic={!!data?.hash}
hash={data.hash}
isOpen={isOpen}
closeModal={() => setIsOpen(false)}
/>
Expand Down

0 comments on commit 3594bae

Please sign in to comment.