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

release: v0.1.11 #346

Merged
merged 11 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
11 commits
Select commit Hold shift + click to select a range
71765fc
feat(shared): updateToast util ν•¨μˆ˜ μΆ”κ°€ (#325)
sukvvon Dec 20, 2023
4c04216
refactor(shelter, volunteer): signup νŽ˜μ΄μ§€ λ‚΄λΆ€ toast updateToast둜 λ³€κ²½ (#326)
sukvvon Dec 20, 2023
8529d08
refactor(shelter, volunteer): signin νŽ˜μ΄μ§€ λ‚΄λΆ€ toast updateToast둜 λ³€κ²½ (#328)
sukvvon Dec 20, 2023
3604407
feat: λ΄‰μ‚¬μž μ‹ μ²­ν˜„ν™© νŽ˜μ΄μ§€ toast updatToast둜 λ³€κ²½, onError μΆ”κ°€, toast μ„€λͺ… 폰트 속성 변…
sukvvon Dec 23, 2023
627daa2
feat(shelter): λ΄‰μ‚¬μž μ‹ μ²­ ν˜„ν™© νŽ˜μ΄μ§€ μ‹ μ²­λœ μƒνƒœκ°€ 같을 경우 μ„œλ²„ 호좜 제거 (#332)
sukvvon Dec 25, 2023
68a2d13
chore(shelter, volunteer): @lukemorales/query-key-factory μ‚­μ œ (#335)
sukvvon Dec 27, 2023
24dda61
feat: λ΄‰μ‚¬μž μΆœμ„ 관리 νŽ˜μ΄μ§€ λ””μžμΈ λͺ¨λ°”μΌμ—μ„œ μ›ΉκΉŒμ§€ ν™•μž₯ (#337)
sukvvon Dec 28, 2023
2635b12
feat: λ³΄ν˜Έμ†Œ, λ΄‰μ‚¬μž μ•± title, icon λ³€κ²½ (#339)
sukvvon Dec 29, 2023
e0da93c
chore: tsconfig 및 κ΄€λ ¨ 파일 μˆ˜μ •, package.json에 type module μΆ”κ°€ (#341)
sukvvon Jan 4, 2024
94eccfa
chore(vscode): extensions.json μΆ”κ°€, settings.json의 codeActionsOnSave μ΅œβ€¦
sukvvon Jan 8, 2024
e916816
refactor: packages λ‚΄λΆ€ 폴더 ꡬ쑰 λ³€κ²½, .prettierrc둜 λ³€κ²½, tsconfig λ‚΄λΆ€ ꡬ쑰 λ³€κ²½ (#…
sukvvon Jan 16, 2024
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 .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: ['custom'],
extends: ['anifriends'],
};
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"endOfLine": "auto",
"jsxSingleQuote": false,
"printWidth": 80,
"semi": true,
"singleAttributePerLine": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
13 changes: 0 additions & 13 deletions .prettierrc.cjs

This file was deleted.

8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"eamodio.gitlens",
"formulahendry.auto-rename-tag"
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
}
],
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
}
}
2 changes: 1 addition & 1 deletion apps/shelter/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: ["custom"],
extends: ['anifriends'],
};
4 changes: 2 additions & 2 deletions apps/shelter/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="ko">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" href="/favicon.ico" />
<link
rel="preload"
href="https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/IBMPlexSansKR-Regular.woff"
Expand All @@ -11,7 +11,7 @@
crossorigin="anonymous"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>λ³΄ν˜Έμ†Œ μ–΄ν”Œλ¦¬μΌ€μ΄μ…˜</title>
<title>Anifriends</title>
</head>
<body>
<div id="root"></div>
Expand Down
18 changes: 14 additions & 4 deletions apps/shelter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@
"preview": "vite preview"
},
"dependencies": {
"@anifriends/apis": "workspace:*",
"@anifriends/assets": "workspace:*",
"@anifriends/components": "workspace:*",
"@anifriends/constants": "workspace:*",
"@anifriends/fonts": "workspace:*",
"@anifriends/hooks": "workspace:*",
"@anifriends/icons": "workspace:*",
"@anifriends/layout": "workspace:*",
"@anifriends/store": "workspace:*",
"@anifriends/theme": "workspace:*",
"@anifriends/utils": "workspace:*",
"@chakra-ui/react": "^2.8.1",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@hookform/resolvers": "^3.3.2",
"@lukemorales/query-key-factory": "^1.3.2",
"@tanstack/react-query": "^5.4.3",
"@tanstack/react-query-devtools": "^5.4.3",
"axios": "^1.6.0",
Expand All @@ -24,19 +34,19 @@
"react-error-boundary": "^4.0.11",
"react-hook-form": "^7.47.0",
"react-router-dom": "^6.17.0",
"shared": "workspace:*",
"zod": "^3.22.4",
"zustand": "^4.4.4"
},
"devDependencies": {
"@anifriends/tsconfig": "workspace:*",
"@anifriends/types": "workspace:*",
"@types/node": "^20.8.10",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react-swc": "^3.4.0",
"eslint": "^8.45.0",
"eslint-config-custom": "workspace:*",
"eslint-config-anifriends": "workspace:*",
"msw": "^2.0.1",
"tsconfig": "workspace:*",
"typescript": "^5.0.2",
"vite": "^4.4.5"
},
Expand Down
Binary file added apps/shelter/public/favicon.ico
Binary file not shown.
7 changes: 4 additions & 3 deletions apps/shelter/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import Fonts from '@anifriends/fonts';
import theme from '@anifriends/theme';
import { ChakraProvider } from '@chakra-ui/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { RouterProvider } from 'react-router-dom';
import Fonts from 'shared/fonts';
import theme from 'shared/theme';

import { router } from '@/routes';

const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 50000,
staleTime: 10 * 1000,
gcTime: 10 * 1000,
},
},
});
Expand Down
4 changes: 2 additions & 2 deletions apps/shelter/src/apis/auth.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import axiosInstance from 'shared/apis/axiosInstance';
import { axiosInstance } from '@anifriends/apis';
import type {
ChangePasswordRequestData,
CheckDuplicatedEmailRequestData,
CheckDuplicatedEmailResponseData,
SigninRequestData,
SigninResponseData,
} from 'shared/types/apis/auth';
} from '@anifriends/types';

