Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d830d08
Docs: write about an error handling solution for ts setting
ppamppamman Nov 27, 2020
76f43f4
Add: 기초 레이아웃 와이어프레임 작업
ppamppamman Nov 27, 2020
c10f43d
Fix: change to presentation branch & beautify to prettier setting
ppamppamman Nov 29, 2020
aaa464c
Add: add .vscode to .gitignore
ppamppamman Nov 29, 2020
acebd3b
Fix: .vscode gitignore tracking delete
ppamppamman Nov 29, 2020
106b203
Add: temp-border for modal & Fix: Link style by inline
ppamppamman Nov 29, 2020
1df2224
Merge pull request #10 from ppamppamman/feat/registration_presentation
ppamppamman Nov 30, 2020
63af9cb
docs: Add README (in development)
Dec 2, 2020
3df8d28
docs: Modify README
Dec 2, 2020
d5616e8
feat:Create Redux-saga module for registration
kimuhjin Dec 6, 2020
803c44b
Delete readme.md
kimuhjin Dec 6, 2020
a07f20c
feat: add SignIn and Up module by redux-saga
kimuhjin Dec 16, 2020
1fe4507
Merge branch 'feat/registration_container' of https://github.com/reac…
kimuhjin Dec 16, 2020
869f322
Merge pull request #13 from react-sprint/feat/registration_container
Dec 16, 2020
a823f0a
feat: add SignIn and Up module by redux-saga
kimuhjin Dec 16, 2020
9eb886c
update:signIn&Up presenter republished
kimuhjin Dec 16, 2020
40ccedd
update:signIn&Up presenter republished
kimuhjin Dec 16, 2020
68bb01e
Merge pull request #16 from react-sprint/feat/registration_presenter_new
kimuhjin Dec 16, 2020
f41bdd8
Merge branch 'feat/MainPage' of github.com:react-sprint/study-around-…
ppamppamman Dec 18, 2020
86af009
Fix: before solve
ppamppamman Dec 18, 2020
95ae9a4
Merge branch 'feat/registration' of github.com:react-sprint/study-aro…
ppamppamman Dec 18, 2020
bdd9d37
update signin, signup, projects saga update & 메인페이지 useSelector 처리
ppamppamman Dec 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,82 @@
<<<<<<< HEAD
# Study Around 👨🏻‍💻

An web app for study group management



## Docs

<p align="left">
We use Notion for project management.
<br/>
<a href="https://www.notion.so/Study-Arousnd-9120c0a50855471c82716e0f6cd1cd03" style="text-decoration: none;">
click me
</a>
</div>
<br/>



## Developers

<table>
<tr>
<td align="center" style="font-size: 20px">
<a href="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/seung-00" style="text-decoration:none;"><img src="https://avatars2.githubusercontent.com/u/46865281?s=460&u=9687af854c3f5ae8a8f8b1e4f10a87587eaf5626&v=4" width="150px;" alt=""/>
<br />
<sub>
<b>오승영</b>
</sub>
</a>
<br />
<a href="https://github.com/react-sprint/study-around-front/commits?author=seung-00" title="Code">💻</a>
<a href="https://www.notion.so/Study-Around-9120c0a50855471c82716e0f6cd1cd03" title="Project Management">📆</a>
</td>
<td align="center" style="font-size: 20px">
<a href="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/kimuhjin" style="text-decoration:none;">
<img src="https://avatars2.githubusercontent.com/u/56405613?s=460&u=b1dc8505bf966d1364e9aecce175deaa42d6f7f9&v=4" width="150px;" alt=""/>
<br />
<sub>
<b>김어진</b>
</sub>
</a>
<br />
<a href="https://github.com/react-sprint/study-around-front/commits?author=kimuhjin" title="Code">💻</a>
</td>
<td align="center" style="font-size: 20px">
<a href="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/ppamppamman" style="text-decoration:none;">
<img src="https://avatars1.githubusercontent.com/u/13144573?s=460&u=9042af1affd7da76dd24c6f12aa8660bdd4e42e5&v=4" width="150px;" alt=""/>
<br />
<sub>
<b>뺨뺨맨</b>
</sub>
</a>
<br />
<a href="https://github.com/react-sprint/study-around-front/commits?author=ppamppamman
" title="Code">💻</a>
</td>
</tr>
</table>

=======
# study-around-front
스터디 그룹 관리 프로젝트


## error 관련

