Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 더보기 api 연동 및 jwt 인증 로직 구현, 홈 인디케이터를 고려한 css 수정 #23

Merged
merged 25 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
93a1b81
fix: swift와 로그인 시 통신 연결
urimeee Dec 29, 2024
8fbfd75
feat: swift와 로그아웃 통신 추가
urimeee Dec 29, 2024
d014b51
chore: 배포를 위한 yml 파일 추가
urimeee Dec 29, 2024
395c66f
feat: 배포를 위한 shell 파일 추가
urimeee Dec 29, 2024
28076e4
feat: swift 회원탈퇴 통신 연결
urimeee Dec 29, 2024
3cd4374
fix: 더보기 화면 오류 해결
urimeee Dec 30, 2024
044385d
feat: 폰트 ttf 파일 제거 및 woff2 가변 폰트 추가
urimeee Dec 30, 2024
1cacf46
feat: Pretendard 폰트 적용
urimeee Dec 30, 2024
d211bfe
chore: 엔드 포인트 및 토큰 값 업데이트
urimeee Jan 21, 2025
74d2662
chore: api 엔드 포인트 수정
urimeee Jan 23, 2025
e39eb5e
feat: jwt 토큰 저장
urimeee Feb 4, 2025
17b80cc
chores: axios 설치
urimeee Feb 5, 2025
67d71a3
chores: axios 설치
urimeee Feb 5, 2025
d928953
feat: jwt 인증 프로세스 구현
urimeee Feb 5, 2025
2871c81
feat: jwt 인증 과정 구현
urimeee Feb 5, 2025
6e2eb27
choes: 가독성을 위한 개행 추가
urimeee Feb 5, 2025
7b362a3
chores: 사용하지 않는 state 변수 삭제
urimeee Feb 5, 2025
29ab1d7
style: 홈 인디케이터 고려한 바텀 네이게이터 수정
urimeee Feb 7, 2025
7238c4a
feat: axios 인터셉터를 활용한 jwt 로직 구현
urimeee Feb 7, 2025
7a485fd
feat: 더보기 api 연동
urimeee Feb 7, 2025
aaaa486
feat: fetch에서 axios로의 마이그레이션 진행
urimeee Feb 7, 2025
0c8d3ad
chores: 주석 제거
urimeee Feb 7, 2025
ca359fc
chores: 콘솔 로그 삭제
urimeee Feb 7, 2025
ea220d5
feat: scheduleList가 빈배열일 때 추가
urimeee Feb 7, 2025
b3b4c50
feat: 배포상태에서 manifest 오류 해결
urimeee Feb 7, 2025
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
47 changes: 47 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: git push into another repo to deploy to vercel

on:
push:
branches:
- "dev"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18"

- name: creates .env file
run: |
echo "${{ secrets.APPLICATION_ENV }}" | base64 --decode > .env

- name: Create output
run: sh ./build.sh

- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"

- name: Push to another repository
id: push_directory
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.AUTO_ACTIONS }}
with:
source-directory: "output"
destination-github-username: "urimeee"
destination-repository-name: "sohawgi_Front"
user-email: ${{ secrets.EMAIL }}
commit-message: |
${{ github.event.commits[0].message }} / ${{ github.run_id }}
target-branch: ${{ steps.extract_branch.outputs.branch }}
create-target-branch-if-needed: true

- name: Test get variable exported by push-to-another-repository
run: echo $DESTINATION_CLONED_DIRECTORY
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

# misc
.DS_Store

.env
.env.local
.env.development.local
.env.test.local
Expand Down
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
set -e

