fix: fix back link, fix search text
This commit is contained in:
parent
0b804a5243
commit
2b814a09f2
|
@ -7,8 +7,7 @@ export const getExpertsList = async (filter: GeneralFilter, locale: string) => {
|
||||||
{ ...filter },
|
{ ...filter },
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
'X-User-Language': locale,
|
'X-User-Language': locale
|
||||||
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJuYW1laWQiOiIxNzIiLCJuYmYiOjE3MDM2ODMyMDgsImV4cCI6MTczNTIxOTIwOCwiaWF0IjoxNzAzNjgzMjA4fQ.KgnYfKO7oVFLlDuKhfyNN6RAaXKdeSzJd7F4r6_15AA'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -22,8 +21,7 @@ export const getExpertById = async (id: string, locale: string) => {
|
||||||
{ id },
|
{ id },
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
'X-User-Language': locale,
|
'X-User-Language': locale
|
||||||
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJuYW1laWQiOiIxNzIiLCJuYmYiOjE3MDM2ODMyMDgsImV4cCI6MTczNTIxOTIwOCwiaWF0IjoxNzAzNjgzMjA4fQ.KgnYfKO7oVFLlDuKhfyNN6RAaXKdeSzJd7F4r6_15AA'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -7,8 +7,7 @@ export const getTagList = async (locale: string) => {
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
'X-User-Language': locale,
|
'X-User-Language': locale
|
||||||
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJuYW1laWQiOiIxNzIiLCJuYmYiOjE3MDM2ODMyMDgsImV4cCI6MTczNTIxOTIwOCwiaWF0IjoxNzAzNjgzMjA4fQ.KgnYfKO7oVFLlDuKhfyNN6RAaXKdeSzJd7F4r6_15AA'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -21,8 +20,7 @@ export const getLanguages = async (locale: string) => {
|
||||||
'/home/languages',
|
'/home/languages',
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
'X-User-Language': locale,
|
'X-User-Language': locale
|
||||||
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJuYW1laWQiOiIxNzIiLCJuYmYiOjE3MDM2ODMyMDgsImV4cCI6MTczNTIxOTIwOCwiaWF0IjoxNzAzNjgzMjA4fQ.KgnYfKO7oVFLlDuKhfyNN6RAaXKdeSzJd7F4r6_15AA'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default function ExpertsPage({ params }: { params: { locale: string } })
|
||||||
return (
|
return (
|
||||||
<div className="main-find">
|
<div className="main-find">
|
||||||
<div className="b-inner">
|
<div className="b-inner">
|
||||||
<div className="main-find__top">
|
<div id="filter" className="main-find__top">
|
||||||
<h2 className="title-h2">{t('title')}</h2>
|
<h2 className="title-h2">{t('title')}</h2>
|
||||||
<div className="open-filter">
|
<div className="open-filter">
|
||||||
<img src="/images/options-outline.svg" className="" alt=""/>
|
<img src="/images/options-outline.svg" className="" alt=""/>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import React from 'react';
|
import React, { Suspense } from 'react';
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
import { notFound } from 'next/navigation';
|
import { notFound } from 'next/navigation';
|
||||||
import { Link } from '../../../../navigation';
|
|
||||||
import { getExpertById, getExpertsList } from '../../../../actions/experts';
|
import { getExpertById, getExpertsList } from '../../../../actions/experts';
|
||||||
import {
|
import {
|
||||||
ExpertCard,
|
ExpertCard,
|
||||||
|
@ -10,6 +9,7 @@ import {
|
||||||
ExpertPractice
|
ExpertPractice
|
||||||
} from '../../../../components/Experts/ExpertDetails';
|
} from '../../../../components/Experts/ExpertDetails';
|
||||||
import { Details } from '../../../../types/experts';
|
import { Details } from '../../../../types/experts';
|
||||||
|
import { BackButton } from '../../../../components/view';
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: 'Bbuddy - Experts item',
|
title: 'Bbuddy - Experts item',
|
||||||
|
@ -80,10 +80,12 @@ export default async function ExpertItem({ params: { expertId = '', locale} }: {
|
||||||
<div className="b-page">
|
<div className="b-page">
|
||||||
<div className="b-inner">
|
<div className="b-inner">
|
||||||
<div className="b-page__back">
|
<div className="b-page__back">
|
||||||
<Link href={'/experts' as any} className="btn-back">
|
<Suspense>
|
||||||
<img src="/images/arrow-back.svg" className="" alt="" />
|
<BackButton className="btn-back">
|
||||||
Back to experts list
|
<img src="/images/arrow-back.svg" className="" alt="" />
|
||||||
</Link>
|
Back to experts list
|
||||||
|
</BackButton>
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
<ExpertCard expert={expert} />
|
<ExpertCard expert={expert} />
|
||||||
<ExpertInformation expert={expert} locale={locale} />
|
<ExpertInformation expert={expert} locale={locale} />
|
||||||
|
|
|
@ -35,7 +35,9 @@ export default function NotFound() {
|
||||||
<div className="error__description">
|
<div className="error__description">
|
||||||
<div className="error__code">404</div>
|
<div className="error__code">404</div>
|
||||||
<div className="error__subtitle">We can't seem to find a page you're looking for</div>
|
<div className="error__subtitle">We can't seem to find a page you're looking for</div>
|
||||||
<BackButton className="btn-apply error__button" text="Go back" />
|
<BackButton className="btn-apply error__button">
|
||||||
|
Go back
|
||||||
|
</BackButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -47,7 +47,7 @@ export const ExpertsAdditionalFilter = ({
|
||||||
setFilter(newFilter);
|
setFilter(newFilter);
|
||||||
}, [filter]);
|
}, [filter]);
|
||||||
|
|
||||||
useEffect(() => {
|
const updateRoute = debounce(() => {
|
||||||
router.push({
|
router.push({
|
||||||
pathname: basePath as any,
|
pathname: basePath as any,
|
||||||
query: {
|
query: {
|
||||||
|
@ -55,6 +55,10 @@ export const ExpertsAdditionalFilter = ({
|
||||||
...filter
|
...filter
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}, 300);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
updateRoute();
|
||||||
}, [filter]);
|
}, [filter]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -18,7 +18,7 @@ export const Experts = async ({ basePath = '/', locale, pageSize = DEFAULT_PAGE_
|
||||||
const t = await getTranslations('Experts');
|
const t = await getTranslations('Experts');
|
||||||
const searchData = await getTagList(locale);
|
const searchData = await getTagList(locale);
|
||||||
const languages = await getLanguages(locale);
|
const languages = await getLanguages(locale);
|
||||||
const filter = getFilter({ searchData, pageSize });
|
const filter = getFilter({ pageSize });
|
||||||
const experts = await getExpertsList(filter, locale);
|
const experts = await getExpertsList(filter, locale);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import React from 'react';
|
'use client'
|
||||||
|
|
||||||
|
import React, { ReactNode } from 'react';
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
|
|
||||||
export const BackButton = ({ className, text }: { className?: string, text: string }) => {
|
export const BackButton = ({ className, children }: { className?: string, children: ReactNode }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -10,7 +12,7 @@ export const BackButton = ({ className, text }: { className?: string, text: stri
|
||||||
className={className}
|
className={className}
|
||||||
onClick={() => router.back()}
|
onClick={() => router.back()}
|
||||||
>
|
>
|
||||||
{text}
|
{children}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,6 +24,13 @@ const Pagination = styled(AntdPagination)`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-pagination-jump-next {
|
||||||
|
margin-inline-end: 0 !important;
|
||||||
|
height: 40px !important;
|
||||||
|
width: 40px !important;
|
||||||
|
line-height: 38px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.ant-pagination-item-active {
|
.ant-pagination-item-active {
|
||||||
background: #2c7873 !important;
|
background: #2c7873 !important;
|
||||||
|
|
||||||
|
@ -50,6 +57,7 @@ export const CustomPagination = (props: PaginationProps) => (
|
||||||
<Pagination
|
<Pagination
|
||||||
itemRender={itemRender}
|
itemRender={itemRender}
|
||||||
defaultCurrent={1}
|
defaultCurrent={1}
|
||||||
|
showTitle={false}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -547,16 +547,16 @@ a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 8px;
|
border-radius: 8px !important;
|
||||||
background: #2C7873;
|
background: #2C7873 !important;
|
||||||
box-shadow: 0px 2px 4px 0px rgba(252, 214, 70, 0.16);
|
box-shadow: 0px 2px 4px 0px rgba(252, 214, 70, 0.16) !important;
|
||||||
display: flex;
|
display: flex !important;
|
||||||
gap: 10px;
|
gap: 10px !important;
|
||||||
height: 54px;
|
height: 54px !important;
|
||||||
padding: 8px 31px;
|
padding: 8px 31px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center !important;
|
||||||
color: $white;
|
color: $white !important;
|
||||||
@include rem(15);
|
@include rem(15);
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|
|
@ -2,18 +2,18 @@ import { SearchData } from '../types/tags';
|
||||||
import { AdditionalFilter, Filter, GeneralFilter } from '../types/experts';
|
import { AdditionalFilter, Filter, GeneralFilter } from '../types/experts';
|
||||||
import { DEFAULT_PAGE } from '../constants/common';
|
import { DEFAULT_PAGE } from '../constants/common';
|
||||||
|
|
||||||
export const getDefaultFilter = (searchData: SearchData | null, pageSize?: number): Filter => {
|
export const getDefaultFilter = (pageSize?: number): Filter => {
|
||||||
const themesTagIds = searchData?.themesGroups?.reduce<number[]>((result, { tags }) => {
|
// const themesTagIds = searchData?.themesGroups?.reduce<number[]>((result, { tags }) => {
|
||||||
const t = tags?.map(({ id }) => id) || [];
|
// const t = tags?.map(({ id }) => id) || [];
|
||||||
|
//
|
||||||
return t ? [
|
// return t ? [
|
||||||
...result,
|
// ...result,
|
||||||
...t
|
// ...t
|
||||||
] : result;
|
// ] : result;
|
||||||
}, []);
|
// }, []);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
themesTagIds,
|
themesTagIds: [],
|
||||||
priceFrom: null,
|
priceFrom: null,
|
||||||
priceTo: null,
|
priceTo: null,
|
||||||
durationFrom: null,
|
durationFrom: null,
|
||||||
|
@ -24,13 +24,12 @@ export const getDefaultFilter = (searchData: SearchData | null, pageSize?: numbe
|
||||||
};
|
};
|
||||||
|
|
||||||
type FilterProps = {
|
type FilterProps = {
|
||||||
searchData: SearchData | null,
|
|
||||||
pageSize?: number,
|
pageSize?: number,
|
||||||
searchParams?: { [key: string]: string | string[] | undefined }
|
searchParams?: { [key: string]: string | string[] | undefined }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getFilter = ({ searchData, searchParams, pageSize }: FilterProps): Filter => {
|
export const getFilter = ({ searchParams, pageSize }: FilterProps): Filter => {
|
||||||
const filter = getDefaultFilter(searchData, pageSize);
|
const filter = getDefaultFilter(pageSize);
|
||||||
|
|
||||||
if (searchParams) {
|
if (searchParams) {
|
||||||
const { themesTagIds, priceFrom, priceTo, durationFrom, durationTo, page, pageSize } = searchParams;
|
const { themesTagIds, priceFrom, priceTo, durationFrom, durationTo, page, pageSize } = searchParams;
|
||||||
|
|
Loading…
Reference in New Issue