- If You have an these log **PLZ CHANGE** your typescript version that you are using on vscode.
```sh
The following changes are being made to your tsconfig.json file:
- compilerOptions.jsx must be react-jsx (to support the new JSX transform in React 17)
```
1. downgrade your typescript version 4.1.x to 4.0.5
```sh
yarn add [email protected]
```
2. change your typescript version that using on vscode
reference:
- https://www.reddit.com/r/react/comments/k0bw7y/compileroptionsjsx_must_be_reactjsx_to_support/
- https://github.com/facebook/create-react-app/issues/10103
>>>>>>> 9eb886c2f24d034a7fd37437cfb87bd6db5e8616
2 changes: 1 addition & 1 deletion client/.eslintcache

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"react/jsx-uses-vars": "error"
},
"ignorePatterns": ["*.config.js"]
}
}
4 changes: 3 additions & 1 deletion client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ yarn-debug.log*
yarn-error.log*

# lint
.eslintcache
.eslintcache
# vscode
/.vscode
5 changes: 4 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@types/react-dom": "^16.9.8",
"@types/react-redux": "^7.1.11",
"@types/react-router-dom": "^5.1.6",
"axios": "^0.21.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-icons": "^4.1.0",
Expand All @@ -20,8 +21,10 @@
"react-scripts": "4.0.1",
"redux-actions": "^2.6.5",
"redux-devtools-extension": "^2.13.8",
"redux-logger": "^3.0.6",
"redux-saga": "^1.1.3",
"styled-components": "^5.2.1",
"typescript": "^4.1.2",
"typescript": "4.1.2",
"web-vitals": "^0.2.4"
},
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';
import './App.css';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import MainPage from './pages/MainPage';
import SignupPage from './pages/SignupPage';
import SigninPage from './pages/SigninPage';
import { ThemeProvider } from 'styled-components';
import theme from './styles/theme';

