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

Create Phone catalog #519

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
679e8d4
create header, store, Root router
Anothar May 15, 2024
9899f54
add HomePage and Styled Component
Anothar May 20, 2024
1030c07
create api
Anothar May 26, 2024
2d432b4
create resucers and fetch products
Anothar Sep 15, 2024
71df490
create ProductCard
Anothar Sep 16, 2024
0025d54
create Footer
Anothar Sep 18, 2024
b4ee81a
fixed Footer
Anothar Sep 18, 2024
eea0362
create Select and Option, ang create Theme switcher
Anothar Sep 21, 2024
5b03908
add change language
Anothar Sep 24, 2024
200369c
fixed and create ProductSlider
Anothar Sep 28, 2024
9bf4551
fix and create home page
Anothar Oct 2, 2024
25cf854
add item
Anothar Oct 2, 2024
7ee7888
create navLink
Anothar Oct 4, 2024
28de6a7
create products page
Anothar Oct 4, 2024
49011ce
add files
Anothar Oct 4, 2024
645824f
create skeleton, pagination and not found page
Anothar Oct 8, 2024
0eba0a4
create searchBar
Anothar Oct 8, 2024
3a3ad67
create search result
Anothar Oct 9, 2024
e0aafc1
add files
Anothar Oct 9, 2024
5b00559
add persist and localstorage
Anothar Oct 9, 2024
4c440d8
create favourites
Anothar Oct 11, 2024
d928952
create cart page
Anothar Oct 13, 2024
e73a066
add files
Anothar Oct 13, 2024
51880b0
create Product Item Page
Anothar Oct 13, 2024
1498187
fix
Anothar Oct 13, 2024
5b0d79c
fix and add themes all
Anothar Oct 14, 2024
6c329a4
add files
Anothar Oct 14, 2024
cedafca
fix base url
Anothar Oct 14, 2024
685cb2e
fix url img
Anothar Oct 14, 2024
2499467
fix url fonts
Anothar Oct 14, 2024
e5448a7
fixed
Anothar Oct 14, 2024
9973296
fix button futer and useProduct
Anothar Oct 14, 2024
0dc4086
many fixed
Anothar Oct 15, 2024
4d27f6f
fix header meny
Anothar Oct 15, 2024
bbfb668
fix not found cart
Anothar Oct 15, 2024
d32fa34
fix count cart
Anothar Oct 15, 2024
a8a26d6
add text center
Anothar Oct 15, 2024
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
15 changes: 14 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ module.exports = {
extends: [
'@mate-academy/eslint-config-react-typescript',
'plugin:cypress/recommended',
"plugin:@typescript-eslint/recommended",
"prettier",
],
rules: {},
"plugins": ["prettier"],
rules: {
"prettier/prettier": "error" ,
"no-param-reassign": [
"error",
{
"props": true,
"ignorePropertyModificationsFor": ["state"]
}
],
"no-console": "off",
}
};
1,240 changes: 568 additions & 672 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,36 @@
"dependencies": {
"@cypress/react18": "^2.0.0",
"@fortawesome/fontawesome-free": "^6.2.0",
"@reduxjs/toolkit": "^2.2.4",
"@types/react-redux": "^7.1.33",
"@types/react-transition-group": "^4.4.5",
"bulma": "^0.9.4",
"classnames": "^2.5.1",
"i18next": "^23.15.1",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-http-backend": "^2.6.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^15.0.2",
"react-redux": "^9.1.2",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"react-transition-group": "^4.4.5"
"react-toastify": "^10.0.5",
"react-transition-group": "^4.4.5",
"redux-persist": "^6.0.0",
"styled-components": "^6.1.11"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@mate-academy/eslint-config-react-typescript": "latest",
"@mate-academy/scripts": "^1.7.9",
"@mate-academy/scripts": "^1.8.1",
"@mate-academy/students-ts-config": "latest",
"@mate-academy/stylelint-config": "latest",
"@types/node": "^16.18.80",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"@types/redux-persist": "^4.3.1",
"cross-env": "^7.0.3",
"cypress": "^12.17.4",
"eslint": "^7.32.0",
"eslint-plugin-cypress": "^2.11.2",
Expand All @@ -37,7 +49,8 @@
"prettier": "^3.2.5",
"sass": "^1.72.0",
"stylelint": "^15.11.0",
"typescript": "5.1.6"
"typescript": "5.1.6",
"typescript-plugin-css-modules": "^5.1.0"
},
"scripts": {
"start": "mate-scripts start -l",
Expand Down
Binary file added public/img/favicon.ico
Binary file not shown.
39 changes: 39 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,45 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Phone catalog</title>
<link rel="icon" href="/react_phone-catalog/img/favicon.ico" type="image/x-icon" />
<style>
::-webkit-scrollbar {
width: 8px;
height: 8px;
}

::-webkit-scrollbar-thumb {
background-color: #636363;
border-radius: 8px;
}

::-webkit-scrollbar-track {
border-radius: 8px;
}
</style>
<style>
@font-face {
font-family: Mont-Regular;
src: url(/react_phone-catalog/fonts/Mont-Regular.otf) format('opentype');
font-weight: 600;
}

@font-face {
font-family: Mont-SemiBold;
src: url(/react_phone-catalog/fonts/Mont-SemiBold.otf) format('opentype');
font-weight: 700;
}

@font-face {
font-family: Mont-Bold;
src: url(/react_phone-catalog/fonts/Mont-Bold.otf) format('opentype');
font-weight: 800;
}

body {
font-family: 'Mont-Regular', sans-serif;
}
</style>
</head>
<body>
<div id="root"></div>
Expand Down
62 changes: 62 additions & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"WELCOME_MESSAGE": "Welcome to Nice Gadgets store!",
"NEW_MODELS": "Brand new models",
"SCREEN": "Screen",
"CAPACITY": "Capacity",
"RAM": "RAM",
"ADD_TO_CART": "Add to cart",
"SHOP_BY_CATEGORY": "Shop by category",
"MOBILE_PHONES": "Mobile phones",
"MODELS": "models",
"TABLETS": "Tablets",
"ACCESSORIES": "Accessories",
"HOT_PRICES": "Hot prices",
"CONTACTS": "Contacts",
"RIGHTS": "Rights",
"BACK_TO_TOP": "Back to top",
"THEME": "Theme",
"LANGUAGE": "Language",
"HOME": "Home",
"PHONES": "Phones",
"ADDED": "Added",
"PAGE_NOT_FOUND": "Page Not Found. Go to home page?",
"SORT_BY": "Sort by",
"ITEMS_ON_PAGE": "Items on page",
"SORT_AGE": "Newest",
"SORT_NAME": "Alphabetically",
"SORT_PRICE": "Cheapest",
"NOT_PHONES": "Sorry... There are no phones yet... Go to phones page?",
"NOT_TABLETS": "Sorry... There are no tablets yet... Go to tablets page?",
"NOT_ACCESSORIES": "Sorry... There are no accessories yet... Go to accessories page?",
"GO_BACK": "GO BACK",
"GO_HOME": "HOME PAGE",
"SEARCH_TEXT": "Enter search text!",
"FAVOURITES": "Favourites",
"NO_SEARCH": "No search results...",
"SEE_ALL": "Search",
"SEE_PHONES": "See phones",
"SEE_TABLETS": "See tablets",
"SEE_ACCESORIES": "See accesories",
"CLEAR": "Clear",
"NOT_FAVOURITES": "There are no favourites yet...",
"NOT_CART": "Your cart is empty...",
"BACK": "Back",
"CART": "Cart",
"TOTAL_FOR": "Total for",
"ITEMS": "items",
"CHECKOUT": "Checkout",
"CART_CHECKOUT_MSG": "Checkout is not implemented yet. Do you want to clear the Cart?",
"CONFIRM": "Confirm",
"CANCEL": "Cancel",
"AVAILABLE_COLORS": "Available Colors",
"SELECT_CAPACITY": "Select capacity",
"RESOLUTION": "Resolution",
"PROCESSOR": "Processor",
"ABOUT": "About",
"TECH_SPECS": "Tech specs",
"BUILT_IN_MEMORY": "Built in memory",
"CELL": "Cell",
"CAMERA": "Camera",
"ZOOM": "Zoom",
"PRODUCT_NOT": "Product not found. Go home page?"
}
62 changes: 62 additions & 0 deletions public/locales/uk/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"WELCOME_MESSAGE": "Ласкаво просимо до магазину Nice Gadgets!",
"NEW_MODELS": "Нові моделі",
"SCREEN": "Екран",
"CAPACITY": "Ємність",
"RAM": "ОЗП",
"ADD_TO_CART": "Додати до кошика",
"SHOP_BY_CATEGORY": "Купити за категоріями",
"MOBILE_PHONES": "Мобільні телефони",
"MODELS": "моделі",
"TABLETS": "Планшети",
"ACCESSORIES": "Аксесуари",
"HOT_PRICES": "Гарячі ціни",
"CONTACTS": "Контакти",
"RIGHTS": "Права",
"BACK_TO_TOP": "Повернутися нагору",
"THEME": "Тема",
"LANGUAGE": "Мова",
"HOME": "Головна",
"PHONES": "Телефони",
"ADDED": "Добавлено",
"PAGE_NOT_FOUND": "Сторінка не знайдена. Повернутись на домашню сторінку?",
"SORT_BY": "Сортувати за",
"ITEMS_ON_PAGE": "Елементів",
"SORT_AGE": "Новизною",
"SORT_NAME": "Назвою",
"SORT_PRICE": "Дешевизною",
"NOT_PHONES": "Вибачте... Наразі немає телефонів... Перейти на сторінку телефонів?",
"NOT_TABLETS": "Вибачте... Наразі немає планшетів... Перейти на сторінку планшетів?",
"NOT_ACCESSORIES": "Вибачте... Наразі немає аксесуарів... Перейти на сторінку аксесуарів?",
"GO_BACK": "ПОВЕРНУТИСЬ",
"GO_HOME": "ДОМАШНЯ СТОРІНКА",
"SEARCH_TEXT": "Введіть пошуковий текст!",
"FAVOURITES": "Збереження",
"NO_SEARCH": "Немає результатів пошуку...",
"SEE_ALL": "Пошук",
"SEE_PHONES": "Телефони",
"SEE_TABLETS": "Планшети",
"SEE_ACCESORIES": "Аксесуари",
"CLEAR": "Очистити",
"NOT_FAVOURITES": "Наразі ваші збереження пусті...",
"NOT_CART": "Наразі ваш кошик пустий...",
"BACK": "Повернутись",
"CART": "Кошик",
"TOTAL_FOR": "Разом за",
"ITEMS": "шт.",
"CHECKOUT": "Оплата",
"CART_CHECKOUT_MSG": "Оформлення замовлення ще не реалізовано. Ви хочете очистити кошик?",
"CONFIRM": "Підтвердити",
"CANCEL": "Скасувати",
"AVAILABLE_COLORS": "Доступні кольори",
"SELECT_CAPACITY": "Вибрати об'єм",
"RESOLUTION": "Роздільна здатність",
"PROCESSOR": "Процесор",
"ABOUT": "Про продукт",
"TECH_SPECS": "Технічні характеристики",
"BUILT_IN_MEMORY": "Вбудована пам'ять",
"CELL": "Мобільний зв'язок",
"CAMERA": "Камера",
"ZOOM": "Приближення",
"PRODUCT_NOT": "Товар не знайдено. Перейти на домашнюю сторінку?"
}
24 changes: 23 additions & 1 deletion src/App.scss
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
// not empty
* {
box-sizing: border-box;
transition: all 0.3s;
}