cd ../
mkdir output
cp -R ./sohawgi_Front/* ./output
cp -R ./output ./sohawgi_Front/

cd sohawgi_Front || exit 1

npm install
CI=false npm run build
32 changes: 32 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/styled-components": "^5.1.34",
"axios": "^1.7.9",
"react": "^18.3.1",
"react-device-detect": "^2.2.3",
"react-dom": "^18.3.1",
Expand Down
Binary file added public/fonts/PretendardVariable.woff2
Binary file not shown.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" charset="utf-8" />
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

Expand All @@ -15,7 +15,7 @@
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="/manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ const ContentWrapper = styled.div`
word-break: break-all;
white-space: normal;
min-width: 340px;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
`;

function App() {
Expand Down
Binary file removed src/assets/fonts/Pretendard-Black.ttf
Binary file not shown.
Binary file removed src/assets/fonts/Pretendard-Bold.ttf
Binary file not shown.
Binary file removed src/assets/fonts/Pretendard-ExtraBold.ttf
Binary file not shown.
Binary file removed src/assets/fonts/Pretendard-ExtraLight.ttf
Binary file not shown.
Binary file removed src/assets/fonts/Pretendard-Light.ttf
Binary file not shown.
Binary file removed src/assets/fonts/Pretendard-Medium.ttf
Binary file not shown.
Binary file removed src/assets/fonts/Pretendard-Regular.ttf
Binary file not shown.
Binary file removed src/assets/fonts/Pretendard-SemiBold.ttf
Binary file not shown.
Binary file removed src/assets/fonts/Pretendard-Thin.ttf
Binary file not shown.
34 changes: 31 additions & 3 deletions src/components/AddPageContainer/AddPageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,38 @@ type Props = {

const AddPageContainer = ({ title, contentTitles }: Props) => {
const onClickHandler = (contentTitle: string) => {
if (EXTERNAL_LINKS[contentTitle]) {
window.open(EXTERNAL_LINKS[contentTitle], 'popup');
if (title === '정보') {
if (EXTERNAL_LINKS[contentTitle]) {
window.open(EXTERNAL_LINKS[contentTitle], 'popup');
} else {
console.log('접근 가능한 링크가 없습니다.');
}
} else {
console.log('접근 가능한 링크가 없습니다.');
// title === '설정'
if (contentTitle === '로그아웃') {
if (
window.webkit &&
window.webkit.messageHandlers &&
window.webkit.messageHandlers.logoutHandler
) {
window.webkit.messageHandlers.logoutHandler.postMessage('logout');
} else {
console.error('Logout handler not found');
}
}
if (contentTitle === '회원탈퇴') {
if (
window.webkit &&
window.webkit.messageHandlers &&
window.webkit.messageHandlers.deleteAccountHandler
) {
window.webkit.messageHandlers.deleteAccountHandler.postMessage(
'deleteAccount',
);
} else {
console.error('DeleteAccount handler not found');
}
}
}
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/BottomNavi/BottomNavi.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const StyledLink = styled(Link)`
`;

export const BottomNavWrapper = styled.div`
position: fixed; /* 하단에 고정 */
bottom: 0;
position: fixed;
bottom: env(safe-area-inset-bottom);
left: 0;
right: 0;
display: flex;
Expand Down Expand Up @@ -58,5 +58,5 @@ export const MoreText = styled.span<{ $isActive: boolean }>`
font-size: ${({ theme }) => theme.fonts.Body_05};
color: ${({ $isActive, theme }) =>
$isActive ? theme.colors.Grey_06 : theme.colors.Grey_02};
text-decoration: none; /* 밑줄 제거 */
text-decoration: none;
`;
19 changes: 11 additions & 8 deletions src/components/ScheduleCard/ScheduleCard.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
import styled from 'styled-components';

export const WrapperContainer = styled.div`
display: grid;
gap: 1.5rem; /* '일정' 텍스트와 그리드 사이 간격 */
width: 100%; /* 부모 요소에 맞게 너비를 조정 */
background-color: ${({ theme }) => theme.colors.White}; /* 배경 색상 추가 */
padding: 1.88rem 1.69rem; /* 내부 여백 추가 */
border-radius: 1.7rem; /* 모서리를 둥글게 */
box-sizing: border-box; /* 패딩을 너비에 포함하여 크기 조정 */ 텍스트 필드와 너비 같이 될 수 있도록
display: grid;
gap: 1.5rem; /* '일정' 텍스트와 그리드 사이 간격 */
width: 100%; /* 부모 요소에 맞게 너비를 조정 */
background-color: ${({ theme }) => theme.colors.White}; /* 배경 색상 추가 */
padding: 1.88rem 1.69rem; /* 내부 여백 추가 */
border-radius: 1.7rem; /* 모서리를 둥글게 */
box-sizing: border-box; /* 패딩을 너비에 포함하여 크기 조정 */
height: fit-content;
텍스트 필드와 너비 같이 될 수 있도록
`;

export const Title = styled.div`
font-family: ${({ theme }) => theme.fonts.Body_01}; /* 테마에 정의된 폰트 스타일 사용 */
font-family: ${({ theme }) =>
theme.fonts.Body_01}; /* 테마에 정의된 폰트 스타일 사용 */
color: ${({ theme }) => theme.colors.Grey_06}; /* 테마에 정의된 색상 사용 */
`;

Expand Down
31 changes: 11 additions & 20 deletions src/components/ScheduleCard/ScheduleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState, useEffect } from 'react';
import ScheduleDetail from '../ScheduleDetail/ScheduleDetail'; // ScheduleDetail 컴포넌트 경로에 맞게 수정
import BottomSheet from '../BottomSheet/BottomSheet'; // BottomSheet 컴포넌트 불러오기
import * as S from './ScheduleCard.style';
import { api } from '../../utils/axios';