Expand All @@ -11,6 +13,8 @@ function App() {
<BrowserRouter>
<Switch>
<Route exact path="/" component={MainPage} />
<Route path="/signup" component={SignupPage} />
<Route path="/signin" component={SigninPage} />
</Switch>
</BrowserRouter>
</ThemeProvider>
Expand Down
22 changes: 19 additions & 3 deletions client/src/composition/Main/MainContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
import React from 'react';
import React, { useState, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { projectsRequest } from '../../modules/ProjectsModule';
import MainPresentation from './MainPresentation';

function MainContainer() {
return <MainPresentation />;
function MainContainer(): JSX.Element {
const dispatch = useDispatch();
// const [projects, setProjects] = useState(null);
// const [form, setForm] = useState({
// token: '',
// });
// const { token } = form;
const projects = useSelector((state: any) => state.projects);
useEffect(() => {
dispatch(projectsRequest());
// const response = await dispatch(projectsSuccess())
console.log('MainContainer', projects);
// setProjects(response);
}, []);

return <MainPresentation projects={projects} />;
}

export default MainContainer;
12 changes: 10 additions & 2 deletions client/src/composition/Main/MainPresentation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import Card from '../Main/Card';
import styled from 'styled-components';
import { StudyInfo } from '../../constants/mocks';
Expand Down Expand Up @@ -37,7 +37,15 @@ const CardTtile = styled.div`

const TodayStudyInfos = StudyInfo.TodayStudyInfos;

function MainPresentation() {
function MainPresentation(props: any) {
const { projects } = props;
console.log('MainPresentation projects', projects);
useEffect(() => {
// console.log(projects?.projectsStatus?.data);
if (projects?.projectsStatus.data.length === 0) {
alert('불러올 스터디가 없습니다.');
}
}, []);
const Cards = TodayStudyInfos.map((info) => (
<Card
key={info.id}
Expand Down
4 changes: 4 additions & 0 deletions client/src/composition/Signout/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const Signout = () => {
window.localStorage.setItem('token', '');
alert('로그아웃 됐습니다.');
};
27 changes: 27 additions & 0 deletions client/src/hooks/useInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useState, Dispatch, SetStateAction } from 'react';

export interface IUseInput {
value: string;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
setValue: Dispatch<SetStateAction<string>>;
}

interface IUseInputProps {
initialState: string,
customOnChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
}

function useInput(props: IUseInputProps): IUseInput {
const { initialState, customOnChange } = props;

const [value, setValue] = useState(initialState);
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const { target: { value: val } } = e;
console.log(val);
setValue(val);
customOnChange(e);
};
return { value, onChange, setValue };
}

export default useInput;
23 changes: 20 additions & 3 deletions client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,29 @@ import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { createStore, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import rootReducer from './reducers';
// 임시 시작
// import rootReducer from './reducers';
import rootReducer, { rootSaga } from './modules';
import createSagaMiddleware from 'redux-saga';
import logger from 'redux-logger';

const store = createStore(rootReducer, composeWithDevTools());
const sagaMiddleware = createSagaMiddleware();

const store = createStore(
rootReducer,
composeWithDevTools(
applyMiddleware(
// ReduxThunk.withExtraArgument({ history: customHistory }),
sagaMiddleware,
logger
)
)
);

sagaMiddleware.run(rootSaga); // 루트 사가를 실행해줍니다.

ReactDOM.render(
<Provider store={store}>
Expand Down
27 changes: 27 additions & 0 deletions client/src/modules/ProjectsModule/actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const PROJECT_LIST_GET_REQUEST = 'project/PROJECT_LIST_GET_REQUEST';
export const PROJECT_LIST_GET_SUCCESS = 'project/PROJECT_LIST_GET_SUCCESS';
export const PROJECT_LIST_GET_ERROR = 'project/PROJECT_LIST_GET_ERROR';

export const projectsRequest = () => {
return {
type: 'PROJECT_LIST_GET_REQUEST',
};
};

export const projectsSuccess = (projectsData: any) => {
// window.localStorage.setItem('token', loginData['JWT token']);
return {
type: 'PROJECT_LIST_GET_SUCCESS',
payload: projectsData,
};
};

export const projectsError = (error) => {
alert('프로젝트를 불러올 수 없습니다.');
console.log(error);
return {
type: 'PROJECT_LIST_GET_ERROR',
error,
};
};
//
10 changes: 10 additions & 0 deletions client/src/modules/ProjectsModule/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Api from '../axiosConfig';
// import axios from 'axios';

export async function projectsApi() {
const response = await Api.get('http://localhost:3030/project/list');
console.log('api response', response);
return response.data;
}
//
//
4 changes: 4 additions & 0 deletions client/src/modules/ProjectsModule/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default } from './reducer';
export * from './actions';
export * from './types';
export * from './sagas';
29 changes: 29 additions & 0 deletions client/src/modules/ProjectsModule/reducer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const projects = (state = {}, action) => {
console.log('reducer action', action);
switch (action.type) {
case 'PROJECT_LIST_GET_REQUEST':
return {
...state,
projectsStatus: { loading: true, error: null, data: null },
};
case 'PROJECT_LIST_GET_SUCCESS':
return {
...state,
projectsStatus: {
loading: false,
error: null,
data: action.payload,
},
};
case 'PROJECT_LIST_GET_ERROR':
return {
...state,
projectsStatus: { loading: false, error: action.payload, data: null },
};
default:
return state;
}
};

export default projects;
//
22 changes: 22 additions & 0 deletions client/src/modules/ProjectsModule/sagas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { projectsRequest, projectsSuccess, projectsError } from './actions';
import { call, put, takeEvery } from 'redux-saga/effects';
import { projectsApi } from './api';
import history from '../history';

function* projectsFuncSaga(action: ReturnType<typeof projectsRequest>) {
try {
const projectsData = yield call(projectsApi);
console.log('projectsData in saga', projectsData);
yield put(projectsSuccess(projectsData));
} catch (e) {
if (e.response.data.message === 'Not Authenticated') {
// yield put() //로그인으로 돌리도록
} else {
yield put(projectsError(e));
}
}
}
export function* projectsSaga() {
yield takeEvery('PROJECT_LIST_GET_REQUEST', projectsFuncSaga);
}
//
14 changes: 14 additions & 0 deletions client/src/modules/ProjectsModule/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as actions from './actions';

export type ProjectsAction =
| ReturnType<typeof actions.projectsRequest>
| ReturnType<typeof actions.projectsSuccess>
| ReturnType<typeof actions.projectsError>;

export type ProjectsState = {
ProjectsStatus: {
loading: boolean;
data: any | null;
error: Error | null;
};
};
30 changes: 30 additions & 0 deletions client/src/modules/SignInModule/actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { loginApiProps } from './api';

export const LOGIN_REQUEST = 'login/LOGIN_REQUEST';
export const LOGIN_SUCCESS = 'login/LOGIN_SUCCESS';
export const LOGIN_ERROR = 'login/LOGIN_ERROR';

export const loginRequest = (form) => {
return {
type: 'LOGIN_REQUEST',
payload: form,
};
};

export const loginSuccess = (loginData: loginApiProps) => {
console.log('loginSuccess action', loginData);
window.localStorage.setItem('token', loginData['JWT token']);
return {
type: 'LOGIN_SUCCESS',
payload: loginData,
};
};

export const loginError = (error) => {
alert('아이디 혹은 비밀번호를 확인해주세요.');
return {
type: 'LOGIN_ERROR',
error,
};
};
//
Loading