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

[team-22][FE] 2주차 2번째 PR - Park + BB #205

Open
wants to merge 8 commits into
base: team-22
Choose a base branch
from
4 changes: 4 additions & 0 deletions back/src/middlewares/cors.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const cors = (req, res, next) => {
key: "Access-Control-Allow-Methods",
value: isProduction ? SERVICE_DOMAIN : "*",
},
{
key: "Access-Control-Allow-Headers",
value: isProduction ? SERVICE_DOMAIN : "*",
},
];
accessControls.forEach((control) => {
const { key, value } = control;
Expand Down
10 changes: 10 additions & 0 deletions front/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ module.exports = {
"plugin:prettier/recommended",
"plugin:import/recommended",
],
settings: {
"import/resolver": {
webpack: {
env: {
DEPLOY: true,
},
},
},
},
rules: {
"prettier/prettier": [
"error",
Expand All @@ -34,5 +43,6 @@ module.exports = {
"import/prefer-default-export": "off",
"func-names": "off",
"no-underscore-dangle": ["error", { allow: ["_id"] }],
"no-param-reassign": "off",
},
};
172 changes: 172 additions & 0 deletions front/package-lock.json

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

1 change: 1 addition & 0 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"eslint": "^8.2.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-webpack": "^0.13.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-webpack-plugin": "^3.1.1",
Expand Down
58 changes: 49 additions & 9 deletions front/src/App.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
import Columns from "components/Content/Columns/Columns";
import Content from "components/Content/Content";
import Header from "components/Header/Header";
import Modal from "components/Modal/Modal";
import SideContent from "components/SideContent/SideContent";
import peact from "core/peact";
import columnApi from "service/columnApi";
import logApi from "service/logApi";
import todoApi from "service/todoApi";

import styles from "./App.module.css";
import Content from "./components/Content/Content";
import Header from "./components/Header/Header";
import SideContent from "./components/SideContent/SideContent";
import peact from "./core/peact";
import columnApi from "./service/columnApi";
import logApi from "./service/logApi";
import todoApi from "./service/todoApi";

const App = () => {
const [todos, setTodos] = peact.useState([]);
const [columns, setColumns] = peact.useState([]);
const [todoLogs, setTodoLogs] = peact.useState([]);
const [renderFlag, setRenderFlag] = peact.useState(false);
const [selectedTodoId, setSelectedTodoId] = peact.useState(null);
const [isModalVisible, setIsModalVisible] = peact.useState(false);

const modalRef = peact.useRef();

const handleRenderFlag = () => {
setRenderFlag(!renderFlag);
};

const handleModalVisibility = () => {
setIsModalVisible(!isModalVisible);
};

const handleSelectedTodoId = (todoId) => {
setSelectedTodoId(todoId);
};

peact.useEffect(() => {
const fetchTodos = async () => {
const newTodos = await todoApi.getTodos();
Expand All @@ -35,16 +50,41 @@ const App = () => {
fetchTodoLogs();
}, [renderFlag]);

const modalHandlers = {
handleRenderFlag,
handleSelectedTodoId,
handleModalVisibility,
};

const $modal = Modal({
handlers: modalHandlers,
ref: modalRef,
isModalVisible,
selectedTodoId,
});

const columnsHandlers = {
handleRenderFlag,
handleSelectedTodoId,
handleModalVisibility,
};

const $columns = Columns({
columns,
todos,
handlers: columnsHandlers,
});

const $todoListArea = peact.createElement({
tag: "div",
className: styles.todolistArea,
child: [Header(), Content({ columns, todos, handleRenderFlag })],
child: [Header(), Content({ content: $columns })],
});

return peact.createElement({
tag: "div",
className: styles.wrap,
child: [$todoListArea, SideContent({ todoLogs, columns })],
child: [$todoListArea, SideContent({ todoLogs, columns }), $modal],
});
};

Expand Down
8 changes: 4 additions & 4 deletions front/src/common/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const LOG_TYPE = {
create: "등록",
delete: "삭제",
update: "변경",
move: "이동",
CREATE: "등록",
DELETE: "삭제",
UPDATE: "변경",
MOVE: "이동",
};
Loading