diff --git a/index.html b/index.html
index 0d0b97d..fc0f2a2 100644
--- a/index.html
+++ b/index.html
@@ -8,7 +8,7 @@
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/reset-css@5.0.1/reset.min.css"
/>
-
TEMP
+ 당연하지 admin
diff --git a/src/api/api.ts b/src/api/api.ts
index 5b3fc3c..28aa4c4 100644
--- a/src/api/api.ts
+++ b/src/api/api.ts
@@ -1,16 +1,9 @@
import axios from "axios"
import { API_URL } from './Base';
-interface User {
- username: string,
- email: string,
- hireDate: string
- reaminVacation: number
-}
-
export const userListApi = async() => {
try {
- const data = await axios.get(`${API_URL}/api/admin/user/list`)
+ const data = await axios.get(`${API_URL}/user/list`)
if(data) {
return data
}
@@ -24,7 +17,7 @@ export const userListApi = async() => {
export const userApproveApi = async() => {
try {
- const data = await axios.get(`${API_URL}/api/admin/signup/list`)
+ const data = await axios.get(`${API_URL}/signup/list`)
if(data) {
return data
}
@@ -38,7 +31,7 @@ export const userApproveApi = async() => {
export const vacationApi = async() => {
try {
- const data = await axios.get(`${API_URL}/api/admin/vacation/approve/list`)
+ const data = await axios.get(`${API_URL}/vacation/approve/list`)
if(data) {
return data
} else {
@@ -51,7 +44,7 @@ export const vacationApi = async() => {
export const vacationPendingApi = async() => {
try {
- const data = await axios.get(`${API_URL}/api/admin/vacation/pending`)
+ const data = await axios.get(`${API_URL}/vacation/pending`)
if(data) {
return data
} else {
@@ -64,7 +57,7 @@ export const vacationPendingApi = async() => {
export const DutyListApi = async() => {
try {
- const data = await axios.get(`${API_URL}/api/admin/duty/approve/list`)
+ const data = await axios.get(`${API_URL}/duty/approve/list`)
if(data) {
return data
} else {
@@ -77,7 +70,7 @@ export const DutyListApi = async() => {
export const DutyPeindingListsApi = async() => {
try {
- const data = await axios.get(`${API_URL}/api/admin/duty/pending`)
+ const data = await axios.get(`${API_URL}/duty/pending`)
if(data) {
return data
} else {
diff --git a/src/components/App.tsx b/src/components/App.tsx
deleted file mode 100644
index 6700f82..0000000
--- a/src/components/App.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { NavLink } from 'react-router-dom'
-import Nav from './Nav'
-
-export const App = () => {
-
-
- return (
- <>
-
- >
- )
-}
diff --git a/src/components/Nav.tsx b/src/components/common/Layout.tsx
similarity index 76%
rename from src/components/Nav.tsx
rename to src/components/common/Layout.tsx
index f5e2557..5304078 100644
--- a/src/components/Nav.tsx
+++ b/src/components/common/Layout.tsx
@@ -1,10 +1,9 @@
import {NavLink, Outlet} from 'react-router-dom'
-import Styled from 'styled-components'
+import styled from 'styled-components'
-function Nav() {
+export const Layout = () => {
const links = [
- { path: '/', text: '홈'},
- { path: '/user', text: '유저 리스트'},
+ { path: '/', text: '유저 리스트'},
{ path: '/vacationpending', text: '연차 요청 리스트'},
{ path: '/vacation', text: '연차 리스트'},
{ path: '/dutypending', text: '당직 요청 리스트'},
@@ -36,13 +35,12 @@ function Nav() {
)
}
-export default Nav
-
-const StyledDiv = Styled.div`
+const StyledDiv = styled.div`
+ position: fix;
display: flex;
`
-const StyledNavContainer = Styled.div`
+const StyledNavContainer = styled.div`
min-width: 200px;
height: 100vh;
background-color: #66ffff;
@@ -50,9 +48,10 @@ const StyledNavContainer = Styled.div`
text-align: center;
`
-const StyledNavitem = Styled(NavLink)`
+const StyledNavitem = styled(NavLink)`
display: block;
font-size: 20px;
+ margin-top: 50px;
margin-bottom: 40px;
`
diff --git a/src/components/common/index.ts b/src/components/common/index.ts
new file mode 100644
index 0000000..1e0dd71
--- /dev/null
+++ b/src/components/common/index.ts
@@ -0,0 +1 @@
+export * from 'components/common/Layout';
\ No newline at end of file
diff --git a/src/components/duty/DutyList.tsx b/src/components/duty/DutyForm.tsx
similarity index 77%
rename from src/components/duty/DutyList.tsx
rename to src/components/duty/DutyForm.tsx
index 54ef9eb..78f5329 100644
--- a/src/components/duty/DutyList.tsx
+++ b/src/components/duty/DutyForm.tsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react'
import { Table } from 'antd'
-import SelectPeriod from "./SelectPeriod"
+import {SelectPeriod} from "./SelectPeriod"
import { DutyListApi } from '@/api/api'
interface DutyList {
username: string
@@ -9,7 +9,7 @@ interface DutyList {
dutyDate: string
}
-function DutyList() {
+export const DutyForm = () => {
const [dutyLists, setDutyLists] = useState([])
const DutyList = async() => {
@@ -38,27 +38,32 @@ function DutyList() {
{
title: '번호',
dataIndex: 'key',
- key: 'key'
+ key: 'key',
+ align: 'center' as 'center'
},
{
title: '성명',
dataIndex: 'username',
- key: 'username'
+ key: 'username',
+ align: 'center' as 'center'
},
{
title: '아이디',
dataIndex: 'email',
- key: 'email'
+ key: 'email',
+ align: 'center' as 'center'
},
{
title: '신청일',
dataIndex: 'createdDate',
- key: 'createdDate'
+ key: 'createdDate',
+ align: 'center' as 'center'
},
{
title: '당직일',
dataIndex: 'dutyDate',
- key: 'dutyDate'
+ key: 'dutyDate',
+ align: 'center' as 'center'
},
]
@@ -73,5 +78,3 @@ function DutyList() {
>
)
}
-
-export default DutyList
\ No newline at end of file
diff --git a/src/components/duty/DutyPendingList.tsx b/src/components/duty/DutyPendingForm.tsx
similarity index 82%
rename from src/components/duty/DutyPendingList.tsx
rename to src/components/duty/DutyPendingForm.tsx
index 7fc28ee..b5e8975 100644
--- a/src/components/duty/DutyPendingList.tsx
+++ b/src/components/duty/DutyPendingForm.tsx
@@ -9,7 +9,7 @@ interface DutyPending {
dutyDate: string
}
-function DutyPending() {
+export const DutyPendingForm = () => {
const [dutyPendingLists, setDutyPendingLists] = useState([])
const dutyPendingList = async () => {
@@ -49,32 +49,38 @@ function DutyPending() {
{
title: '번호',
dataIndex: 'key',
- key: 'key'
+ key: 'key',
+ align: 'center' as 'center'
},
{
title: '성명',
dataIndex: 'ueername',
- key: 'ueername'
+ key: 'ueername',
+ align: 'center' as 'center'
},
{
title: '아이디',
dataIndex: 'email',
- key: 'email'
+ key: 'email',
+ align: 'center' as 'center'
},
{
title: '신청일',
dataIndex: 'createdDate',
- key: 'createdDate'
+ key: 'createdDate',
+ align: 'center' as 'center'
},
{
title: '당직일',
dataIndex: 'dutyDate',
- key: 'dutyDate'
+ key: 'dutyDate',
+ align: 'center' as 'center'
},
{
title: '승인여부',
dataIndex: 'approveButton',
- key: 'approveButton'
+ key: 'approveButton',
+ align: 'center' as 'center'
}
]
@@ -97,8 +103,6 @@ function DutyPending() {
)
}
-export default DutyPending
-
const StyleButton = styled.div`
display: flex;
gap: 10px;
diff --git a/src/components/duty/SelectPeriod.tsx b/src/components/duty/SelectPeriod.tsx
index 67db982..7dbbb9e 100644
--- a/src/components/duty/SelectPeriod.tsx
+++ b/src/components/duty/SelectPeriod.tsx
@@ -1,6 +1,6 @@
-function SelectPeriod() {
+export const SelectPeriod = () => {
const handleChange = (e) => {
console.log(e.target.value)
}
@@ -47,6 +47,4 @@ function SelectPeriod() {
>
)
-}
-
-export default SelectPeriod
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/components/duty/index.ts b/src/components/duty/index.ts
new file mode 100644
index 0000000..e9f3368
--- /dev/null
+++ b/src/components/duty/index.ts
@@ -0,0 +1,3 @@
+export * from 'components/duty/DutyForm'
+export * from 'components/duty/DutyPendingForm'
+export * from 'components/duty/SelectPeriod'
\ No newline at end of file
diff --git a/src/components/index.ts b/src/components/index.ts
index 8de2ff2..46edd33 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -1,2 +1,6 @@
-export * from 'components/App'
export * from 'components/ErrorComponent'
+export * from 'components/common'
+export * from 'components/duty'
+export * from 'components/signin'
+export * from 'components/user'
+export * from 'components/vacation'
\ No newline at end of file
diff --git a/src/components/signin/SignIn.tsx b/src/components/signin/SignIn.tsx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/components/signin/SignInForm.tsx b/src/components/signin/SignInForm.tsx
new file mode 100644
index 0000000..df5d296
--- /dev/null
+++ b/src/components/signin/SignInForm.tsx
@@ -0,0 +1,5 @@
+export const SignInForm = () => {
+ return (
+ SignInForm
+ )
+}
diff --git a/src/components/signin/index.ts b/src/components/signin/index.ts
new file mode 100644
index 0000000..ae1cb51
--- /dev/null
+++ b/src/components/signin/index.ts
@@ -0,0 +1 @@
+export * from 'components/signin/SignInForm'
\ No newline at end of file
diff --git a/src/components/user/UserApproveButton.tsx b/src/components/user/UserApproveButton.tsx
new file mode 100644
index 0000000..4de269c
--- /dev/null
+++ b/src/components/user/UserApproveButton.tsx
@@ -0,0 +1,10 @@
+export const UserApproveButton = ( {email} ) => {
+
+ function handleClick() {
+ console.log(email)
+ }
+
+ return (
+
+ )
+}
diff --git a/src/components/user/UserApprove.tsx b/src/components/user/UserApproveForm.tsx
similarity index 57%
rename from src/components/user/UserApprove.tsx
rename to src/components/user/UserApproveForm.tsx
index 80223fc..6f34ff4 100644
--- a/src/components/user/UserApprove.tsx
+++ b/src/components/user/UserApproveForm.tsx
@@ -1,6 +1,8 @@
import { useState, useEffect } from 'react'
import { Table } from 'antd'
import { userApproveApi } from '@/api/api'
+import styled from 'styled-components'
+import { UserApproveButton } from './UserApproveButton'
interface UserApprove {
username: string
@@ -10,16 +12,15 @@ interface UserApprove {
-function UserApprove() {
+export const UserApproveForm = () => {
const [userApproveLists, setUserApproveLists] = useState([])
const userApprove = async () => {
try {
const res = await userApproveApi()
- if(res) [
+ if(res) {
setUserApproveLists(res.data.response)
- ]
-
+ }
} catch (error) {
console.error('error : ' + error)
}
@@ -37,53 +38,58 @@ function UserApprove() {
username: item.username,
email: item.email,
hireDate: item.hireDate,
- approveButton: (
-
- )
+ approveButton:
}))
const tableColumns = [
{
title: '사원명',
dataIndex: 'username',
- key: 'username'
+ key: 'username',
+ align: 'center' as 'center'
},
{
title: '아이디',
dataIndex: 'email',
- key: 'email'
+ key: 'email',
+ align: 'center' as 'center'
},
{
title: '입사일',
dataIndex: 'hireDate',
- key: 'hireDate'
+ key: 'hireDate',
+ align: 'center' as 'center'
},
{
title: '승인여부',
dataIndex: 'approveButton',
- key: 'approveButton'
+ key: 'approveButton',
+ align: 'center' as 'center'
}
]
- // 승인여부 버튼
- function handleApprove(e: string){
- console.log(e)
- }
-
return (
<>
- userApprove
-
+
+
+ 승인요청
+
+
+
>
)
}
-export default UserApprove
\ No newline at end of file
+const StyledTable = styled(Table)`
+ max-width: 800px;
+ margin-left: 50px;
+ .ant-table-wrapper {
+ width: 100%
+ }
+`
\ No newline at end of file
diff --git a/src/components/user/UserList.tsx b/src/components/user/UserForm.tsx
similarity index 59%
rename from src/components/user/UserList.tsx
rename to src/components/user/UserForm.tsx
index 029f30a..3148e74 100644
--- a/src/components/user/UserList.tsx
+++ b/src/components/user/UserForm.tsx
@@ -10,7 +10,7 @@ interface User {
reaminVacation: number
}
-function UserList() {
+export const UserForm = () => {
const [userLists, setUserLists] = useState([])
const userList = async () => {
@@ -34,18 +34,8 @@ function UserList() {
key: index+1,
username: item.username,
email: item.email,
- hireDate: item.hireDate.replace(/T *$/, ''),
+ hireDate: item.hireDate,
remainVacation: item.reaminVacation,
- updatePassword: (
-
- ),
- leave: (
-
- )
}))
const itemColumns = [
@@ -53,80 +43,70 @@ function UserList() {
title: '번호',
dataIndex: 'key',
key: 'key',
+ align: 'center' as 'center'
},
{
title: '사원명',
dataIndex: 'username',
key: 'username',
+ align: 'center' as 'center'
},
{
title: '아이디',
dataIndex: 'email',
key: 'email',
+ align: 'center' as 'center'
},
{
title: '입사일',
dataIndex: 'hireDate',
key: 'hireDate',
+ align: 'center' as 'center'
},
{
title: '전체연차',
dataIndex: '',
key: '',
+ align: 'center' as 'center'
},
{
title: '잔여연차',
dataIndex: 'remainVacation',
key: 'remainVacation',
- },
- {
- title: '비밀번호 수정',
- dataIndex: 'updatePassword',
- key: 'updatePassword',
- },
- {
- title: '퇴사여부',
- dataIndex: 'leave',
- key: 'leave',
+ align: 'center' as 'center'
},
]
- //비밀번호 수정 버튼
- function handleUpdatePassword(index: number) {
- console.log(index)
- }
-
- // 퇴사버튼
- // 리스트에서 삭제를 할것인지
- // 퇴사, 재직중으로 표시할 것인지
- function handleLeave(index: number) {
- setUserLists(userLists => userLists.filter((_,i) => i !== index))
-
- }
-
return (
<>
- UserList
-
- >
+
+
+ 유저 리스트
+
+
+
+ >
)
}
-export default UserList
-
const StyleTable = styled(Table)`
margin-top: 30px;
+ margin-left: 50px;
.ant-table-cell {
padding-bottom: 10px;
}
.userListTable {
text-align: center;
}
+ .ant-table-content {
+ text-align: center;
+
+ }
min-width: 1000px;
`
\ No newline at end of file
diff --git a/src/components/user/index.ts b/src/components/user/index.ts
new file mode 100644
index 0000000..173a38f
--- /dev/null
+++ b/src/components/user/index.ts
@@ -0,0 +1,3 @@
+export * from 'components/user/UserApproveButton'
+export * from 'components/user/UserApproveForm'
+export * from 'components/user/UserForm'
diff --git a/src/components/vacation/VacationList.tsx b/src/components/vacation/VacationForm.tsx
similarity index 77%
rename from src/components/vacation/VacationList.tsx
rename to src/components/vacation/VacationForm.tsx
index 579f31d..fc1b56f 100644
--- a/src/components/vacation/VacationList.tsx
+++ b/src/components/vacation/VacationForm.tsx
@@ -11,7 +11,7 @@ interface Annual {
endDate: string
}
-function VacationList() {
+export const VacationForm = () => {
const [vacationLists, setVacationLists] = useState([])
const vacationList = async () =>{
@@ -42,37 +42,44 @@ function VacationList() {
{
title: '번호',
dataIndex: 'key',
- key: 'key'
+ key: 'key',
+ align: 'center' as 'center'
},
{
title: '성명',
dataIndex: 'username',
- key: 'username'
+ key: 'username',
+ align: 'center' as 'center'
},
{
title: '아이디',
dataIndex: 'email',
- key: 'email'
+ key: 'email',
+ align: 'center' as 'center'
},
{
title: '사유',
dataIndex: 'reason',
- key: 'reason'
+ key: 'reason',
+ align: 'center' as 'center'
},
{
title: '신청일',
dataIndex: 'createAt',
- key: 'createAt'
+ key: 'createAt',
+ align: 'center' as 'center'
},
{
title: '시작일',
dataIndex: 'startDate',
- key: 'startDate'
+ key: 'startDate',
+ align: 'center' as 'center'
},
{
title: '종료일',
dataIndex: 'endDate',
- key: 'endDate'
+ key: 'endDate',
+ align: 'center' as 'center'
},
]
@@ -85,6 +92,4 @@ function VacationList() {
/>
>
)
-}
-
-export default VacationList
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/components/vacation/VacationPendingList.tsx b/src/components/vacation/VacationPendingForm.tsx
similarity index 96%
rename from src/components/vacation/VacationPendingList.tsx
rename to src/components/vacation/VacationPendingForm.tsx
index a951f7d..b193642 100644
--- a/src/components/vacation/VacationPendingList.tsx
+++ b/src/components/vacation/VacationPendingForm.tsx
@@ -11,7 +11,7 @@ interface VacationPendin {
endDate: string
}
-function VacationPendingList() {
+export const VacationPendingForm = () => {
const [vacationPendingLists, setVacationPendingLists] = useState([])
const vacationPendingList = async () => {
@@ -105,8 +105,6 @@ function VacationPendingList() {
)
}
-export default VacationPendingList
-
const StyleButton = styled.div`
display: flex;
gap: 10px;
diff --git a/src/components/vacation/index.ts b/src/components/vacation/index.ts
new file mode 100644
index 0000000..ae0b359
--- /dev/null
+++ b/src/components/vacation/index.ts
@@ -0,0 +1,2 @@
+export * from 'components/vacation/VacationForm'
+export * from 'components/vacation/VacationPendingForm'
\ No newline at end of file
diff --git a/src/pages/Duty.tsx b/src/pages/Duty.tsx
index ede5737..0333059 100644
--- a/src/pages/Duty.tsx
+++ b/src/pages/Duty.tsx
@@ -1,11 +1,9 @@
-import DutyList from "@/components/duty/DutyList"
+import {DutyForm} from "components/duty"
-function Duty() {
+export const Duty = () => {
return (
<>
-
+
>
)
}
-
-export default Duty
\ No newline at end of file
diff --git a/src/pages/DutyPending.tsx b/src/pages/DutyPending.tsx
index effd85e..2ce59db 100644
--- a/src/pages/DutyPending.tsx
+++ b/src/pages/DutyPending.tsx
@@ -1,11 +1,10 @@
-import DutyPendingList from "@/components/duty/DutyPendingList"
+import { DutyPendingForm } from "components/duty"
-function DutyPending() {
+
+export const DutyPending = () => {
return (
<>
-
+
>
)
}
-
-export default DutyPending
\ No newline at end of file
diff --git a/src/pages/Router.tsx b/src/pages/Router.tsx
index 349c706..b675f6d 100644
--- a/src/pages/Router.tsx
+++ b/src/pages/Router.tsx
@@ -1,19 +1,29 @@
import { createBrowserRouter } from 'react-router-dom'
-import { App,ErrorComponent } from 'components/index'
-import SignIn from './SignIn'
-import Vacation from './Vacation'
-import VacationPending from './VacationPending'
-import User from './User'
-import Duty from './Duty'
-import DutyPending from './DutyPending'
+import { ErrorComponent } from 'components/index'
+import {Layout} from 'components/common/index'
+import {
+ Duty,
+ DutyPending,
+ SignIn,
+ User,
+ Vacation,
+ VacationPending
+} from 'pages/index'
+
export const router = createBrowserRouter([
+ {
+ path: '/signin',
+ element: ,
+ errorElement: ,
+ children: []
+ },
{
path: '/',
- element: ,
+ element: ,
errorElement: ,
children: [
{
- path: '/user',
+ path: '/',
element: ,
errorElement: ,
children: []
@@ -43,11 +53,5 @@ export const router = createBrowserRouter([
children: []
}
]
- },
- {
- path: '/signin',
- element: ,
- errorElement: ,
- children: []
}
])
diff --git a/src/pages/SignIn.tsx b/src/pages/SignIn.tsx
index 3cce92a..ce6d5b5 100644
--- a/src/pages/SignIn.tsx
+++ b/src/pages/SignIn.tsx
@@ -1,7 +1,8 @@
-function SignIn() {
+export const SignIn = () => {
return (
SignIn
)
}
-export default SignIn
\ No newline at end of file
+
+
diff --git a/src/pages/User.tsx b/src/pages/User.tsx
index 3bfdc13..c19aff6 100644
--- a/src/pages/User.tsx
+++ b/src/pages/User.tsx
@@ -1,21 +1,18 @@
import Styled from 'styled-components'
-import UserApprove from "@/components/user/UserApprove"
-import UserList from "@/components/user/UserList"
+import {UserApproveForm} from "@/components/user/UserApproveForm"
+import {UserForm} from "@/components/user/UserForm"
-function User() {
+export const User = () => {
return (
- User
-
-
+
+
)
}
-export default User
-
const StyledUserSection = Styled.section`
- // text-align: center;
- // font-size: 30px;
+ text-align: center;
+ font-size: 30px;
`
\ No newline at end of file
diff --git a/src/pages/Vacation.tsx b/src/pages/Vacation.tsx
index e32f18f..3ba31cf 100644
--- a/src/pages/Vacation.tsx
+++ b/src/pages/Vacation.tsx
@@ -1,13 +1,11 @@
-import VacationList from "@/components/vacation/VacationList"
+import {VacationForm} from "@/components/vacation/VacationForm"
-function Vacation() {
+export const Vacation = () => {
return (
<>
-
+
>
)
-}
-
-export default Vacation
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/pages/VacationPending.tsx b/src/pages/VacationPending.tsx
index bea783b..37a903b 100644
--- a/src/pages/VacationPending.tsx
+++ b/src/pages/VacationPending.tsx
@@ -1,11 +1,9 @@
-import VacationPendingList from "@/components/vacation/VacationPendingList"
+import {VacationPendingForm} from "@/components/vacation/VacationPendingForm"
-function VacationPending() {
+export const VacationPending = () => {
return (
<>
-
+
>
)
}
-
-export default VacationPending
\ No newline at end of file
diff --git a/src/pages/index.ts b/src/pages/index.ts
index 823c17c..1c90997 100644
--- a/src/pages/index.ts
+++ b/src/pages/index.ts
@@ -1,2 +1,7 @@
export * from 'pages/Router'
-export * from 'pages/Duty'
\ No newline at end of file
+export * from 'pages/Duty'
+export * from 'pages/DutyPending'
+export * from 'pages/SignIn'
+export * from 'pages/User'
+export * from 'pages/Vacation'
+export * from 'pages/VacationPending'
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index fe3a6fa..6c5edf5 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -30,8 +30,8 @@
"@/*": ["src/*"],
"components/*": ["src/components/*"],
"styles/*": ["src/styles/*"],
- "pages/*": ["src/pages/*"]
-
+ "pages/*": ["src/pages/*"],
+ "api" : ["src/api/*"]
}
},
"include": [