diff --git a/package-lock.json b/package-lock.json index b436999..982d165 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.1.2", - "axios": "^1.6.7", + "axios": "^1.7.7", "class-variance-authority": "^0.7.0", "clsx": "^2.1.0", "cmdk": "^1.0.0", diff --git a/package.json b/package.json index 9499096..c8d8f10 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.1.2", - "axios": "^1.6.7", + "axios": "^1.7.7", "class-variance-authority": "^0.7.0", "clsx": "^2.1.0", "cmdk": "^1.0.0", diff --git a/src/api/groupApi.ts b/src/api/groupApi.ts index 4b3b6a1..d13a444 100644 --- a/src/api/groupApi.ts +++ b/src/api/groupApi.ts @@ -1,6 +1,6 @@ -import { axios } from '@/lib/Axios'; -import Group from '@/types/Group'; -import { User } from '@/types/User'; +import { axios } from "@/lib/Axios"; +import Group from "@/types/Group"; +import { User } from "@/types/User"; const groupApi = { /** @@ -13,7 +13,7 @@ const groupApi = { }: { groupId: number; }): Promise => { - const response = await axios.get('/v3/group/groupmember', { + const response = await axios.get("/v3/group/groupmember", { params: { groupId }, }); return response.data; @@ -31,7 +31,7 @@ const groupApi = { groupId: number; members: number[]; }): Promise => { - const response = await axios.put('/v3/group/groupmember', { + const response = await axios.put("/v3/group/groupmember", { groupId, members, }); @@ -49,7 +49,7 @@ const groupApi = { groupId: number; members: number[]; }): Promise => { - const response = await axios.post('/v3/group/groupmember/members', { + const response = await axios.post("/v3/group/groupmember/members", { groupId, members, }); @@ -61,7 +61,7 @@ const groupApi = { * 임시로 any를 사용하였지만 백엔드에서 타입 정의 후 수정 필요 */ getAllGroups: async (): Promise => { - const response = await axios.get('/v3/group'); + const response = await axios.get("/v3/group"); return response.data; }, /** @@ -74,7 +74,7 @@ const groupApi = { }: { groupName: string; }): Promise<{ groupId: number; groupName: string }> => { - const response = await axios.post('/v3/group', { + const response = await axios.post("/v3/group", { groupName, }); console.table(response.data); @@ -93,7 +93,7 @@ const groupApi = { groupId: number; groupName: string; }): Promise<{ groupId: number; groupName: string }> => { - const response = await axios.post('/v3/group/name', { + const response = await axios.post("/v3/group/name", { groupId, groupName, }); @@ -109,7 +109,7 @@ const groupApi = { }: { groupId: number; }): Promise<{ groupId: number }> => { - const response = await axios.delete('/v3/group', { params: { groupId } }); + const response = await axios.delete("/v3/group", { params: { groupId } }); return response.data; }, @@ -126,7 +126,7 @@ const groupApi = { groupId: number; userNames: string[]; }): Promise => { - const response = await axios.post('/v3/group/groupmember', { + const response = await axios.post("/v3/group/groupmember", { groupId, members: userNames, }); @@ -134,7 +134,7 @@ const groupApi = { }, agreeJoin: async (): Promise => { - const response = await axios.post('/v3/join'); + const response = await axios.post("/v3/join"); return response.status; }, }; diff --git a/src/components/Groups.tsx b/src/components/Groups.tsx index 69d2b9e..ed4d92a 100644 --- a/src/components/Groups.tsx +++ b/src/components/Groups.tsx @@ -1,4 +1,3 @@ -import React, { useEffect } from "react"; import { Accordion, AccordionContent, @@ -24,7 +23,15 @@ export default function Groups({ groups }: { groups: Group[] }) { const { checkedUsers, setCheckedUsers } = useCheckedUsersStore(); const { checked } = useCheckedStore(); const sortedGroups = [...groups].sort((a, b) => a.groupId - b.groupId); + const defaultGroup = sortedGroups.find( + (group) => group.groupName === "친구 목록", + ); + if (defaultGroup) { + sortedGroups.splice(sortedGroups.indexOf(defaultGroup), 1); + sortedGroups.push(defaultGroup); + } const defaultValues = sortedGroups.map((group) => group.groupId.toString()); + return (
@@ -86,7 +93,7 @@ export default function Groups({ groups }: { groups: Group[] }) {
)} - + {group.groupName}

diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 2855235..514f420 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,21 +1,21 @@ -import React from 'react'; -import Image from 'next/image'; -import { useRouter } from 'next/router'; -import SearchModal from '@/components/modals/SearchModal'; -import LogoutBtn from '@/components/buttons/LogoutBtn'; +import React from "react"; +import Image from "next/image"; +import { useRouter } from "next/router"; +import SearchModal from "@/components/modals/SearchModal"; +import LogoutBtn from "@/components/buttons/LogoutBtn"; export default function Header() { const router = useRouter(); return ( -

+
logo -
+
diff --git a/src/components/ProfilePic.tsx b/src/components/ProfilePic.tsx index 4863335..c335c1f 100644 --- a/src/components/ProfilePic.tsx +++ b/src/components/ProfilePic.tsx @@ -38,9 +38,7 @@ export default function ProfilePic({ {type !== "searchedCard" && ( - -

인트라 프로필 방문

-
+ 인트라 프로필 방문 )} diff --git a/src/components/buttons/GroupSettingBtn.tsx b/src/components/buttons/GroupSettingBtn.tsx index a1ae5f0..239a99f 100644 --- a/src/components/buttons/GroupSettingBtn.tsx +++ b/src/components/buttons/GroupSettingBtn.tsx @@ -28,9 +28,7 @@ export default function GroupSettingBtn({ height={24} /> - -

그룹 설정

-
+ 그룹 설정 diff --git a/src/components/buttons/LocationBtn.tsx b/src/components/buttons/LocationBtn.tsx index 9b7ad83..008c13a 100644 --- a/src/components/buttons/LocationBtn.tsx +++ b/src/components/buttons/LocationBtn.tsx @@ -38,17 +38,13 @@ export default function LocationBtn({ ${ location !== "퇴근" ? "bg-darkblue" - : "border-darkblue text-darkblue border-2 bg-white hover:bg-white" + : "border-2 border-darkblue bg-white text-darkblue hover:bg-white" } h-6 px-2 md:h-8 md:px-3 md:text-xl `} > {location} - {isMyProfile && ( - -

내 위치 변경

-
- )} + {isMyProfile && 내 위치 변경} ); diff --git a/src/components/buttons/LogoutBtn.tsx b/src/components/buttons/LogoutBtn.tsx index 1412338..612c79e 100644 --- a/src/components/buttons/LogoutBtn.tsx +++ b/src/components/buttons/LogoutBtn.tsx @@ -33,9 +33,7 @@ export default function LogoutBtn() { />
- -

로그아웃

-
+ 로그아웃 ); diff --git a/src/components/buttons/MySettingBtn.tsx b/src/components/buttons/MySettingBtn.tsx index b650596..bedd410 100644 --- a/src/components/buttons/MySettingBtn.tsx +++ b/src/components/buttons/MySettingBtn.tsx @@ -19,9 +19,7 @@ export default function MySettingBtn() { className="size-[50px] cursor-pointer rounded-lg hover:bg-gray-200 lg:size-[60px]" /> - -

내 정보 설정

-
+ 내 정보 설정 ); diff --git a/src/components/buttons/RefreshBtn.tsx b/src/components/buttons/RefreshBtn.tsx new file mode 100644 index 0000000..ddc4a4f --- /dev/null +++ b/src/components/buttons/RefreshBtn.tsx @@ -0,0 +1,44 @@ +import React from "react"; +import Image from "next/image"; +import groupApi from "@/api/groupApi"; +import { useGroupsStore, useUserStore } from "@/lib/stores"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { Button } from "@/components/ui/button"; + +export default function RefreshBtn() { + const { setGroups } = useGroupsStore(); + const { user } = useUserStore(); + return ( + + + + + + 자리상태 새로고침 + + + ); +} diff --git a/src/components/buttons/SearchBtn.tsx b/src/components/buttons/SearchBtn.tsx index 7ef1155..fc46cd5 100644 --- a/src/components/buttons/SearchBtn.tsx +++ b/src/components/buttons/SearchBtn.tsx @@ -25,9 +25,7 @@ export default function SearchBtn() { /> - -

유저 검색

-
+ 유저 검색 ); diff --git a/src/components/modals/NewGroupModal.tsx b/src/components/modals/NewGroupModal.tsx index 71306ae..d27df41 100644 --- a/src/components/modals/NewGroupModal.tsx +++ b/src/components/modals/NewGroupModal.tsx @@ -59,6 +59,7 @@ export default function NewGroupModal() { setSelectedUsers([]); formRef.current?.reset(); setSearchValue(""); + setIsAddingUser(false); }, 100); } else { setSelectedUsers([]); @@ -69,8 +70,8 @@ export default function NewGroupModal() { >