- {userName && availableWorkspaces.length > 0 ? (
- availableWorkspaces.map((workspace) => (
-
- ))
+ {userName && workspaces.length > 0 ? (
+ <>
+ {workspaces.map((workspace) => (
+
+ ))}
+
+ >
) : (
{informText}
)}
diff --git a/client/src/components/sidebar/components/menuButton/components/components/InviteButton.style.ts b/client/src/components/sidebar/components/menuButton/components/components/InviteButton.style.ts
new file mode 100644
index 00000000..bac3731c
--- /dev/null
+++ b/client/src/components/sidebar/components/menuButton/components/components/InviteButton.style.ts
@@ -0,0 +1,19 @@
+import { css } from "@styled-system/css";
+
+export const inviteButtonStyle = css({
+ display: "flex",
+ gap: "32px",
+ alignItems: "center",
+ borderTop: "1px solid",
+ borderColor: "gray.200",
+
+ width: "100%",
+ padding: "12px 16px",
+ color: "gray.600",
+ backgroundColor: "transparent",
+ transition: "all 0.2s",
+ cursor: "pointer",
+ _hover: {
+ backgroundColor: "gray.200",
+ },
+});
diff --git a/client/src/components/sidebar/components/menuButton/components/components/InviteButton.tsx b/client/src/components/sidebar/components/menuButton/components/components/InviteButton.tsx
new file mode 100644
index 00000000..62090c80
--- /dev/null
+++ b/client/src/components/sidebar/components/menuButton/components/components/InviteButton.tsx
@@ -0,0 +1,15 @@
+import Plus from "@assets/icons/plusIcon.svg?react";
+import { inviteButtonStyle } from "./InviteButton.style";
+
+interface InviteButtonProps {
+ onClick: () => void;
+}
+
+export const InviteButton = ({ onClick }: InviteButtonProps) => {
+ return (
+
+ );
+};
diff --git a/client/src/components/sidebar/components/menuButton/components/components/WorkspaceSelectItem.style.tsx b/client/src/components/sidebar/components/menuButton/components/components/WorkspaceSelectItem.style.tsx
index 568d9316..4a342a07 100644
--- a/client/src/components/sidebar/components/menuButton/components/components/WorkspaceSelectItem.style.tsx
+++ b/client/src/components/sidebar/components/menuButton/components/components/WorkspaceSelectItem.style.tsx
@@ -5,17 +5,37 @@ export const itemContainer = css({
display: "flex",
justifyContent: "space-between",
alignItems: "center",
- padding: "md",
+ borderLeft: "3px solid transparent", // 활성화되지 않았을 때 border 공간 확보
+ width: "100%",
+ padding: "8px 16px",
+ transition: "all 0.2s",
cursor: "pointer",
- _hover: { backgroundColor: "gray.100" },
+ _hover: { backgroundColor: "gray.200" },
});
+export const informBox = css({
+ display: "flex",
+ gap: "16px",
+ justifyContent: "center",
+ alignItems: "center",
+ marginLeft: "14px",
+});
export const itemContent = css({
display: "flex",
- gap: "2",
+ flex: 1,
+ gap: "10",
alignItems: "center",
});
+export const activeItem = css({
+ borderLeft: "3px solid", // 왼쪽 하이라이트 바
+ borderLeftColor: "blue", // 포인트 컬러
+ backgroundColor: "rgba(0, 0, 0, 0.05)", // 약간 어두운 배경
+ _hover: {
+ backgroundColor: "rgba(0, 0, 0, 0.08)", // 호버 시 약간 더 어둡게
+ },
+});
+
export const itemIcon = css({
display: "flex",
justifyContent: "center",
@@ -24,12 +44,13 @@ export const itemIcon = css({
width: "8",
height: "8",
fontSize: "sm",
- backgroundColor: "gray.200",
+ backgroundColor: "gray.100",
});
export const itemInfo = css({
display: "flex",
flexDirection: "column",
+ alignItems: "center",
});
export const itemName = css({
diff --git a/client/src/components/sidebar/components/menuButton/components/components/WorkspaceSelectItem.tsx b/client/src/components/sidebar/components/menuButton/components/components/WorkspaceSelectItem.tsx
index cdd64344..5480e8cb 100644
--- a/client/src/components/sidebar/components/menuButton/components/components/WorkspaceSelectItem.tsx
+++ b/client/src/components/sidebar/components/menuButton/components/components/WorkspaceSelectItem.tsx
@@ -1,5 +1,6 @@
import { WorkspaceListItem } from "@noctaCrdt/Interfaces"; // 이전에 만든 인터페이스 import
import { useSocketStore } from "@src/stores/useSocketStore";
+import { useToastStore } from "@src/stores/useToastStore";
import { useUserInfo } from "@src/stores/useUserStore";
import {
itemContainer,
@@ -9,30 +10,48 @@ import {
itemMemberCount,
itemName,
itemRole,
+ informBox,
+ activeItem, // 추가: 활성화된 아이템 스타일
} from "./WorkspaceSelectItem.style";
interface WorkspaceSelectItemProps extends WorkspaceListItem {
userName: string;
}
-export const WorkspaceSelectItem = ({ id, name, role, memberCount }: WorkspaceSelectItemProps) => {
+export const WorkspaceSelectItem = ({
+ id,
+ name,
+ role,
+ memberCount,
+ activeUsers,
+}: WorkspaceSelectItemProps) => {
const { userId } = useUserInfo();
- const switchWorkspace = useSocketStore((state) => state.switchWorkspace);
+ const { workspace, switchWorkspace } = useSocketStore();
+ const { addToast } = useToastStore();
+ const isActive = workspace?.id === id; // 현재 워크스페이스 확인
const handleClick = () => {
- switchWorkspace(userId, id);
+ if (!isActive) {
+ switchWorkspace(userId, id);
+ addToast(`워크스페이스(${name})에 접속하였습니다.`);
+ }
};
return (
-