11import { useEffect } from 'react'
22import { shallowEqual } from 'react-redux'
3- import { Input , Breadcrumb } from 'antd'
43import { Helmet } from "react-helmet"
4+ import { Input , Breadcrumb , Button } from 'antd'
5+ import { RedoOutlined } from "@ant-design/icons"
56
6- import { useAppSelector , useAppDispatch } from '../redux/hooks'
7- import { homeSlice , listRepos , perPage , sync , homeSlice as slice } from '../redux/home'
8- import { RequestStatus } from '../models'
9- import { subscribeEvents } from "../apis"
7+ import { useAppSelector , useAppDispatch } from '../../ redux/hooks'
8+ import { homeSlice , listRepos , perPage , sync , homeSlice as slice } from '../../ redux/home'
9+ import { RequestStatus } from '../../ models'
10+ import { subscribeEvents } from "../../ apis"
1011
11- import Main from './main'
12- import SyncButton from "../components/SyncButton"
13- import RepoList from '../components/RepoList'
14- import Pagination from '../components/Pagination'
12+ import Main from '../main'
13+ import RepoList from './RepoList'
14+ import Pagination from '../../components/Pagination'
1515
1616const { Search } = Input
1717const { actions } = homeSlice
1818
1919export default function Home ( ) : JSX . Element {
20- const { loading , repos, page, syncing } = useAppSelector ( state => state . home , shallowEqual )
20+ const { repos, page, syncing } = useAppSelector ( state => state . home , shallowEqual )
2121 const dispatch = useAppDispatch ( )
2222
2323 useEffect ( ( ) => {
@@ -57,20 +57,6 @@ export default function Home(): JSX.Element {
5757 f ( )
5858 }
5959
60- if ( loading ) {
61- return (
62- < Main >
63- < div >
64- < Breadcrumb >
65- < Breadcrumb . Item >
66- < a href = "/" > Repositories</ a >
67- </ Breadcrumb . Item >
68- </ Breadcrumb >
69- </ div >
70- </ Main >
71- )
72- }
73-
7460 return (
7561 < Main >
7662 < Helmet >
@@ -84,13 +70,19 @@ export default function Home(): JSX.Element {
8470 </ Breadcrumb >
8571 </ div >
8672 < div style = { { textAlign : "right" } } >
87- < SyncButton loading = { syncing === RequestStatus . Pending } onClickSync = { onClickSync } > </ SyncButton >
73+ < Button
74+ loading = { syncing === RequestStatus . Pending }
75+ icon = { < RedoOutlined /> }
76+ onClick = { onClickSync }
77+ >
78+ Sync
79+ </ Button >
8880 </ div >
8981 < div style = { { "marginTop" : "20px" } } >
9082 < Search placeholder = "Search repository ..." onSearch = { search } size = "large" enterButton />
9183 </ div >
9284 < div style = { { "marginTop" : "20px" } } >
93- < RepoList repos = { repos } > </ RepoList >
85+ < RepoList / >
9486 </ div >
9587 < div style = { { marginTop : "20px" , textAlign : "center" } } >
9688 < Pagination
@@ -102,4 +94,4 @@ export default function Home(): JSX.Element {
10294 </ div >
10395 </ Main >
10496 )
105- }
97+ }
0 commit comments