From 8dea9e9242aca8bf003a7c2f69c96abafbf77e6d Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 10 Apr 2023 16:29:48 +0700 Subject: page loader --- src/core/components/elements/Link/Link.jsx | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/core') diff --git a/src/core/components/elements/Link/Link.jsx b/src/core/components/elements/Link/Link.jsx index 360444a6..b2dbd02f 100644 --- a/src/core/components/elements/Link/Link.jsx +++ b/src/core/components/elements/Link/Link.jsx @@ -1,14 +1,6 @@ import NextLink from 'next/link' -import { useRouter } from 'next/router' -import { useEffect } from 'react' const Link = ({ children, ...props }) => { - const router = useRouter() - - useEffect(() => { - router.events.on('routeChangeComplete', () => window.scrollTo({ top: 0, behavior: 'smooth' })) - }, [router]) - return ( Date: Mon, 10 Apr 2023 16:49:16 +0700 Subject: fix --- src/core/components/elements/Spinner/LogoSpinner.jsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/core/components/elements/Spinner/LogoSpinner.jsx (limited to 'src/core') diff --git a/src/core/components/elements/Spinner/LogoSpinner.jsx b/src/core/components/elements/Spinner/LogoSpinner.jsx new file mode 100644 index 00000000..73b84e84 --- /dev/null +++ b/src/core/components/elements/Spinner/LogoSpinner.jsx @@ -0,0 +1,15 @@ +import Image from 'next/image' +import IndoteknikLogo from '@/images/LOGO-INDOTEKNIK-GEAR.png' + +const LogoSpinner = ({ ...props }) => ( + Indoteknik Logo +) + +export default LogoSpinner -- cgit v1.2.3 From 92c2a229d9c9b510d71b928978872a8b107e9d5a Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 11 Apr 2023 09:47:25 +0700 Subject: Documentation and refactor code --- src/core/api/odooApi.js | 11 ++++++ src/core/components/elements/Alert/Alert.jsx | 10 ++++++ src/core/components/elements/Appbar/Appbar.jsx | 29 +++++++-------- src/core/components/elements/Divider/Divider.jsx | 8 +++++ src/core/components/elements/Image/Image.jsx | 8 +++++ src/core/components/elements/Link/Link.jsx | 8 +++++ .../components/elements/Navbar/NavbarMobile.jsx | 12 ++----- src/core/components/elements/Navbar/Search.jsx | 10 ++---- .../components/elements/Pagination/Pagination.js | 5 +-- .../components/elements/Skeleton/BrandSkeleton.jsx | 5 +-- .../components/elements/Skeleton/ImageSkeleton.jsx | 10 ++---- .../elements/Skeleton/ProductCardSkeleton.jsx | 5 +-- src/core/hooks/useDevice.js | 1 - src/core/hooks/useSidebar.js | 7 +--- src/core/utils/address.js | 35 +++++++++++++++--- src/core/utils/auth.js | 20 +++++++++-- src/core/utils/cart.js | 41 ++++++++++++++++++++-- src/core/utils/currencyFormat.js | 6 ++++ src/core/utils/getFileBase64.js | 13 +++++-- src/core/utils/greeting.js | 10 ++++++ src/core/utils/slug.js | 24 +++++++++++++ src/core/utils/toTitleCase.js | 9 +++++ 22 files changed, 212 insertions(+), 75 deletions(-) (limited to 'src/core') diff --git a/src/core/api/odooApi.js b/src/core/api/odooApi.js index 25ee9adf..fe9fcdd2 100644 --- a/src/core/api/odooApi.js +++ b/src/core/api/odooApi.js @@ -18,6 +18,17 @@ const getToken = async () => { const maxConnectionAttempt = 15 let connectionAttempt = 0 +/** + * The `odooApi` function is used to make API requests to an Odoo backend with customizable parameters such as `method`, `url`, `data`, and `headers`. + * + * @async + * @function + * @param {string} method - HTTP method for the API request (e.g., GET, POST, PUT, DELETE). + * @param {string} url - URL endpoint for the API request. + * @param {Object} data - Data to be sent in the request payload. + * @param {Object} headers - Custom headers to be sent in the request. + * @returns {Promise} - A Promise that resolves to the API response data or an empty array. + */ const odooApi = async (method, url, data = {}, headers = {}) => { connectionAttempt++ try { diff --git a/src/core/components/elements/Alert/Alert.jsx b/src/core/components/elements/Alert/Alert.jsx index 695be8a3..cf84b591 100644 --- a/src/core/components/elements/Alert/Alert.jsx +++ b/src/core/components/elements/Alert/Alert.jsx @@ -1,3 +1,13 @@ +/** + * The Alert component is used to display different types of alerts or notifications + * with different styles based on the provided type prop. + * + * @param {Object} props - Props received by the component. + * @param {ReactNode} props.children - The content to be displayed inside the alert. + * @param {string} props.className - Additional CSS class names for the alert. + * @param {string} props.type - The type of the alert ('info', 'success', or 'warning'). + * @returns {JSX.Element} - Rendered Alert component. + */ const Alert = ({ children, className, type }) => { let typeClass = '' switch (type) { diff --git a/src/core/components/elements/Appbar/Appbar.jsx b/src/core/components/elements/Appbar/Appbar.jsx index 098d0a33..f1456a7c 100644 --- a/src/core/components/elements/Appbar/Appbar.jsx +++ b/src/core/components/elements/Appbar/Appbar.jsx @@ -2,38 +2,33 @@ import { useRouter } from 'next/router' import Link from '../Link/Link' import { HomeIcon, Bars3Icon, ShoppingCartIcon, ChevronLeftIcon } from '@heroicons/react/24/outline' +/** + * The AppBar component is a navigation component used to display a header or toolbar + * in a web application. + * + * @param {Object} props - Props received by the component. + * @param {string} props.title - The title to be displayed on the AppBar. + * @returns {JSX.Element} - Rendered AppBar component. + */ const AppBar = ({ title }) => { const router = useRouter() return (