Skip to content

Commit 46ba3c3

Browse files
committed
feat: create storage feature
1 parent b64bd11 commit 46ba3c3

File tree

21 files changed

+514
-39
lines changed

21 files changed

+514
-39
lines changed

package-lock.json

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"private": true,
55
"dependencies": {
66
"@bitty/pipe": "^0.2.1",
7+
"@rehooks/local-storage": "^2.4.5",
78
"@rsbuild/plugin-svgr": "^1.0.7",
9+
"@tanstack/react-query": "^5.69.0",
810
"@testing-library/jest-dom": "^5.11.4",
911
"@testing-library/react": "^11.1.0",
1012
"@testing-library/user-event": "^12.1.10",

public/locales/en/translation.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,10 @@
6060
"surface_water": "Surface Water",
6161
"population": "Population",
6262
"diameter": "Diameter"
63+
},
64+
"favorites": {
65+
"title": "Favorites",
66+
"cta": "Go to",
67+
"delete": "Delete"
6368
}
6469
}

public/locales/es/translation.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,10 @@
6060
"surface_water": "Agua Superficial",
6161
"population": "Población",
6262
"diameter": "Diámetro"
63+
},
64+
"favorites": {
65+
"title": "Favoritos",
66+
"cta": "Ir a",
67+
"delete": "Borrar"
6368
}
6469
}

public/locales/pt/translation.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,10 @@
6060
"surface_water": "Água Superficial",
6161
"population": "População",
6262
"diameter": "Diâmetro"
63+
},
64+
"favorites": {
65+
"title": "Favoritos",
66+
"cta": "Ir até",
67+
"delete": "Remover"
6368
}
6469
}

src/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { Navigate, Route, Routes } from 'react-router';
22
import { ItemList } from './pages/ItemList/ItemList';
33
import { ItemListLayout } from './components/layouts/ItemListLayout';
4+
import { GetById } from './pages/GetItemById/GetItemById';
5+
import { ItemStorageList } from './pages/ItemStorageList/ItemStorageList';
46

57
function App() {
68
return (
79
<Routes>
810
<Route path="/" element={<Navigate to="/planets" replace />} />
911
<Route element={<ItemListLayout />}>
12+
<Route path="favorites" element={<ItemStorageList />}></Route>
1013
<Route path="/:entityName" element={<ItemList />}></Route>
14+
<Route path="/:entityName/:entityId" element={<GetById />}></Route>
1115
</Route>
1216
</Routes>
1317
);

src/components/dropdown/FilterDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { ReactNode, useMemo } from 'react';
22

3-
import { useFilter } from '../../context/useFilter';
3+
import { useFilter } from '../../hooks/useFilter';
44
import FilterForm from '../forms/FilterForm';
55

66
import type { FilterValues } from '../../models/Item';

src/components/forms/SortForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Button from 'react-bootstrap/Button';
44
import FormControl from 'react-bootstrap/FormControl';
55

66
import orderLabels from '../../constants/orderLabels';
7-
import { initialValues } from '../../context/useSort';
7+
import { initialValues } from '../../hooks/useSort';
88
import OrderEnum from '../../models/enum/Order.enum';
99

1010
import type Item from '../../models/Item';

src/components/layouts/ItemListLayout.tsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Nav from 'react-bootstrap/Nav';
55
import Container from 'react-bootstrap/Container';
66
import { useTranslation } from 'react-i18next';
77
import { entitiesList } from '../../constants/entitiesList';
8+
import { NavDropdown } from 'react-bootstrap';
89

910
const Title = styled.h1`
1011
font-size: 1.9em;
@@ -37,15 +38,23 @@ export function ItemListLayout() {
3738
<Navbar.Toggle aria-controls="basic-navbar-nav" />
3839
<Navbar.Collapse id="basic-navbar-nav">
3940
<Nav>
40-
{entitiesList.map((entity) => {
41-
return (
42-
<Link to={`/${entity}`}>
43-
<Nav.Link href={`/${entity}`}>
44-
{t(`${entity}:title`)}
45-
</Nav.Link>
46-
</Link>
47-
);
48-
})}
41+
<NavDropdown title="Entidades" id="basic-nav-dropdown">
42+
{entitiesList.map((entity) => {
43+
return (
44+
<Link to={`/${entity}`}>
45+
<NavDropdown.Item href={`/${entity}`}>
46+
<Nav.Link href={`/${entity}`}>
47+
{t(`${entity}:title`)}
48+
</Nav.Link>
49+
</NavDropdown.Item>
50+
</Link>
51+
);
52+
})}
53+
</NavDropdown>
54+
55+
<Link to={`/favorites`}>
56+
<Nav.Link href={`/favorites`}>{t(`favorites:title`)}</Nav.Link>
57+
</Link>
4958
</Nav>
5059
</Navbar.Collapse>
5160
</Container>

src/components/table/PaginationButtonGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useCallback, useMemo } from 'react';
22
import Button from 'react-bootstrap/Button';
33
import ButtonGroup from 'react-bootstrap/ButtonGroup';
44

5-
import { Pagination } from '../../context/usePagination';
5+
import { Pagination } from '../../hooks/usePagination';
66

77
/**
88
* Props do componente `PaginationButtonGroup`

0 commit comments

Comments
 (0)