Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node
FROM node:16-alpine
RUN mkdir /app
WORKDIR /app
COPY . ./
Expand Down
9 changes: 2 additions & 7 deletions frontend/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ export async function post_storge(resultData: result, user: User) {
fish_url: resultData.image_url,
fish_id: resultData.model,
};
await axios.post(
`http://www.deepblue3.shop:8000/api/history/${user.id}`,
body,
);
await axios.post(`${BASE_URL}history/${user.id}`, body);
}

export async function get_storage(user: User): Promise<resultType[]> {
const res = await axios.get(
`http://www.deepblue3.shop:8000/api/history/${user.id}`,
);
const res = await axios.get(`${BASE_URL}/history/${user.id}`);
return res.data;
}
17 changes: 15 additions & 2 deletions frontend/package-lock.json

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

3 changes: 3 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"autoprefixer": "10.4.13",
"axios": "1.2.2",
"chart.js": "^4.2.0",
"debounce": "^1.2.1",
"lodash": "^4.17.21",
"postcss": "8.4.20",
"react": "^18.2.0",
"react-apexcharts": "^1.4.0",
Expand All @@ -30,6 +32,7 @@
"tailwindcss": "3.2.4"
},
"devDependencies": {
"@types/debounce": "^1.2.1",
"@types/node": "18.11.18",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
Expand Down
41 changes: 0 additions & 41 deletions frontend/src/App.css

This file was deleted.

10 changes: 2 additions & 8 deletions frontend/src/components/DetailFishList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { fishInform } from '@/mocks/handlers';
import { ResultData, ResultData2 } from '@/type/result';
import { modalData } from '@/type/detail';
import React from 'react';
import './index.scss';

export interface result extends ResultData {
fish_url: string;
fish_type: string;
}

interface fishInfromProps extends result {
interface fishInfromProps extends modalData {
setModal: React.Dispatch<React.SetStateAction<boolean>>;
modal: boolean;
}
Expand Down
19 changes: 8 additions & 11 deletions frontend/src/components/insertImage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
import Nav from '@/components/nav';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import Loading from '../loading';
import download from '@/assets/download.png';
import './index.scss';
import { useDropzone } from 'react-dropzone';
import { useNavigate } from 'react-router-dom';
import { useMutation } from '@tanstack/react-query';
import { restFetcher } from '@/queryClient';
import Loading2 from '../loading2';

const InsertImage = () => {
const navigate = useNavigate();
const imageRef = useRef<HTMLInputElement>(null);
const [imagefile, setImageFile] = useState<File>();
const [preview, setPreview] = useState<string>('');

const { mutate, isLoading, isSuccess, isError } = useMutation(
(formData: FormData) => {
return restFetcher({
method: 'POST',
path: 'http://www.deepblue3.shop:8000/api/ai',
body: formData,
});
},
);
const { mutate, isLoading } = useMutation((formData: FormData) => {
return restFetcher({
method: 'POST',
path: '/ai',
body: formData,
});
});

//이미지 클릭시 file선택창이 나오게하는 함수
const openFile = () => {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/loading2/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import './index.scss';
//사진 올려서 돌릴떄 스켈레톤 ui
const Loading2 = () => {
return (
<div className="loading2">
Expand Down
9 changes: 3 additions & 6 deletions frontend/src/components/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ const LoginComponent = () => {
const [pw, setPw] = useState('');
const setUserInform = useSetRecoilState<User>(UUid);

const { mutate, isLoading, isError } = useMutation((user: userType) => {
const { mutate } = useMutation((user: userType) => {
return restFetcher({
method: 'POST',
path: 'http://www.deepblue3.shop:8000/api/users/login',
path: `${BASE_URL}/users/login`,
params: user,
});
});
Expand All @@ -45,9 +45,7 @@ const LoginComponent = () => {
localStorage.setItem('access_token', data.access_token);
navigator('/');

const result = await axios.get(
`http://www.deepblue3.shop:8000/api/users?skip=0&limit=100`,
);
const result = await axios.get(`${BASE_URL}/users?skip=0&limit=100`);
const findUser = result.data.find(
(item: AllUser) => item.username == data.username,
);
Expand All @@ -70,7 +68,6 @@ const LoginComponent = () => {
onChange={(e) => {
setId(e.target.value);
}}
//onKeyup={changeButton}
/>
</div>

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/nav/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { Link, useMatch, useNavigate } from 'react-router-dom';
import home from '../../assets/home.png';
import './index.scss';
import logo from '../../assets/logo.png';
import { useRecoilState } from 'recoil';
import { useSetRecoilState } from 'recoil';
import { User } from '../signup';
import { UUid } from '@/atom/atom';

const Nav = () => {
const main = useMatch('/');
const storage = useMatch('/storage');
Expand All @@ -17,7 +17,7 @@ const Nav = () => {
const gotoMain = () => {
navigator('/');
};
const [userInform, setUserInform] = useRecoilState<User>(UUid);
const setUserInform = useSetRecoilState<User>(UUid);
const goLogout = () => {
alert('로그아웃되었습니다!');
setUserInform({
Expand Down
18 changes: 4 additions & 14 deletions frontend/src/components/signup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { UUid } from '@/atom/atom';
import { restFetcher } from '@/queryClient';
import { useMutation } from '@tanstack/react-query';
import React, { useState } from 'react';
import './index.scss';
//유저생성

export interface User extends createUser {
id: string;
is_active?: boolean;
Expand All @@ -22,20 +21,15 @@ const SignUpComponents = () => {
const [pw, setPw] = useState('');
const [checkPw, setCheckPw] = useState('');

const [button, setButton] = useState(true);

function changeButton() {
id.includes('@') && pw.length >= 5 ? setButton(false) : setButton(true);
}

const { mutate, isLoading } = useMutation((newUser: createUser) => {
const { mutate } = useMutation((newUser: createUser) => {
return restFetcher({
method: 'POST',
path: '/users/signup',
body: newUser,
});
});

//유저 생성
const createUser = () => {
const newUser = {
name: userName,
Expand All @@ -44,7 +38,7 @@ const SignUpComponents = () => {
password_check: checkPw,
};
mutate(newUser, {
onSuccess: (data) => {
onSuccess: () => {
alert('회원가입 완료!');
},
onError: () => {
Expand All @@ -66,7 +60,6 @@ const SignUpComponents = () => {
onChange={(e) => {
setUserName(e.target.value);
}}
onKeyUp={changeButton}
/>
</div>
<div className="user_input">
Expand All @@ -79,7 +72,6 @@ const SignUpComponents = () => {
onChange={(e) => {
setId(e.target.value);
}}
//onKeyup={changeButton}
/>
</div>
<div className="user_input">
Expand All @@ -93,7 +85,6 @@ const SignUpComponents = () => {
onChange={(e) => {
setPw(e.target.value);
}}
onKeyUp={changeButton}
/>
</div>
<div className="user_input">
Expand All @@ -107,7 +98,6 @@ const SignUpComponents = () => {
onChange={(e) => {
setCheckPw(e.target.value);
}}
onKeyUp={changeButton}
/>
</div>
<button onClick={createUser} className="signup_page_button">
Expand Down
1 change: 0 additions & 1 deletion frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { worker } from './mocks/worker';
import { getClient } from './queryClient';
import * as Sentry from '@sentry/react';
import { BrowserTracing } from '@sentry/tracing';
import reset from './reset.scss';
import axios from 'axios';
// if (import.meta.env.DEV) {
// worker.start();
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/page/chart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import inline from '@/assets/inline.png';
import bar from '@/assets/var.png';
import { useQuery } from '@tanstack/react-query';
import { restFetcher } from '@/queryClient';
import { debounce } from 'debounce';
type chartType = 'line' | 'area' | 'bar' | 'radar' | undefined;

const ChartPage = () => {
Expand All @@ -20,7 +21,7 @@ const ChartPage = () => {
const { data } = useQuery<any>(['CHAT'], async () => {
return restFetcher({
method: 'GET',
path: 'http://www.deepblue3.shop:8000/api/charts/',
path: '/charts/',
});
});

Expand Down Expand Up @@ -52,12 +53,11 @@ const ChartPage = () => {
height: window.innerHeight,
});
};

useEffect(() => {
window.addEventListener('resize', handleResize);
window.addEventListener('resize', debounce(handleResize, 1000));

return () => {
window.removeEventListener('resize', handleResize);
window.removeEventListener('resize', debounce(handleResize, 1000));
};
}, [windowSize]);

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/page/login/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React from 'react';
import './index.scss';
import Is_login_check from './is_login';
import Whale from '@/assets/whale.png';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/page/login/is_login.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import Login_page from './loginpage';
import './index.scss';
function Is_login_check({ round = false }) {
function Is_login_check() {
const [is_login, set_is_login] = useState(true);

const set_toggle = (e: React.MouseEvent<HTMLButtonElement>) => {
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/page/login/loginpage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useState } from 'react';
import whale from '@/assets/png_whale2.jpeg';
import React from 'react';
import LoginComponent from '@/components/login';
import SignUpComponents from '@/components/signup';
import './index.scss';

interface Props {
is_login: boolean;
}

const Login_page = ({ is_login }: Props) => {
const is_login_page = is_login;

Expand Down
Loading