Skip to content

Commit

Permalink
Auth API에 대한 자잘한 버그를 수정했습니다.
Browse files Browse the repository at this point in the history
Auth API에 대한 자잘한 버그를 수정했습니다.
  • Loading branch information
gwansikk authored Feb 11, 2024
2 parents 7d2b99e + bc804bc commit 4fc696e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"rules": {
"react/react-in-jsx-scope": "off", // React 17 이상에서는 필요 없음
"@typescript-eslint/explicit-module-boundary-types": "off", // 모든 함수의 반환 타입 명시를 강제하지 않음
"react/prop-types": "off" // TypeScript를 사용할 경우 propTypes는 필요 없음
"react/prop-types": "off", // TypeScript를 사용할 경우 propTypes는 필요 없음
"no-console": "error"
},
"env": { "browser": true, "es2020": true }
}
9 changes: 5 additions & 4 deletions apps/member/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended'
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true }
]
}
{ allowConstantExport: true },
],
'no-console': 'warn',
},
};
12 changes: 6 additions & 6 deletions apps/member/src/components/common/Image/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SyntheticEvent, useState } from 'react';
import classNames from 'classnames';
import { useState } from 'react';
import { NOT_FOUND_IMG } from '@constants/path';

interface ImageProps {
src?: string;
Expand All @@ -12,23 +13,22 @@ interface ImageProps {
}

const Image = ({
src,
src = NOT_FOUND_IMG,
alt,
width,
height,
className,
onClick,
overflow,
}: ImageProps) => {
const [imgSrc, setImgSrc] = useState(src);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(false);

const _width = width ? width : 'w-full';
const _height = height ? height : 'h-full';

const handleError = () => {
setImgSrc('/not_found.webp');
const handleError = (e: SyntheticEvent<HTMLImageElement>) => {
e.currentTarget.src = NOT_FOUND_IMG;
setError(true);
setLoading(false);
};
Expand All @@ -45,7 +45,7 @@ const Image = ({
'bg-gray-50': error,
'cursor-pointer': onClick,
})}
src={imgSrc}
src={src}
alt={alt}
onClick={onClick}
onLoad={() => setLoading(false)}
Expand Down
12 changes: 5 additions & 7 deletions apps/member/src/components/panels/BookPanel/BookPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Panel from '@components/common/Panel/Panel';
import ProgressBar from '@components/common/ProgressBar/ProgressBar';
import { BookItem } from '@type/book';
import dayjs from 'dayjs';
import { FcBookmark } from 'react-icons/fc';
import dayjs from 'dayjs';

interface BookPanelProps {
data: Array<BookItem>;
Expand All @@ -17,15 +17,13 @@ const ActionButton = ({ children }: { children: React.ReactNode }) => (
const checkProgress = (createdAt: string) => {
const now = dayjs();
const end = dayjs(createdAt).add(14, 'd');
const value = (end.diff(now, 'd') * 100) % 14;
console.log(value);
return value;
return (end.diff(now, 'd') * 100) % 14;
};

const checkDueDate = (createdAt: string) => {
const today = dayjs();
const end = dayjs(createdAt).add(14, 'd');
const value = end.diff(today, 'd');
return value;
return end.diff(today, 'd');
};

const BookPanel = ({ data }: BookPanelProps) => {
Expand All @@ -44,7 +42,7 @@ const BookPanel = ({ data }: BookPanelProps) => {
<li className="font-semibold">
<div className="flex items-baseline justify-between mb-2">
<span className="truncate mr-2">{title}</span>
<span className="text-xs w-fit">
<span className="text-xs w-fit text-nowrap">
D-{checkDueDate(createdAt)}
</span>
</div>
Expand Down
2 changes: 2 additions & 0 deletions apps/member/src/constants/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const createPath = (...paths: Array<PathFinderId>): string => {
.join('/');
};

export const NOT_FOUND_IMG = '/not_found.webp';

export const PATH = {
ROOT: '',
MAIN: '/',
Expand Down

0 comments on commit 4fc696e

Please sign in to comment.