Skip to content

Commit

Permalink
Merge pull request #286 from JayJayleee/feat/#285-ui-check-list
Browse files Browse the repository at this point in the history
UI μŠ€νƒ€μΌ μˆ˜μ •ν–ˆμŠ΅λ‹ˆλ‹€.
  • Loading branch information
JayJayleee committed May 5, 2024
2 parents cc3eb33 + 7e73869 commit 346cb95
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 36 deletions.
18 changes: 17 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,24 @@ import AllRouter from '../src/router/allRouter.js';
import ErrorFallback from './hooks/errorBoundary.tsx';
import { ErrorBoundary } from 'react-error-boundary';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { alertCount } from './store/actions/alertActions.js';

const queryClient = new QueryClient();
const queryClient = new QueryClient({
defaultOptions: {
queries: {
onSuccess: (data) => {
if (data.queryKey[0] === 'notifications') {
const noReadElements = data.pages.reduce(
(total, page) => total + (page.data.noReadElements || 0),
0,
);
store.dispatch(alertCount(noReadElements));
console.log('쿼리 μ„±κ³΅μ μœΌλ‘œ μ‹€ν–‰');
}
},
},
},
});

function App() {
return (
Expand Down
14 changes: 14 additions & 0 deletions src/asset/image/yellow-trophy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/asset/sass/etc/question/answer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
height: 308px;
margin-top: 5%;
margin-bottom: 5%;
cursor: pointer;

padding: 0 20px;
:nth-child(1) {
Expand All @@ -18,6 +17,9 @@
border: 1px solid #cacaca;
border-radius: 20px;
}
.adopted {
border: 1px solid #ff8d1d;
}

.user-container {
letter-spacing: -1px;
Expand Down
10 changes: 6 additions & 4 deletions src/asset/sass/pages/notificationPage/notificationList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@

.title-time {
display: flex;
margin-left: -20rem;
margin-left: -5rem;
flex-direction: column;
letter-spacing: -1px;
}

.notification-company {
letter-spacing: -1px;
font-family: pretendard-Light;
// font-family: pretendard-Light;
color: #333333;
font-size: 1.8rem;
width: 5rem;
width: 20rem;
white-space: nowrap;
overflow: hidden;
// overflow: hidden;
text-align: right;
margin-right: 4.5%;
text-overflow: ellipsis;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/asset/sass/pages/notificationPage/notificationPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
}

.all-read-btn {
letter-spacing: -0.5px;
border-radius: 5px;
margin-top: 11%;
margin-top: 11.5%;
margin-right: 8%;
border: 1px solid #000;
width: 7.5rem;
Expand Down
3 changes: 2 additions & 1 deletion src/components/pages/notificationPage/notificationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ function NotificationPage() {
queryFn: ({ pageParam }) => fetchNotifications({ pageParam }),
getNextPageParam: (lastPage) => {
const lastId = lastPage.data?.notificationList?.slice(-1)[0]?.id;

return lastId ? `?lastId=${lastId}` : undefined;
},
staleTime: 0,
gcTime: 1000 * 60 * 5,
onSuccess: (data) => {
if (data?.pages) {
const noReadElements = data.pages.reduce(
Expand Down
40 changes: 20 additions & 20 deletions src/components/pages/postPage/questionDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ interface AppState {
function QuestionDetailPage() {
const navigate = useNavigate();
const { state } = useLocation();
console.log('state: ', state);

// console.log('state: ', state);
const { questionId } = useParams();

Expand All @@ -127,27 +127,27 @@ function QuestionDetailPage() {
const { isLoggedIn } = useSelector((state: AppState) => state.user);

const [isShowEdit, setIsShowEdit] = useState(false);
console.log('isShowEdit: ', isShowEdit);
// console.log('isShowEdit: ', isShowEdit);

const [showReport, setShowReport] = useState(false);
console.log('showReport: ', showReport);
// console.log('showReport: ', showReport);

// const { questionId } = useParams();
useEffect(() => {
const loadAnswerList = async () => {
try {
// const token = localStorage.getItem(ACCESS_TOKEN);
// if (!token) {
// showErrorToast('둜그인이 ν•„μš”ν•©λ‹ˆλ‹€.');
// navigate(-1);
// }
} catch (error) {
if (error instanceof Error) showErrorToast(error.message);
}
};

loadAnswerList();
}, [currentPage, questionId, navigate, postAnswer]);
// useEffect(() => {
// const loadAnswerList = async () => {
// try {
// // const token = localStorage.getItem(ACCESS_TOKEN);
// // if (!token) {
// // showErrorToast('둜그인이 ν•„μš”ν•©λ‹ˆλ‹€.');
// // navigate(-1);
// // }
// } catch (error) {
// if (error instanceof Error) showErrorToast(error.message);
// }
// };

// loadAnswerList();
// }, [currentPage, questionId, navigate, postAnswer]);

const handleGoBack = () => {
navigate(-1);
Expand All @@ -162,7 +162,7 @@ function QuestionDetailPage() {
};

if (myNickname === questionerNickname) {
showErrorToast('본인의 λ¬Έμ˜λŠ” λ‹΅λ³€ν•  수 μ—†μŠ΅λ‹ˆλ‹€.');
showErrorToast('본인의 μ§ˆλ¬Έμ—λŠ” λ‹΅λ³€ν•  수 μ—†μŠ΅λ‹ˆλ‹€.');
return;
}

Expand Down Expand Up @@ -219,7 +219,7 @@ function QuestionDetailPage() {
const response = await axios.get(
`${BASE_URL}/api/question/${questionId}?pageNo=${currentPage}&criterion=createdAt`,
);
console.log(response);
console.log('응닡', response);
const {
data: {
questionerNickname,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/contactSlider/disclaimer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function Disclaimer() {
(점심 μ‹œκ°„ 12 : 00 ~ 13 : 00,ν†  / 일 / 곡휴일 휴무 )
</div>
<div className="disclaimer">
등둝이 μ™„λ£Œλœ 문의 λ‚΄μš©μ€ μˆ˜μ •μ΄ λΆˆκ°€ν•˜μ˜€λ‹ˆ μ„œλΉ„μŠ€ μ΄μš©μ— μ°Έκ³ 
등둝이 μ™„λ£Œλœ 문의 λ‚΄μš©μ€ μˆ˜μ • 및 μ‚­μ œκ°€ λΆˆκ°€ν•˜μ˜€λ‹ˆ μ„œλΉ„μŠ€ μ΄μš©μ— μ°Έκ³ 
λΆ€νƒλ“œλ¦½λ‹ˆλ‹€.
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/components/ui/myPageSelection/myComponent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
justify-content: space-between;
align-items: center;
padding-left: 3rem;
background-color: #ffffff;
cursor: pointer;
}
.answer-item {
height: 100px;
Expand All @@ -34,6 +36,8 @@
flex-direction: column;
justify-content: center;
padding-left: 3rem;
background-color: #ffffff;
cursor: pointer;
}

.answer-item-title {
Expand All @@ -45,10 +49,11 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0% 0% 3% 0%;
}

.answer-item-content {
font-size: 1.2rem;
font-size: 1.8rem;
color: #474646;
letter-spacing: -1px;
font-family: Pretendard-Light;
Expand Down
35 changes: 31 additions & 4 deletions src/components/ui/question/answer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
import React, { useState } from 'react';
import '../../../asset/sass/etc/question/answer.scss';
import styled from 'styled-components';
import yellowTrophy from '../../../asset/image/yellow-trophy.svg';
import Trophy from '../../../asset/image/trophy.svg';
import { fetchAPI } from '../../global/utils/apiUtil';
import { showSuccessToast } from '../toast/toast';

const AdoptedTag = styled.div`
position: relative;
width: 95px;
height: 25px;
border: 1px solid #ff8d1d;
border-radius: 0.5rem;
font-size: 1.2rem;
color: #ff8d1d;
letter-spacing: -1px;
font-family: Pretendard-Medium;
top: -4.5rem;
left: 41rem;
display: flex;
justify-content: space-around;
align-items: center;
padding: 0 1rem;
`;
const AdoptButton = styled.button`
display: flex;
margin: -12% 6% 0% 82%;
Expand Down Expand Up @@ -58,14 +76,23 @@ function AnswerModule({

return (
<div className={`answer-container ${isAdopted ? 'adopted' : ''}`}>
{isAdopted && (
<AdoptedTag>
<img src={yellowTrophy} alt="trophy" />
μ±„νƒλœ λ‹΅λ³€
</AdoptedTag>
)}

<div>
<div>{answererNickname}</div>
<div>{answerContent}</div>
<div className="user-container">{createAt}</div>
<AdoptButton onClick={handleAdoptAnswer}>
<img src={Trophy} alt="trophy" />
μ±„νƒν•˜κΈ°
</AdoptButton>
{isAdopted || (
<AdoptButton onClick={handleAdoptAnswer}>
<img src={Trophy} alt="trophy" />
μ±„νƒν•˜κΈ°
</AdoptButton>
)}
</div>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/searchInput/searchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const StyledSearchInput = styled.input`
const AutoCompleteContainer = styled.div`
position: absolute;
background-color: #fefefe;
width: 515px;
width: 490px;
letter-spacing: -1px;
margin-left: 14%;
margin-top: 1%;
Expand All @@ -48,7 +48,7 @@ const AutoCompleteContainer = styled.div`
`;

const AutoCompleteItem = styled.div`
padding: 10px;
padding: 15px 10px;
cursor: pointer;
&:hover {
background-color: #f2f2f2;
Expand Down

0 comments on commit 346cb95

Please sign in to comment.