body {
margin: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
-webkit-text-fill-color: black;
-webkit-box-shadow: 0 0 0 1000px white inset;
}
66 changes: 61 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,63 @@
import { Outlet, useLocation } from 'react-router-dom';
import './App.scss';
import { Header } from './components/Header';
import { useEffect } from 'react';
import { getFrom } from './api/api';
import { useAppDispatch } from './hooks/hookStore';
import { setAccessories } from './features/accessoriesSlice';
import { setTables } from './features/tablesSlice';
import { setPhones } from './features/phoneSlice';
import { setProducts } from './features/productsSlice';
import { Footer } from './components/Footer';
import { ThemeProvider } from './components/Themes/ThemeProvider';
import { AppStyled, MainStyled } from './AppStyled';

export const App = () => (
<div className="App">
<h1>Product Catalog</h1>
</div>
);
export const App = () => {
const dispatch = useAppDispatch();
const { pathname } = useLocation();

useEffect(() => {
window.scrollTo({
top: 0,
behavior: 'smooth',
});
}, [pathname]);

useEffect(() => {
const fetchItems = async () => {
try {
const [phones, tables, accesories, products] = await Promise.all([
getFrom.getPhones(),
getFrom.getTables(),
getFrom.getAccessories(),
getFrom.getProducts(),
]);

dispatch(setPhones(phones));
dispatch(setTables(tables));
dispatch(setAccessories(accesories));
dispatch(setProducts(products));
} catch (error) {
console.error('Error, get products:', error);
}
};

fetchItems();
}, [dispatch]);

return (
<ThemeProvider>
<AppStyled className="App">
<Header />

<Outlet />

<MainStyled />

<div id="modal-root"></div>

<Footer />
</AppStyled>
</ThemeProvider>
);
};
22 changes: 22 additions & 0 deletions src/AppStyled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
import styled from 'styled-components';
import { media } from './utils/const';

const AppStyled = styled.div`
background-color: ${({ theme }) => theme.bacgroundPage};
padding-top: 48px;
min-height: 100vh;
display: flex;
flex-direction: column;
min-width: 320px;

${media.desktop} {
padding-top: 64px;
}
`;

const MainStyled = styled.main`
flex: 1;
`;

export { AppStyled, MainStyled };
Loading