interface Schedule {
scheduleId: number;
Expand All @@ -13,33 +14,25 @@ interface Schedule {

const ScheduleCard = () => {
const [isSheetOpen, setSheetOpen] = useState<boolean>(false);
const [scheduleList, setScheduleList] = useState<Schedule[]>([]);
const [scheduleList, setScheduleList] = useState<Schedule[] | null>([]);

const handleSheet = () => {
setSheetOpen(!isSheetOpen);
};

const getSchedules = async () => {
try {
const response = await fetch(
'http://15.165.191.48:8080/api/v1/schedules',
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Nickname': 'jini',
},
credentials: 'include',
},
);
const accessToken = localStorage.getItem('accessToken');
const refreshToken = localStorage.getItem('refreshToken');
const response = await api.get('/schedules');

if (!response.ok) {
if (response.data.length < 0) {
throw new Error(response.statusText);
}

const data = await response.json();
console.log(response);
setScheduleList(data);
// const data = await response.json();
console.log(response.data);
setScheduleList(response.data);
} catch (e) {
console.log(e);
}
Expand All @@ -51,10 +44,9 @@ const ScheduleCard = () => {

return (
<S.WrapperContainer>
<S.Title>일정</S.Title> {/* Title 컴포넌트를 사용하여 스타일 적용 */}
<S.Title>일정</S.Title>
<S.GridContainer>
{/* 여러 개의 ScheduleDetail 컴포넌트를 그리드로 나열 */}
{scheduleList.map((schedule) => (
{scheduleList?.map((schedule) => (
<div key={schedule.scheduleId}>
<ScheduleDetail
title={schedule.title}
Expand All @@ -65,7 +57,6 @@ const ScheduleCard = () => {
</div>
))}
</S.GridContainer>
{/* 바텀시트 컴포넌트 */}
<BottomSheet isOpen={isSheetOpen} onClose={handleSheet} />
</S.WrapperContainer>
);
Expand Down
8 changes: 5 additions & 3 deletions src/components/TextField/TextField.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react';

import * as S from './TextField.style';

const TextField: React.FC = () => {
Expand All @@ -8,12 +9,13 @@ const TextField: React.FC = () => {
const postSchedule = async (e: React.MouseEvent<HTMLButtonElement>) => {
try {
const response = await fetch(
'http://15.165.191.48:8080/api/v1/schedules',
`${process.env.REACT_APP_BASE_SERVER_URL}/schedules`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Nickname': 'jini',
'X-ACCESS-TOKEN': `${process.env.REACT_APP_X_ACCESS_TOKEN}`,
'X-REFRESH-TOKEN': `${process.env.REACT_APP_X_REFRESH_TOKEN}`,
},
credentials: 'include',
body: JSON.stringify({ text: schedule }),
Expand All @@ -38,7 +40,7 @@ const TextField: React.FC = () => {
onBlur={() => setIsFocused(false)}
onChange={(e) => setSchedule(e.target.value)}
/>
<S.Button type="submit" onClick={postSchedule}>
<S.Button type="button" onClick={postSchedule}>
등록
</S.Button>
</S.Form>
Expand Down
13 changes: 9 additions & 4 deletions src/components/UserProfile/UserInfo/UserInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import React from 'react';
import appleIcon from '../../../assets/images/appleIcon.png';
import * as S from './UserInfo.style';
import React from 'react';

const UserInfo = () => {
type Props = {
name: string;
email: string;
};

const UserInfo = ({ name, email }: Props) => {
return (
<div>
<div>구나연</div>
<div>{name}</div>
<S.InfoContainer>
<S.appleImg src={appleIcon} alt={'appleIcon'} />
<div>[email protected]</div>
<div>{email}</div>
</S.InfoContainer>
</div>
);
Expand Down
12 changes: 9 additions & 3 deletions src/components/UserProfile/UserProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import hamtori from '../../assets/images/hamtori.svg';
import React from 'react';

import hamtori from '../../assets/images/hamtori.svg';
import UserInfo from './UserInfo/UserInfo';
import * as S from './UserProfile.style';

const UserProfile = () => {
type Props = {
name: string;
email: string;
};

const UserProfile = ({ name, email }: Props) => {
return (
<S.Container>
<img src={hamtori} alt={'hamtori'} />
<UserInfo />
<UserInfo name={name} email={email} />
</S.Container>
);
};
Expand Down
Loading
Loading