Skip to content

Commit

Permalink
Merge pull request #114 from 42Where/feature/ux-css
Browse files Browse the repository at this point in the history
[#113] UX + CSS Fix (feature/ux-css)
  • Loading branch information
daejlee authored Oct 3, 2024
2 parents ba8d6ae + 6d511b3 commit c4696d9
Show file tree
Hide file tree
Showing 21 changed files with 148 additions and 105 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 12 additions & 12 deletions src/api/groupApi.ts
Original file line number Diff line number Diff line change
@@ -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 = {
/**
Expand All @@ -13,7 +13,7 @@ const groupApi = {
}: {
groupId: number;
}): Promise<User[]> => {
const response = await axios.get('/v3/group/groupmember', {
const response = await axios.get("/v3/group/groupmember", {
params: { groupId },
});
return response.data;
Expand All @@ -31,7 +31,7 @@ const groupApi = {
groupId: number;
members: number[];
}): Promise<number[]> => {
const response = await axios.put('/v3/group/groupmember', {
const response = await axios.put("/v3/group/groupmember", {
groupId,
members,
});
Expand All @@ -49,7 +49,7 @@ const groupApi = {
groupId: number;
members: number[];
}): Promise<number> => {
const response = await axios.post('/v3/group/groupmember/members', {
const response = await axios.post("/v3/group/groupmember/members", {
groupId,
members,
});
Expand All @@ -61,7 +61,7 @@ const groupApi = {
* 임시로 any를 사용하였지만 백엔드에서 타입 정의 후 수정 필요
*/
getAllGroups: async (): Promise<Group[]> => {
const response = await axios.get('/v3/group');
const response = await axios.get("/v3/group");
return response.data;
},
/**
Expand All @@ -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);
Expand All @@ -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,
});
Expand All @@ -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;
},

Expand All @@ -126,15 +126,15 @@ const groupApi = {
groupId: number;
userNames: string[];
}): Promise<number> => {
const response = await axios.post('/v3/group/groupmember', {
const response = await axios.post("/v3/group/groupmember", {
groupId,
members: userNames,
});
return response.status;
},

agreeJoin: async (): Promise<number> => {
const response = await axios.post('/v3/join');
const response = await axios.post("/v3/join");
return response.status;
},
};
Expand Down
11 changes: 9 additions & 2 deletions src/components/Groups.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React, { useEffect } from "react";
import {
Accordion,
AccordionContent,
Expand All @@ -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 (
<div>
<Divider />
Expand Down Expand Up @@ -86,7 +93,7 @@ export default function Groups({ groups }: { groups: Group[] }) {
</div>
)}
<GroupSettingModal curGroup={group} />
<AccordionTrigger className="text-l p-2 px-6 text-darkblue md:p-4 md:text-2xl">
<AccordionTrigger className="text-l p-2 text-darkblue md:p-4 md:text-2xl">
<span className="flex flex-row items-center justify-start gap-6">
{group.groupName}
<p className="text-xl md:text-2xl">
Expand Down
20 changes: 10 additions & 10 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<header className='flex flex-row justify-between items-center p-2 pb-0 md:p-4'>
<header className="flex flex-row items-center justify-between p-2 pb-0 md:p-4">
<Image
src='/image/logo/logoC.svg'
alt='logo'
src="/image/logo/logoC.svg"
alt="logo"
width={200}
height={100}
className='lg:w-[200px] lg:h-[100px] w-[150px] h-[75px]'
className="h-[75px] w-[150px] lg:h-[100px] lg:w-[200px]"
/>
<div className='flex flex-row gap-2'>
<div className="flex flex-row gap-2">
<SearchModal />
<LogoutBtn />
</div>
Expand Down
4 changes: 1 addition & 3 deletions src/components/ProfilePic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ export default function ProfilePic({
</Avatar>
</TooltipTrigger>
{type !== "searchedCard" && (
<TooltipContent>
<p className="text-l lg:text-xl">인트라 프로필 방문</p>
</TooltipContent>
<TooltipContent>인트라 프로필 방문</TooltipContent>
)}
</Tooltip>
</TooltipProvider>
Expand Down
4 changes: 1 addition & 3 deletions src/components/buttons/GroupSettingBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export default function GroupSettingBtn({
height={24}
/>
</TooltipTrigger>
<TooltipContent>
<p className="text-l lg:text-xl">그룹 설정</p>
</TooltipContent>
<TooltipContent>그룹 설정</TooltipContent>
</Tooltip>
</TooltipProvider>
</DropdownMenuTrigger>
Expand Down
8 changes: 2 additions & 6 deletions src/components/buttons/LocationBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
</Button>
</TooltipTrigger>
{isMyProfile && (
<TooltipContent>
<p className=" text-l lg:text-xl">내 위치 변경</p>
</TooltipContent>
)}
{isMyProfile && <TooltipContent>내 위치 변경</TooltipContent>}
</Tooltip>
</TooltipProvider>
);
Expand Down
4 changes: 1 addition & 3 deletions src/components/buttons/LogoutBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ export default function LogoutBtn() {
/>
</div>
</TooltipTrigger>
<TooltipContent>
<p className=" text-l lg:text-xl">로그아웃</p>
</TooltipContent>
<TooltipContent>로그아웃</TooltipContent>
</Tooltip>
</TooltipProvider>
);
Expand Down
4 changes: 1 addition & 3 deletions src/components/buttons/MySettingBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ export default function MySettingBtn() {
className="size-[50px] cursor-pointer rounded-lg hover:bg-gray-200 lg:size-[60px]"
/>
</TooltipTrigger>
<TooltipContent>
<p className=" text-l lg:text-xl">내 정보 설정</p>
</TooltipContent>
<TooltipContent>내 정보 설정</TooltipContent>
</Tooltip>
</TooltipProvider>
);
Expand Down
44 changes: 44 additions & 0 deletions src/components/buttons/RefreshBtn.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button variant={"ghost"} className="h-fit max-h-20 w-fit">
<Image
src="/image/logo/logoB.svg"
alt="logo"
width={200}
height={100}
className="h-[75px] w-[150px] lg:h-[100px] lg:w-[200px]"
onClick={async () => {
console.log("refresh");
groupApi.getAllGroups().then((res) => {
res.map((group) => {
if (group.groupId === user?.defaultGroupId)
group.groupName = "친구 목록";
});
setGroups(res);
});
}}
/>
</Button>
</TooltipTrigger>
<TooltipContent>자리상태 새로고침</TooltipContent>
</Tooltip>
</TooltipProvider>
);
}
4 changes: 1 addition & 3 deletions src/components/buttons/SearchBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export default function SearchBtn() {
/>
</div>
</TooltipTrigger>
<TooltipContent>
<p className=" text-l lg:text-xl">유저 검색</p>
</TooltipContent>
<TooltipContent>유저 검색</TooltipContent>
</Tooltip>
</TooltipProvider>
);
Expand Down
29 changes: 18 additions & 11 deletions src/components/modals/NewGroupModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default function NewGroupModal() {
setSelectedUsers([]);
formRef.current?.reset();
setSearchValue("");
setIsAddingUser(false);
}, 100);
} else {
setSelectedUsers([]);
Expand All @@ -69,8 +70,8 @@ export default function NewGroupModal() {
>
<DialogTrigger>
<Button
className="text-l w-30 lg:w-30 border-darkblue text-darkblue h-8
gap-2 rounded-full border-2 bg-white px-3 py-1 hover:bg-gray-200 lg:h-10 lg:text-xl"
className="text-l w-30 lg:w-30 h-8 gap-2 rounded-full
border-2 border-darkblue bg-white px-3 py-1 text-darkblue hover:bg-gray-200 lg:h-10 lg:text-xl"
>
<Image
src="/image/newGroup.svg"
Expand All @@ -84,7 +85,7 @@ export default function NewGroupModal() {
<DialogContent className="max-w-[800px] transition-all duration-500 ease-out">
<DialogHeader className="flex w-full flex-col items-center justify-center gap-2">
<AlertDialog open={isDuplicated}>
<AlertDialogContent className="text-darkblue max-w-[425px] transition-all duration-500 ease-out">
<AlertDialogContent className="max-w-[425px] text-darkblue transition-all duration-500 ease-out">
<AlertDialogHeader>
<AlertDialogTitle>중복 그룹 확인</AlertDialogTitle>
<AlertDialogDescription>
Expand Down Expand Up @@ -136,9 +137,9 @@ export default function NewGroupModal() {
</AlertDialog>
<DialogTitle>새로운 그룹 생성</DialogTitle>
{isAddingUser ? (
<div className="flex w-full flex-col items-center justify-center gap-4 overflow-scroll">
<div className="flex w-full flex-col items-center justify-center gap-4">
{selectedUsers.length > 0 && (
<div className="flex w-[300px] flex-row gap-2 overflow-x-scroll md:w-[700px]">
<div className="flex w-[300px] flex-row gap-2 overflow-auto md:w-[700px]">
{selectedUsers.map((selectedUser) => (
<div
key={selectedUser.intraId}
Expand Down Expand Up @@ -170,7 +171,7 @@ export default function NewGroupModal() {
/>
<input
ref={inputRef}
className="text-l text-darkblue w-full bg-transparent outline-none placeholder:text-gray-500 dark:text-gray-700"
className="text-l w-full bg-transparent text-darkblue outline-none placeholder:text-gray-500 dark:text-gray-700"
placeholder="새 그룹에 추가할 친구를 검색하세요."
onChange={(e) => setSearchValue(e.target.value)}
/>
Expand All @@ -184,7 +185,7 @@ export default function NewGroupModal() {
/>
)}
</div>
<div className="h-[300px] w-full overflow-scroll rounded-md md:h-[500px]">
<div className="h-[300px] w-full overflow-auto rounded-md md:h-[500px]">
<div className="grid grid-flow-row gap-2 md:grid-cols-2">
{searchedUsers?.map((searchedMember) => (
<SearchedCard
Expand All @@ -196,9 +197,15 @@ export default function NewGroupModal() {
(selectedUser) =>
selectedUser.intraId === searchedMember.intraId,
)
)
return;
setSelectedUsers([...selectedUsers, searchedMember]);
) {
setSelectedUsers(
selectedUsers.filter(
(selectedUser) =>
selectedUser.intraId !== searchedMember.intraId,
),
);
} else
setSelectedUsers([...selectedUsers, searchedMember]);
}}
isAddingUser={true}
/>
Expand Down Expand Up @@ -283,7 +290,7 @@ export default function NewGroupModal() {
>
<input
ref={inputRef}
className="text-l text-darkblue w-full bg-transparent outline-none placeholder:text-gray-500 dark:text-gray-700"
className="text-l w-full bg-transparent text-darkblue outline-none placeholder:text-gray-500 dark:text-gray-700"
placeholder="생성할 그룹의 이름을 입력하세요."
onChange={(e) => setSearchValue(e.target.value)}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/components/ui/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const TooltipContent = React.forwardRef<
className={cn(
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-[#4A6282] shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className,
"text-l lg:text-xl",
// Above text property is added by me
)}
{...props}
/>
Expand Down
4 changes: 1 addition & 3 deletions src/components/utils/RepoLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ export default function RepoLink() {
/>
</Link>
</TooltipTrigger>
<TooltipContent>
<p className="text-l lg:text-xl">깃허브 레포지토리 방문</p>
</TooltipContent>
<TooltipContent>깃허브 레포지토리 방문</TooltipContent>
</Tooltip>
</TooltipProvider>
);
Expand Down
Loading

0 comments on commit c4696d9

Please sign in to comment.