import { SignupRequestData } from '@/types/apis/auth';

Expand Down
2 changes: 1 addition & 1 deletion apps/shelter/src/apis/recruitment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axiosInstance from 'shared/apis/axiosInstance';
import { axiosInstance } from '@anifriends/apis';

import {
ApplicantsApprovalRequest,
Expand Down
2 changes: 1 addition & 1 deletion apps/shelter/src/apis/shelter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axiosInstance from 'shared/apis/axiosInstance';
import { axiosInstance } from '@anifriends/apis';

import { ShelterInfo, UpdateShelterInfo } from '@/types/apis/shetler';

Expand Down
2 changes: 1 addition & 1 deletion apps/shelter/src/apis/volunteers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axiosInstance from 'shared/apis/axiosInstance';
import { axiosInstance } from '@anifriends/apis';

import {
VolunteerCompletedsRequestParams,
Expand Down
2 changes: 1 addition & 1 deletion apps/shelter/src/mocks/handlers/manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const DUMMY_USER = {
volunteerAttendance: false,
};

const DUMMY_USER_LIST = Array.from({ length: 8 }, () => {
const DUMMY_USER_LIST = Array.from({ length: 20 }, () => {
return {
...DUMMY_USER,
volunteerId: Math.random(),
Expand Down
36 changes: 32 additions & 4 deletions apps/shelter/src/mocks/handlers/recruitment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ export const DUMMY_APPLICANT = {
applicantStatus: 'APPROVED',
};

export const DUMMY_APPLICANT_LIST = Array.from(
{ length: 9 },
() => DUMMY_APPLICANT,
);
export const DUMMY_APPLICANT_LIST = Array.from({ length: 9 }, (_, index) => {
return {
...DUMMY_APPLICANT,
volunteerName: !(index % 2) ? 'κΉ€μ² μˆ˜' : 'κΉ€μ˜ν¬',
};
});

export const handlers = [
http.get('/shelters/recruitments', async () => {
Expand All @@ -60,6 +62,32 @@ export const handlers = [
return HttpResponse.json({}, { status: 200 });
},
),
http.patch(
'/shelters/recruitments/:recruitmentId/applicants/:applicantId',
async () => {
await delay(200);
return HttpResponse.json(
{
errorCode: 'AF301',
message: 'ν•΄λ‹Ή λͺ¨μ§‘글에 λŒ€ν•΄ κΆŒν•œμ΄ μ—†μŠ΅λ‹ˆλ‹€',
},
{ status: 403 },
);
},
),
http.patch(
'/shelters/recruitments/:recruitmentId/applicants/:applicantId',
async () => {
await delay(200);
return HttpResponse.json(
{
errorCode: 'AF401',
message: 'ν•΄λ‹Ή λͺ¨μ§‘글을 μ‹ μ²­ν•œ λ΄‰μ‚¬μžκ°€ μ•„λ‹™λ‹ˆλ‹€',
},
{ status: 404 },
);
},
),
http.get('/shelters/recruitments/:recruitmentId/applicants', async () => {
await delay(200);
return HttpResponse.json({
Expand Down
2 changes: 1 addition & 1 deletion apps/shelter/src/pages/animals/detail/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useDetailHeaderStore } from '@anifriends/store';
import { useEffect } from 'react';
import useDetailHeaderStore from 'shared/store/detailHeaderStore';

const handleDeletePost = (postId: number) => {
// TODO: AnimalPost delete API 호좜
Expand Down
2 changes: 1 addition & 1 deletion apps/shelter/src/pages/animals/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import NotReady from 'shared/components/NotReady';
import { NotReady } from '@anifriends/components';

export default function AnimalsPage() {
return <NotReady />;
Expand Down
2 changes: 1 addition & 1 deletion apps/shelter/src/pages/animals/search/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useSearchHeaderStore } from '@anifriends/store';
import { useEffect } from 'react';
import useSearchHeaderStore from 'shared/store/searchHeaderStore';

const handleSearchkeyword = (keyword: string) => {
// TODO: AnimalList 검색 API 호좜
Expand Down
2 changes: 1 addition & 1 deletion apps/shelter/src/pages/chattings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import NotReady from 'shared/components/NotReady';
import { NotReady } from '@anifriends/components';

export default function ChattingsPage() {
return <NotReady />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApplicantStatus } from '@anifriends/components';
import { Flex, Text } from '@chakra-ui/react';
import ApplicantStatus from 'shared/components/ApplicantStatus';

type ApplyInfoItemProps = {
currentRecuritmentCount: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Label } from '@anifriends/components';
import { PERSON_GENDER_KOR } from '@anifriends/constants';
import { getAge, updateToast } from '@anifriends/utils';
import { Button, Flex, HStack, Text, useToast, VStack } from '@chakra-ui/react';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import Label from 'shared/components/Label';
import { PERSON_GENDER_KOR } from 'shared/constants/gender';
import { getAge } from 'shared/utils/date';

import { updateShelterRecruitmentApplicant } from '@/apis/recruitment';
import CkCheck from '@/assets/CkCheck';
Expand Down Expand Up @@ -34,6 +34,7 @@ export default function ManageApplyItem({
},
}: ManageApplyItemProps) {
const toast = useToast();
const manageApplyId = 'manage-apply';
const queryClient = useQueryClient();
const { mutate } = useMutation({
mutationFn: (data: RecruitmentApplicantUpdateRequest) =>
Expand All @@ -47,12 +48,55 @@ export default function ManageApplyItem({
? APPLICANT_STATUS_KOR.APPROVE
: APPLICANT_STATUS_KOR.REFUSE;

toast({
position: 'top',
description: `${volunteerName}λ‹˜μ˜ 봉사신청을 ${descriptionStatus}ν–ˆμŠ΅λ‹ˆλ‹€`,
status: 'success',
duration: 1000,
isClosable: true,
toast.close(manageApplyId);

await new Promise((resolve) => setTimeout(resolve, 200));

updateToast({
toast,
toastId: manageApplyId,
toastOptions: {
position: 'top',
description: (
<Text w="100%">
<Text as="span" fontWeight="bold">
{volunteerName}
</Text>
λ‹˜μ˜ 신청을{` `}
<Text as="span" fontWeight="bold">
{descriptionStatus}
</Text>
ν–ˆμŠ΅λ‹ˆλ‹€
</Text>
),
status: 'success',
duration: 1500,
isClosable: true,
},
});
},
onError: async (error) => {
toast.close(manageApplyId);

await new Promise((resolve) => setTimeout(resolve, 200));

updateToast({
toast,
toastId: manageApplyId,
toastOptions: {
position: 'top',
description: (
<Text>
<Text as="span" fontWeight="bold">
{volunteerName}
</Text>
λ‹˜μ€ {error.response?.data.message}
</Text>
),
status: 'error',
duration: 1500,
isClosable: true,
},
});
},
});
Expand All @@ -64,6 +108,13 @@ export default function ManageApplyItem({
const changeApplicantStatus = ({
isApproved,
}: RecruitmentApplicantUpdateRequest) => {
if (
(isApproved && applicantStatus === APPLICANT_STATUS_ENG.APPROVED) ||
(!isApproved && applicantStatus === APPLICANT_STATUS_ENG.REFUSED)
) {
return;
}

mutate({ isApproved });
};

Expand Down
Loading