diff --git a/backend/src/service/UserHasWorkspaceService.ts b/backend/src/service/UserHasWorkspaceService.ts
index cb7e170d..ba58005d 100644
--- a/backend/src/service/UserHasWorkspaceService.ts
+++ b/backend/src/service/UserHasWorkspaceService.ts
@@ -1,8 +1,8 @@
import { StatusCodes } from 'http-status-codes';
import { Request, Response } from 'express';
import { getCustomRepository } from 'typeorm';
-import axios from 'axios';
import UserHasWorkspaceRepository from '../repository/UserHasWorkspaceRepository';
+import UserRepository from '../repository/UserRepository';
import FileRepository from '../repository/FileRepository';
const { BAD_REQUEST, OK } = StatusCodes;
@@ -81,10 +81,9 @@ export async function updateUserHasWorkspace(req: Request, res: Response) {
userHasWorkspaceById,
);
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
- axios.put(`http://${process.env.HOST}:${process.env.PORT}/api/users/${userId}`, {
- theme: userHasWorkspaceById.theme,
- });
+ const userById = await getCustomRepository(UserRepository).findOneOrFail(Number(userId));
+ userById.theme = userHasWorkspaceById.theme ?? userById.theme;
+ await getCustomRepository(UserRepository).save(userById);
return res.status(OK).json({ userHasWorkspace });
} catch (e) {
diff --git a/frontend/src/components/atoms/DraggableDiv/index.tsx b/frontend/src/components/atoms/DraggableDiv/index.tsx
new file mode 100644
index 00000000..a9dfff6b
--- /dev/null
+++ b/frontend/src/components/atoms/DraggableDiv/index.tsx
@@ -0,0 +1,21 @@
+import React from 'react';
+import { useSetRecoilState } from 'recoil';
+import { widthSizeState } from '@state/workspace';
+
+import Container from './styles';
+
+const DraggableDiv = (): JSX.Element => {
+ const setWidthSize = useSetRecoilState(widthSizeState);
+
+ const dragEventHandler = (e: React.DragEvent) => {
+ const { target } = e;
+ const { parentNode } = target;
+
+ const parentBox = parentNode.getBoundingClientRect();
+ setWidthSize(Math.max(47, (e.clientX / parentBox.width) * 100 + 1));
+ };
+
+ return ;
+};
+
+export default DraggableDiv;
diff --git a/frontend/src/components/atoms/DraggableDiv/styles.ts b/frontend/src/components/atoms/DraggableDiv/styles.ts
new file mode 100644
index 00000000..2a783570
--- /dev/null
+++ b/frontend/src/components/atoms/DraggableDiv/styles.ts
@@ -0,0 +1,16 @@
+import styled from 'styled-components';
+
+const Container = styled.div`
+ height: 95vh;
+ color: #f8f8f8;
+ border-left: 2px solid #fff;
+ border-right: 1.5px solid #f8f8f8;
+
+ &: hover {
+ cursor: -webkit-grabbing;
+ cursor: -moz-grabbing;
+ cursor: grabbing;
+ }
+`;
+
+export default Container;
diff --git a/frontend/src/components/organisms/BrowseChannelList/styles.ts b/frontend/src/components/organisms/BrowseChannelList/styles.ts
index 13786f97..0244a323 100644
--- a/frontend/src/components/organisms/BrowseChannelList/styles.ts
+++ b/frontend/src/components/organisms/BrowseChannelList/styles.ts
@@ -13,6 +13,8 @@ export const Container = styled.div`
if (width) return `${width}vw`;
return '95%';
}};
+ min-width: 10vw;
+
flex-direction: column;
`;
diff --git a/frontend/src/components/organisms/PreferenceModal/index.tsx b/frontend/src/components/organisms/PreferenceModal/index.tsx
index 9f0b8bcf..68606bf2 100644
--- a/frontend/src/components/organisms/PreferenceModal/index.tsx
+++ b/frontend/src/components/organisms/PreferenceModal/index.tsx
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { useRecoilState } from 'recoil';
import { preferenceModalState } from '@state/modal';
+import { PREFERENCE_MODAL_STATUS } from '@enum/index';
import PreferenceMenuContent from './PreferenceMenuContent';
import AboutUs from './AboutUs/AboutUs';
import ThemeSelect from './ThemeSelect';
@@ -14,14 +15,19 @@ import {
RowDiv,
} from './styles';
-const selectedContent = ({ isClicked }: { isClicked: number }): JSX.Element => {
- switch (isClicked) {
- case 1:
+const { ABOUT, THEME, OUT } = PREFERENCE_MODAL_STATUS;
+
+const selectedContent = ({
+ currentPreferenceStatus,
+}: {
+ currentPreferenceStatus: number;
+}): JSX.Element => {
+ switch (currentPreferenceStatus) {
+ case ABOUT:
return ;
- case 2:
+ case THEME:
return ;
- case 3:
- return ;
+ case OUT:
default:
return ;
}
@@ -29,7 +35,7 @@ const selectedContent = ({ isClicked }: { isClicked: number }): JSX.Element => {
const PreferenceModal = (): JSX.Element => {
const [isOpen, setIsOpen] = useRecoilState(preferenceModalState);
- const [isClicked, setClick] = useState(1);
+ const [currentPreferenceStatus, setClick] = useState(ABOUT);
return (
setIsOpen(false)} zIndex={100}>
@@ -38,27 +44,27 @@ const PreferenceModal = (): JSX.Element => {
setClick(1)}
+ isClicked={currentPreferenceStatus}
+ index={ABOUT}
+ onClick={() => setClick(ABOUT)}
text="About us"
/>
setClick(2)}
+ isClicked={currentPreferenceStatus}
+ index={THEME}
+ onClick={() => setClick(THEME)}
text="테마 설정"
/>
setClick(3)}
+ onClick={() => setClick(OUT)}
text="워크스페이스 탈퇴"
/>
- {selectedContent({ isClicked })}
+ {selectedContent({ currentPreferenceStatus })}
diff --git a/frontend/src/components/organisms/WorkspaceListContent/index.tsx b/frontend/src/components/organisms/WorkspaceListContent/index.tsx
index d9b7f6e6..9af9e22f 100644
--- a/frontend/src/components/organisms/WorkspaceListContent/index.tsx
+++ b/frontend/src/components/organisms/WorkspaceListContent/index.tsx
@@ -2,15 +2,14 @@
import React from 'react';
import { useRecoilValue } from 'recoil';
import { useHistory } from 'react-router-dom';
-import axios from 'axios';
import LabeledDefaultButton from '@atoms/LabeledDefaultButton';
import AsyncBranch from '@molecules/AsyncBranch';
-import API from '@global/api';
import useInfinityScroll from '@hook/useInfinityPage';
import wavingHandImage from '@global/image/wavingHandFromSlack.gif';
import userState from '@state/user';
import { Workspace } from '@global/type';
import { queryFlatMap } from '@global/util/reactQueryUtil';
+import { getWorkspaceLists } from '@global/api/workspace';
import {
HelloLabel,
StyledLabel,
@@ -32,7 +31,7 @@ const WorkSpaceLists = (workspaces: Workspace[]) => {
return workspaces.map(
({ id, name, count, fileId }: Workspace & { count: number }) => {
return (
-
+
{
);
};
-async function getWorkspaceLists({ pageParam = 0 }) {
- const { data } = await axios.get(API.get.workspace.user, {
- params: {
- page: pageParam,
- },
- });
-
- return data;
-}
-
const WorkspaceList = () => {
const { data, fetchNextPage, hasNextPage, isFetchingNextPage } =
useInfinityScroll('workspacelists', getWorkspaceLists);
diff --git a/frontend/src/components/templates/Workspace/index.tsx b/frontend/src/components/templates/Workspace/index.tsx
index afacce49..e34c3a7e 100644
--- a/frontend/src/components/templates/Workspace/index.tsx
+++ b/frontend/src/components/templates/Workspace/index.tsx
@@ -1,8 +1,9 @@
-import React, { ReactNode, Suspense, useEffect, useState } from 'react';
-import { useRecoilState, useRecoilValue } from 'recoil';
+import React, { ReactNode, useEffect, useState } from 'react';
+import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import { useParams } from 'react-router-dom';
import { useQueryClient } from 'react-query';
import { io } from 'socket.io-client';
+import DraggableDiv from '@atoms/DraggableDiv';
import WorkspaceHeader from '@organisms/WorkspaceHeader';
import WorkspaceSidebar from '@organisms/WorkspaceSidebar';
import CreateChannelModal from '@organisms/CreateChannelModal';
@@ -39,7 +40,6 @@ const WorkspaceTemplate = ({ children }: Props): JSX.Element => {
const channelTopicModal = useRecoilValue(channelTopicModalState);
const preferenceModal = useRecoilValue(preferenceModalState);
const userProfileModal = useRecoilValue(userProfileModalState);
-
const { isOpened } = useRecoilValue(replyToggleState);
const { workspaceId }: { workspaceId: string } = useParams();
@@ -87,6 +87,7 @@ const WorkspaceTemplate = ({ children }: Props): JSX.Element => {
{children}
+ {isOpened && }
{isOpened && }
{channelCreateModal && }
diff --git a/frontend/src/enum/index.ts b/frontend/src/enum/index.ts
index 59194e7b..0719c2b1 100644
--- a/frontend/src/enum/index.ts
+++ b/frontend/src/enum/index.ts
@@ -21,3 +21,5 @@ export const CHANNELTYPE = {
1: '🔒',
0: '#',
} as const;
+
+export const PREFERENCE_MODAL_STATUS = { ABOUT: 1, THEME: 2, OUT: 3 };
diff --git a/frontend/src/global/api/workspace/index.tsx b/frontend/src/global/api/workspace/index.tsx
index d0d99b6e..cdb93ea7 100644
--- a/frontend/src/global/api/workspace/index.tsx
+++ b/frontend/src/global/api/workspace/index.tsx
@@ -16,3 +16,13 @@ export const getUserHasWorkspace = async (
return res.data.userHasWorkspace;
};
+
+export const getWorkspaceLists = async ({ pageParam = 0 }) => {
+ const { data } = await axios.get(API.get.workspace.user, {
+ params: {
+ page: pageParam,
+ },
+ });
+
+ return data;
+};
diff --git a/frontend/src/state/workspace/index.ts b/frontend/src/state/workspace/index.ts
index 277a501d..968d6564 100644
--- a/frontend/src/state/workspace/index.ts
+++ b/frontend/src/state/workspace/index.ts
@@ -2,13 +2,13 @@ import { Message } from '@global/type';
import { atom, selector } from 'recoil';
const PAGEVW = 100;
-const OPENSIZE = 82;
+const WORKSPACE_SIZE = 82;
const SIDEBARSIZE = 18;
-const CLOSEDSIZE = 61;
+const CLOSEDSIZE = 21;
-export const sizestate = atom({
- key: 'sizeState',
- default: OPENSIZE,
+export const widthSizeState = atom({
+ key: 'widthSizeState',
+ default: WORKSPACE_SIZE,
});
export interface IreplyToggle {
@@ -30,10 +30,9 @@ export const mainWorkspaceSizeState = selector({
key: 'mainWorkspaceSizeState',
get: ({ get }) => {
const { isOpened } = get(replyToggleState);
- const OPENEDSIZE = get(sizestate);
-
- if (isOpened) return CLOSEDSIZE;
- return OPENEDSIZE;
+ const OPENEDSIZE = get(widthSizeState);
+ if (isOpened) return OPENEDSIZE - CLOSEDSIZE;
+ return WORKSPACE_SIZE;
},
});