Skip to content

Commit

Permalink
Merge branch 'dev' into MAR/Fix-Wishlist
Browse files Browse the repository at this point in the history
  • Loading branch information
dapoadedire authored Oct 22, 2023
2 parents 62b9794 + e6012e2 commit d030b6b
Show file tree
Hide file tree
Showing 60 changed files with 1,246 additions and 1,217 deletions.
6 changes: 4 additions & 2 deletions @types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,9 @@ export type cardinfo = {
color?: string;
};

type PeriodType = '12 mon' | '3 mon' | '30 days' | '7 days' | '24 hrs';
interface ActivityDetailsProps {
token: string;
}

export type inputErrorMessage = {
errorMessage: string;
Expand Down Expand Up @@ -931,5 +933,5 @@ export type DashboardActivity = {
};

export interface ExtendedDashboardActivity extends DashboardActivity {
isPage?: boolean;
isPage?: boolean;
}
7 changes: 6 additions & 1 deletion components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ function Footer() {
</a>
</li>
<li>
<a href="https://www.zuri.team/recruit-talent" className="hover:underline">
<a
href="https://www.zuri.team/recruit-talent"
target="_blank"
rel="noreferrer"
className="hover:underline"
>
Recruit Talent
</a>
</li>
Expand Down
10 changes: 6 additions & 4 deletions components/Loader/loader2.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import Image from 'next/image';
import loader from '../../public/assets/loader/loader2.svg';
//import loader from '../../public/assets/loader/loader2.svg';
import vector from '../../public/assets/loader/Vector.svg';

const Loader: React.FC = () => {
const centerStyles: React.CSSProperties = {
Expand All @@ -15,10 +16,11 @@ const Loader: React.FC = () => {
<div className="relative flex justify-center items-center">
<div className="absolute animate-spin rounded-full h-32 w-32 border-t-4 border-b-4 border-green-500 spinner"></div>
<Image
src={loader}
//src={loader}
src={vector}
alt="Loader"
width={80}
height={80}
width={50}
height={50}
// className='animate-ping'
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions components/Modals/CartPaymentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const CartPaymentsuccessModal = () => {
useEffect(() => {
setTimeout(() => {
window.location.href = `${STAGING_URL}/marketplace/cart`;
}, 50000);
}, 5000);
});

const closeModal = () => {
Expand Down Expand Up @@ -63,7 +63,7 @@ export const CartPaymentFailureModal = () => {
useEffect(() => {
setTimeout(() => {
window.location.href = `${STAGING_URL}/marketplace/cart`;
}, 50000);
}, 5000);
});
const closeModal = () => {
window.location.href = `${STAGING_URL}/marketplace/cart`;
Expand Down
12 changes: 6 additions & 6 deletions components/Modals/ComplaintModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ interface ModalProps {
}
interface ComplaintModalProps extends ModalProps {
product: string;
customerID: string;
user: string;
}
// const token = getAuthTokenFromCookies('UTM_tracker');
const apiUrl = `https://zuri-cart-checkout.onrender.com/api/checkout_cart/complaints`;
const apiUrl = `https://team-mirage-super-amind2.onrender.com/api/v1/super-admin/feedback/register-complaints/`;

const ComplaintModal: React.FC<ComplaintModalProps> = ({ isOpen, onClose, product, customerID }) => {
const ComplaintModal: React.FC<ComplaintModalProps> = ({ isOpen, onClose, product, user }) => {
const [description, setDescription] = useState('');
const [error, setError] = useState<string | null>(null);

const data = { product_id: '136fda3b-6e1e-4711-a4ac-6dfb298615a9 ', complaint: description };
const data = { user: user, product: product, complaint: description };
const stringifyData = JSON.stringify(data);

//auth
const authToken = `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImE3YjRiOThiLWFlMzMtNGQ0Yy1hNmUzLTQ4YzY5MGQ5NDUyMyIsImZpcnN0TmFtZSI6IkJvcmRlciIsImVtYWlsIjoibW9yemV5b21sZUBndWZ1bS5jb20iLCJpYXQiOjE2OTcyNzUwMDR9.2v-dtbXuYl5J97F_S2M-vZB8lVuAnwCM1x3FJ0xOJWs`;
// const authToken = `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImE3YjRiOThiLWFlMzMtNGQ0Yy1hNmUzLTQ4YzY5MGQ5NDUyMyIsImZpcnN0TmFtZSI6IkJvcmRlciIsImVtYWlsIjoibW9yemV5b21sZUBndWZ1bS5jb20iLCJpYXQiOjE2OTcyNzUwMDR9.2v-dtbXuYl5J97F_S2M-vZB8lVuAnwCM1x3FJ0xOJWs`;

const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
Expand All @@ -48,7 +48,7 @@ const ComplaintModal: React.FC<ComplaintModalProps> = ({ isOpen, onClose, produc
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${authToken}`,
// Authorization: `Bearer ${authToken}`,
},
body: stringifyData,
});
Expand Down
13 changes: 13 additions & 0 deletions components/Modals/tokenkey.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const getZptValueFromLocalStorage = (): string | null => {
try {
const zptValue = localStorage.getItem('zpt');
if (zptValue) {
return zptValue;
}
} catch (error) {
console.error('Error retrieving "zpt" value from local storage:', error);
}
return null;
};

export default getZptValueFromLocalStorage;
78 changes: 49 additions & 29 deletions components/Navbars/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { getUserCart } from '../../http/checkout';
import { useCart } from '@modules/shop/component/CartContext';
import { toast } from 'react-toastify';
import Notifications from '../Modals/Notifications';
import axios from 'axios';

function TopBar(props: { activePage: string; showDashBorad: boolean }) {
// change auth to True to see Auth User Header
Expand All @@ -40,7 +41,7 @@ function TopBar(props: { activePage: string; showDashBorad: boolean }) {
const [searchQuery, setSearchQuery] = useState('');
const [dropDown, setDropDown] = useState<string>('Explore');
const { cartCount, setCartCountNav } = useCart();

const [shopId, setShopId] = useState('');
useEffect(() => {
async function cartFetch() {
let carts;
Expand All @@ -56,7 +57,18 @@ function TopBar(props: { activePage: string; showDashBorad: boolean }) {
cartFetch();
/* eslint-disable-next-line react-hooks/exhaustive-deps */
}, []);

const getShopId = async () => {
try {
const { data } = await axios.get('https://zuriportfolio-shop-internal-api.onrender.com/api/v1/shops/merchant', {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${localStorage.getItem('zpt')}`,
},
});

setShopId(data?.data.id);
} catch (error) {}
};
const handleAuthMenu = () => {
setAuthMenu(!authMenu);
};
Expand All @@ -75,6 +87,7 @@ function TopBar(props: { activePage: string; showDashBorad: boolean }) {
const isLoggedIn = isAuthenticated(token as string);
if (isLoggedIn) {
setAuth(true);
getShopId();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down Expand Up @@ -203,7 +216,7 @@ function TopBar(props: { activePage: string; showDashBorad: boolean }) {
onKeyUp={handleSearch}
onChange={(e) => setSearchQuery(e.target.value)}
placeholder="Search"
className="text-neutral-400 text-base font-normal leading-normal tracking-tight focus:border-0 focus:outline-none focus:ring-0 w-[100%] font-manropeL"
className="placeholder:text-neutral-400 text-gray-900 text-base font-normal leading-normal tracking-tight focus:border-0 focus:outline-none focus:ring-0 w-[100%] font-manropeL"
/>
</div>
<div className="justify-start items-center gap-4 flex ">
Expand Down Expand Up @@ -265,29 +278,31 @@ function TopBar(props: { activePage: string; showDashBorad: boolean }) {
<p className="font-manropeL">View Live Profile</p>
</div>
</li>
<Link
onClick={handleAuthMenu}
href={'/shop'}
className="border-b cursor-pointer hover:bg-[#F4FBF6] border-[#EBEEEF] py-5 px-4 flex gap-6 "
>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<g>
<g
stroke="#8D9290"
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit="10"
strokeWidth="1.5"
>
<path d="M2 2h1.74c1.08 0 1.93.93 1.84 2l-.83 9.96a2.796 2.796 0 002.79 3.03h10.65c1.44 0 2.7-1.18 2.81-2.61l.54-7.5c.12-1.66-1.14-3.01-2.81-3.01H5.82"></path>
<path d="M16.25 22a1.25 1.25 0 100-2.5 1.25 1.25 0 000 2.5z"></path>
<path d="M8.25 22a1.25 1.25 0 100-2.5 1.25 1.25 0 000 2.5z"></path>
<path d="M9 8h12"></path>
{shopId && (
<Link
onClick={handleAuthMenu}
href={`/shop?shop_id=${shopId}`}
className="border-b cursor-pointer hover:bg-[#F4FBF6] border-[#EBEEEF] py-5 px-4 flex gap-6 "
>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<g>
<g
stroke="#8D9290"
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit="10"
strokeWidth="1.5"
>
<path d="M2 2h1.74c1.08 0 1.93.93 1.84 2l-.83 9.96a2.796 2.796 0 002.79 3.03h10.65c1.44 0 2.7-1.18 2.81-2.61l.54-7.5c.12-1.66-1.14-3.01-2.81-3.01H5.82"></path>
<path d="M16.25 22a1.25 1.25 0 100-2.5 1.25 1.25 0 000 2.5z"></path>
<path d="M8.25 22a1.25 1.25 0 100-2.5 1.25 1.25 0 000 2.5z"></path>
<path d="M9 8h12"></path>
</g>
</g>
</g>
</svg>
<p className="font-manropeL">Your Shop</p>
</Link>
</svg>
<p className="font-manropeL">Your Shop</p>
</Link>
)}
<Link
onClick={handleAuthMenu}
href="/dashboard"
Expand All @@ -306,7 +321,7 @@ function TopBar(props: { activePage: string; showDashBorad: boolean }) {
</Link>
<Link
onClick={handleAuthMenu}
href="/portfolio"
href={`/portfolio/${globalAuth?.user?.slug}`}
className=" border-[#EBEEEF] cursor-pointer hover:bg-[#F4FBF6] py-5 px-4 flex gap-6 "
>
<Image draggable={false} src={briefCaseIcon} alt="Briefcase icon" />
Expand Down Expand Up @@ -436,6 +451,7 @@ function TopBar(props: { activePage: string; showDashBorad: boolean }) {
handleAuthMenu={handleAuthMenu}
auth={auth}
refMenu={searchRef2}
globalAuth={globalAuth}
/>

{/* Search Mobile Nav */}
Expand Down Expand Up @@ -532,7 +548,6 @@ function TopBar(props: { activePage: string; showDashBorad: boolean }) {
)}
</div>
<div className="auth flex items-center gap-3 cursor-pointer" onClick={handleAuthMenu}>

<p className=" font-bold font-manropeEB">
{globalAuth?.user?.firstName} {globalAuth?.user?.lastName}
</p>
Expand Down Expand Up @@ -593,6 +608,7 @@ function MenuIcon({ style, toggle, toggler }: { style?: string; toggle?: boolean
}

function MenuUI({
globalAuth,
toggle,
toggler,
style,
Expand All @@ -601,6 +617,7 @@ function MenuUI({
handleAuthMenu,
authMenu,
}: {
globalAuth?: any;
toggle?: boolean;
toggler: () => void;
style?: string;
Expand Down Expand Up @@ -677,8 +694,11 @@ function MenuUI({
<div className="w-[100%] h-0.5 bg-emerald-600 rounded-lg" />
) : null}
</div>
<div className=" group flex flex-col ali justify-center gap-1 ">
<Link className={activeLink('/portfolio')} href={'/portfolio'}>
<div className=" group flex flex-col ali justify-center gap-1 ">
<Link
className={activeLink(`/portfolio/${globalAuth?.user?.slug}`)}
href={`/portfolio/${globalAuth?.user?.slug}`}
>
Manage Portfolio
</Link>
{router.pathname === '/portfolio' ? <div className="w-[100%] h-0.5 bg-emerald-600 rounded-lg" /> : null}
Expand Down
7 changes: 2 additions & 5 deletions http/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ import { useAuth } from '../context/AuthContext';
import $http from './axios';
import axios from 'axios';

export const CART_ENDPOINT =
process.env.NEXT_PUBLIC_CART_API_URL || 'https://zuri-cart-checkout.onrender.com/api/checkout_cart';
export const CART_ENDPOINT = "https://zuri-cart-checkout.onrender.com/api/v1/checkout_cart"
export const STAGING_URL = process.env.NEXT_PUBLIC_APP_STAGING_URL || 'https://staging.zuri.team';
export const RECENTLY_VIEWED_ENDPOINT =
process.env.NEXT_PUBLIC_RECENTLY_VIEWED_ENDPOINT ||
'https://coral-app-8bk8j.ondigitalocean.app/api/marketplace/v1/recently-viewed';
export const RECENTLY_VIEWED_ENDPOINT = 'https://staging.zuri.team/api/marketplace/v1/recently-viewed';

export const addToCart = async (cartItems: string[], token: string) => {
try {
Expand Down
5 changes: 0 additions & 5 deletions http/super-admin1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,3 @@ export const useDeleteShop = () => {
isLoading: deleteShop.isLoading,
};
};

export const logout = (route: NextRouter) => {
localStorage.removeItem('zpt');
route.push('/')
}
2 changes: 1 addition & 1 deletion modules/auth/component/ForgotPassword/ForgotPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const ForgotPassword = () => {
// status code for user whose email is not verified
if (e.status === 403) {
notify({
message: "Account not verified, redirecting to verification page.",
message: 'Account not verified, redirecting to verification page.',
type: 'error',
theme: 'light',
});
Expand Down
4 changes: 2 additions & 2 deletions modules/auth/component/Login/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function LoginForm() {
onSuccess: async (res) => {
// User has 2fa enabled
if (res.status === 202) {
localStorage.setItem('2fa', res?.response?.token);
localStorage.setItem('email', res?.response?.email);
localStorage.setItem('2fa', res?.token);
localStorage.setItem('email', res?.email);

notify({
message: 'Two Factor Authentication Code Sent',
Expand Down
1 change: 0 additions & 1 deletion modules/auth/component/logout/Logout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const MobileLogout = () => {
</g>
</svg>
<p className="font-manropeB">Sign Out</p>

</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const OrderDetails = () => {

const fetchOrders = async () => {
try {
const url = `https://zuriportfolio-shop-internal-api.onrender.com/api/order/${orderId}?page=${currentPage}&pageSize=${itemsPerPage}`;
const url = `https://zuriportfolio-shop-internal-api.onrender.com/api/v1/order/${orderId}?page=${currentPage}&pageSize=${itemsPerPage}`;
// const url = `http://localhost:8080/api/order/${orderId}?page=${currentPage}&pageSize=${itemsPerPage}`;
setLoadingOrders(true);
const req = await axios({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const OrderHistory: React.FC = () => {
const fetchOrders = async () => {
try {
setLoadingOrders(true);
const url = `https://zuriportfolio-shop-internal-api.onrender.com/api/orders/all?page=${currentPage}`;
const url = `https://zuriportfolio-shop-internal-api.onrender.com/api/v1/orders/all?page=${currentPage}`;
// const url = `http://localhost:8080/api/orders/all?page=${currentPage}&itemsPerPage=${itemsPerPage}`;
const { data } = await axios({
url,
Expand Down
Loading

0 comments on commit d030b6b

Please sign in to comment.