Skip to content

Commit c77e7b9

Browse files
committed
user analyze camera
1 parent 3d2c158 commit c77e7b9

File tree

2 files changed

+41
-7
lines changed

2 files changed

+41
-7
lines changed

front/fe-rw/src/pages/user/MainPage.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const MainPage = () => {
9999
}}
100100
>
101101
{/* 물방울 효과 */}
102-
{bubbles.map((bubble) => (
102+
{bubbles.map((풍선껌) => (
103103
<div
104104
key={bubble.id}
105105
className="absolute rounded-full bg-white"
@@ -139,8 +139,8 @@ const MainPage = () => {
139139

140140
{/* 콘텐츠 */}
141141
<div className="relative z-10">
142-
<p className="m-0 font-bold text-5xl md:text-4xl">{menuName}</p>
143-
<span className="text-xl md:text-xl text-gray-700 mt-1 px-1 leading-tight">
142+
<p className="m-0 font-bold text-3xl md:text-4xl">{menuName}</p>
143+
<span className="text-sm md:text-xl text-gray-700 mt-1 px-1 leading-tight">
144144
{description}
145145
</span>
146146
</div>

front/fe-rw/src/pages/user/StainAnalyzePage.jsx

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const StainAnalyzePage = () => {
88
const stainFileInputRef = useRef(null);
99
const navigate = useNavigate();
1010
const videoRef = useRef(null);
11+
const galleryInputRef = useRef(null);
1112
const canvasRef = useRef(null);
1213

1314
const [stainFile, setStainFile] = useState(null);
@@ -253,6 +254,9 @@ const StainAnalyzePage = () => {
253254
if (stainFileInputRef.current) {
254255
stainFileInputRef.current.value = "";
255256
}
257+
if (galleryInputRef.current) {
258+
galleryInputRef.current.value = "";
259+
}
256260
};
257261

258262
const handleStainOptionChange = (e) => {
@@ -271,7 +275,9 @@ const StainAnalyzePage = () => {
271275

272276
if (stainFileInputRef.current) {
273277
stainFileInputRef.current.value = "";
274-
stainFileInputRef.current.click();
278+
}
279+
if (galleryInputRef.current) {
280+
galleryInputRef.current.value = "";
275281
}
276282
} else if (option === "사진 찍기") {
277283
// HTTP 환경에서는 직접 카메라 접근 불가
@@ -357,20 +363,48 @@ const StainAnalyzePage = () => {
357363
disabled={loading}
358364
/>
359365

366+
{stainSelectedOption === "사진 찍기" && !stainImage && !useWebcam && (
367+
<div className="mt-4">
368+
<button
369+
onClick={() => {
370+
if (stainFileInputRef.current) {
371+
stainFileInputRef.current.click();
372+
}
373+
}}
374+
disabled={loading}
375+
className="w-full py-3 bg-blue-500 text-white rounded-md font-medium disabled:bg-gray-400 transition-colors"
376+
>
377+
📱 사진 직접 찍기
378+
</button>
379+
</div>
380+
)}
381+
382+
{/* 사진 보관함용 input - capture 없음 */}
383+
<input
384+
type="file"
385+
accept="image/*"
386+
// capture 속성 없음! 갤러리만 열림
387+
onChange={handleStainImageUpload}
388+
className="hidden"
389+
ref={galleryInputRef}
390+
disabled={loading}
391+
/>
392+
360393
{stainSelectedOption === "사진 보관함" &&
361394
!stainImage &&
362395
!useWebcam && (
363396
<div className="mt-4">
364397
<button
365398
onClick={() => {
366-
if (stainFileInputRef.current) {
367-
stainFileInputRef.current.click();
399+
if (galleryInputRef.current) {
400+
// 다른 ref 사용!
401+
galleryInputRef.current.click();
368402
}
369403
}}
370404
disabled={loading}
371405
className="w-full py-3 bg-blue-500 text-white rounded-md font-medium disabled:bg-gray-400 transition-colors"
372406
>
373-
📱 사진 보관함에서 선택
407+
📱 사진 보관함에서 가져오기
374408
</button>
375409
</div>
376410
)}

0 commit comments

Comments
 (0)