Skip to content

Commit 2ed0330

Browse files
committed
feat: 프레임 시퀀스 불러올 때 로딩 띄우기 - close #36
1 parent 1fc9c7a commit 2ed0330

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/features/videoEditor/components/TrimSlider.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ import PropTypes from "prop-types";
66
const THUMB_W = 60;
77
const THUMB_H = 60;
88

9-
const TrimSlider = ({ width, duration, videoSrc, trim, onChange }) => {
9+
const TrimSlider = ({
10+
width,
11+
duration,
12+
videoSrc,
13+
trim,
14+
onChange,
15+
setIsLoading,
16+
}) => {
1017
const [thumbs, setThumbs] = useState([]);
1118
const videoEl = useRef(null);
1219
const count = Math.max(8, Math.ceil(width / THUMB_W));
@@ -53,7 +60,7 @@ const TrimSlider = ({ width, duration, videoSrc, trim, onChange }) => {
5360
for (let i = 0; i < count; i += 1) {
5461
list.push(await grab((duration * i) / (count - 1)));
5562
}
56-
63+
setIsLoading(false);
5764
setThumbs(list);
5865
};
5966

@@ -113,6 +120,7 @@ TrimSlider.propTypes = {
113120
videoSrc: PropTypes.string.isRequired,
114121
trim: PropTypes.arrayOf(PropTypes.number).isRequired,
115122
onChange: PropTypes.func.isRequired,
123+
setIsLoading: PropTypes.func.isRequired,
116124
};
117125

118126
export default TrimSlider;

src/features/videoSubmit/components/VideoSubmitModal.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ const VideoSubmitModal = ({
3636
setIsLoading(true);
3737

3838
await axios.post("/api/edit", {
39+
videoId,
3940
trimStart: trim[0],
4041
trimEnd: trim[1],
41-
videoId,
42-
selectedCharacter,
4342
email,
43+
selectedCharacter,
4444
});
4545

4646
setIsLoading(false);

src/pages/VideoEditor.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import useVideoEditor from "@/features/videoEditor/hooks/useVideoEditor";
88
import VideoSubmitModal from "@/features/videoSubmit/components/VideoSubmitModal";
99
import Button from "@/shared/components/Button";
1010
import ErrorModal from "@/shared/components/ErrorModal";
11+
import LoadingModal from "@/shared/components/LoadingModal";
1112

1213
const VideoEditor = () => {
1314
const location = useLocation();
@@ -34,6 +35,7 @@ const VideoEditor = () => {
3435
const videoWrapperRef = useRef(null);
3536
const [playerWidth, setPlayerWidth] = useState(0);
3637
const [step, setStep] = useState(1);
38+
const [isLoading, setIsLoading] = useState(true);
3739

3840
useEffect(() => {
3941
if (!videoWrapperRef.current) {
@@ -88,6 +90,7 @@ const VideoEditor = () => {
8890
videoSrc={videoSrc}
8991
onChange={handleTrimChange}
9092
width={playerWidth}
93+
setIsLoading={setIsLoading}
9194
/>
9295
<Button onClick={handleEdit}>편집 요청</Button>
9396
</div>
@@ -103,6 +106,7 @@ const VideoEditor = () => {
103106
)}
104107
</div>
105108
)}
109+
{isLoading && <LoadingModal />}
106110
{error && (
107111
<ErrorModal onClose={closeError} onClick={closeError} message={error} />
108112
)}

0 commit comments

Comments
 (0)