Skip to content
Merged
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
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
root: true,
extends: ["next", "next/core-web-vitals", "eslint:recommended", "plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-object-type": "off",
"no-empty": "off",
"no-case-declarations": "off",
"react/no-unescaped-entities": "off",
"@next/next/no-img-element": "off",
"react-hooks/exhaustive-deps": "off",
"prefer-const": "off",
},
};
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy Frontend to EC2

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup SSH key
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.EC2_SSH_KEY }}

- name: Deploy Frontend to EC2
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }} -p ${{ secrets.EC2_PORT }} << 'EOF'
cd /home/ec2-user/easyToFind-Frontend

echo "NEXT_PUBLIC_API_BASE_URL=${{ secrets.NEXT_PUBLIC_API_BASE_URL }}" > .env.local
git pull origin main

pnpm install
pnpm run build
pm2 restart easytofind-frontend
EOF
16 changes: 0 additions & 16 deletions eslint.config.mjs

This file was deleted.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
"@nivo/pie": "^0.99.0",
"@radix-ui/react-label": "^2.1.7",
"@radix-ui/react-progress": "^1.1.7",
"@radix-ui/react-slider": "^1.3.5",
"@radix-ui/react-slot": "^1.2.3",
"@tanstack/react-query": "^5.83.0",
<<<<<<< Updated upstream
"@tanstack/react-query-devtools": "^5.83.0",
=======
>>>>>>> Stashed changes
"@types/react-datepicker": "^7.0.0",
"apexcharts": "^5.3.0",
"class-variance-authority": "^0.7.1",
Expand Down
170 changes: 164 additions & 6 deletions pnpm-lock.yaml

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

3 changes: 1 addition & 2 deletions src/app/(pages)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export default function LoginPage() {
}
setLoading(true);
try {
const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL;
const res = await fetch(`${API_BASE_URL}/api/auth/login`, {
const res = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/auth/login`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
Expand Down
6 changes: 3 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export default function Home() {
const router = useRouter();

const apiUrls = [
'http://localhost:3001/api/main/aum',
'http://localhost:3001/api/main/fluc',
'http://localhost:3001/api/main/volume'
`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/main/aum`,
`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/main/fluc`,
`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/main/volume`
];

useEffect(() => {
Expand Down
2 changes: 0 additions & 2 deletions src/components/blocks/ETFDetail/ETFDetailHoldings.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import { useQuery } from "@tanstack/react-query";
// 한국어로 포맷팅
registerLocale("ko", ko);

interface ETFHoldingsData extends ETFHoldingsWithStock {}

// 캘린더 커스텀
const customDatePickerStyles = `
.react-datepicker-wrapper {
Expand Down
8 changes: 3 additions & 5 deletions src/components/blocks/me/mbti/ResultComponent.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export default function ResultComponentClient({ riskType, theme, riskScore }: Pr
//결과 불러오기
useEffect(() => {
const fetchData = async () => {
const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL;
let url = `${API_BASE_URL}/api/recommendation`;
let url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/recommendation`;
let body: any = {};

if (Array.isArray(riskScore) && riskScore.length === 4) {
Expand All @@ -39,7 +38,7 @@ export default function ResultComponentClient({ riskType, theme, riskScore }: Pr
}

if (selectedTab === "theme") {
url = `${API_BASE_URL}/api/recommendation/theme`;
url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/recommendation/theme`;
body.theme = theme;
}

Expand All @@ -59,14 +58,13 @@ export default function ResultComponentClient({ riskType, theme, riskScore }: Pr
//결과 저장
useEffect(() => {
const fetchData = async () => {
const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL;
// riskScore 정규화 함수
const normalize = (arr: number[]) => {
const sum = arr.reduce((a, b) => a + b, 0);
return sum === 0 ? [0.25, 0.25, 0.25, 0.25] : arr.map(v => v / sum);
};
const [stabilityWeight, liquidityWeight, growthWeight, divWeight] = normalize(riskScore);
const response = await fetch(`${API_BASE_URL}/api/me/mbti`, {
const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/me/mbti`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Expand Down
Loading