From e926d4cb4a33a27cefea83140920c0451b2cc0e6 Mon Sep 17 00:00:00 2001 From: Witalij Poljatchek Date: Wed, 17 Jul 2024 21:48:15 +0200 Subject: [PATCH 1/9] add release to pipeline --- Jenkinsfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2171d7f..bc1fbfd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,14 +1,18 @@ pipeline { agent { label 'jenkins-nodejs-agent' } - - - + environment { + RELEASE = "0.0.1" + } stages { stage('Build static content') { steps { sh ''' - docker build --progress=plain -t bbuddy/bbuddy_ui:latest . + npm install + npm run build + pwd + echo + docker build --progress=plain -t bbuddy/bbuddy_ui:${RELEASE} . ''' } } @@ -16,10 +20,10 @@ pipeline { steps { sh ''' sudo docker login https://harbor-wtkp3fsbv6.vertexa.devbay.tech/ -u 'robot$jenkins' -p 'ZrzsVIAeueW1p0alpAnPfM5CDtaRVVKz' - sudo docker tag bbuddy/bbuddy_ui:latest harbor-wtkp3fsbv6.vertexa.devbay.tech/bbuddy/bbuddy_ui:latest - sudo docker push harbor-wtkp3fsbv6.vertexa.devbay.tech/bbuddy/bbuddy_ui:latest + sudo docker tag bbuddy/bbuddy_ui:${RELEASE} harbor-wtkp3fsbv6.vertexa.devbay.tech/bbuddy/bbuddy_ui:${RELEASE} + sudo docker push harbor-wtkp3fsbv6.vertexa.devbay.tech/bbuddy/bbuddy_ui:${RELEASE} ''' } } } -} \ No newline at end of file +} From a9387b1f281bffcfe2fdd8ef14c190b6030def83 Mon Sep 17 00:00:00 2001 From: Witalij Poljatchek Date: Wed, 17 Jul 2024 21:58:08 +0200 Subject: [PATCH 2/9] RELEASE set to latest --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bc1fbfd..9731ebd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,16 +2,16 @@ pipeline { agent { label 'jenkins-nodejs-agent' } environment { - RELEASE = "0.0.1" + RELEASE = "latest" } stages { stage('Build static content') { steps { sh ''' - npm install - npm run build - pwd - echo + #npm install + #npm run build + #pwd + #echo docker build --progress=plain -t bbuddy/bbuddy_ui:${RELEASE} . ''' } From 020ba600d9d653b37e7a862492a1d23d6a5c49f9 Mon Sep 17 00:00:00 2001 From: Witalij Poljatchek Date: Wed, 17 Jul 2024 22:51:54 +0200 Subject: [PATCH 3/9] v 0.0.1 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9731ebd..f8d871d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent { label 'jenkins-nodejs-agent' } environment { - RELEASE = "latest" + RELEASE = "0.0.1" } stages { stage('Build static content') { From b36efa0ddfb1224a515f06ff5c4cd240831c632c Mon Sep 17 00:00:00 2001 From: Witalij Poljatchek Date: Wed, 17 Jul 2024 23:14:16 +0200 Subject: [PATCH 4/9] RELEASE = "latest" --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f8d871d..9731ebd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent { label 'jenkins-nodejs-agent' } environment { - RELEASE = "0.0.1" + RELEASE = "latest" } stages { stage('Build static content') { From ec5fb6d443988f0a0ae29c0368f2f916a7f70765 Mon Sep 17 00:00:00 2001 From: Witalij Poljatchek Date: Wed, 24 Jul 2024 15:53:32 +0200 Subject: [PATCH 5/9] build tag 0.0.2 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9731ebd..2551bc5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent { label 'jenkins-nodejs-agent' } environment { - RELEASE = "latest" + RELEASE = "0.0.2" } stages { stage('Build static content') { From 4a00d715dfd322ed3323a72dc712071837a76fa8 Mon Sep 17 00:00:00 2001 From: Witalij Poljatchek Date: Wed, 24 Jul 2024 16:01:27 +0200 Subject: [PATCH 6/9] release latest --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2551bc5..9731ebd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent { label 'jenkins-nodejs-agent' } environment { - RELEASE = "0.0.2" + RELEASE = "latest" } stages { stage('Build static content') { From abf04b4c5b60c2389813d99df2fdaebd045707d2 Mon Sep 17 00:00:00 2001 From: SD Date: Mon, 29 Jul 2024 23:57:04 +0400 Subject: [PATCH 7/9] feat: add more translate, fix styles --- messages/de.json | 18 +- messages/en.json | 6 +- messages/es.json | 18 +- messages/fr.json | 18 +- messages/it.json | 18 +- messages/ru.json | 16 +- public/favicon.ico | Bin 25931 -> 4286 bytes src/actions/auth.ts | 36 +-- src/actions/experts.ts | 40 ++-- src/actions/helpers.ts | 43 ++++ src/actions/hooks/useProfileSettings.ts | 2 +- src/actions/hooks/useSessionDetails.ts | 4 +- src/actions/profile.ts | 40 ++-- src/actions/sessions.ts | 216 +++++++----------- src/actions/tags.ts | 37 +-- src/app/[locale]/(main)/@news/page.tsx | 16 +- src/app/[locale]/(main)/layout.tsx | 4 +- .../(account)/work-with-us/coaching/page.tsx | 10 +- .../account/(account)/work-with-us/page.tsx | 18 +- src/app/[locale]/experts/[expertId]/page.tsx | 16 +- src/components/Account/AccountMenu.tsx | 18 -- src/components/Account/ProfileSettings.tsx | 75 ++++-- .../sessions/SessionDetailsContent.tsx | 46 ++-- .../Account/sessions/SessionsTabs.tsx | 8 +- src/components/Experts/ExpertDetails.tsx | 43 ++-- src/components/Experts/ExpertsList.tsx | 1 + src/components/Experts/Filter.tsx | 4 +- src/components/Modals/AddCommentModal.tsx | 6 +- src/components/Modals/AuthModal.tsx | 11 +- src/components/Modals/DeclineSessionModal.tsx | 10 +- .../Modals/authModalContent/EnterContent.tsx | 20 +- .../Modals/authModalContent/FinishContent.tsx | 10 +- .../authModalContent/RegisterContent.tsx | 22 +- .../Modals/authModalContent/ResetContent.tsx | 6 +- .../Page/GeneralTopSection/index.tsx | 2 +- .../Page/Header/HeaderAuthLinks.tsx | 1 + src/components/Page/Header/HeaderMenu.tsx | 3 +- src/components/Page/Header/index.tsx | 2 +- src/components/view/FilledButton.tsx | 6 + src/components/view/OutlinedButton.tsx | 2 +- src/constants/routes.ts | 3 +- src/i18nKeys/de.ts | 60 ++++- src/i18nKeys/en.ts | 60 ++++- src/i18nKeys/es.ts | 60 ++++- src/i18nKeys/fr.ts | 60 ++++- src/i18nKeys/it.ts | 60 ++++- src/i18nKeys/ru.ts | 60 ++++- src/styles/_default.scss | 50 ++-- src/styles/_form.scss | 15 ++ src/styles/_main.scss | 30 ++- src/styles/_pages.scss | 66 ++++-- src/styles/view/_buttons.scss | 20 +- src/styles/view/_slider.scss | 3 +- 53 files changed, 873 insertions(+), 546 deletions(-) create mode 100644 src/actions/helpers.ts diff --git a/messages/de.json b/messages/de.json index 5ca66b1..14d749a 100644 --- a/messages/de.json +++ b/messages/de.json @@ -1,20 +1,10 @@ { - "Header": { - "registration": "Registration", - "enter": "Enter", - "account": "My Account", - "menu": { - "bb-client": "Start grow with BB", - "bb-expert": "Become BB Expert", - "blog": "Blog&News" - } - }, "Main": { "title": "Bbuddy - Main", "description": "Bbuddy desc", - "header": "Mentorship, Career\nDevelopment & Coaching.", - "header-desc": "The ins-and-outs of building a career in tech, gaining experience from a mentor, and getting your feet wet with coaching.", - "news": "Professional Articles & Project News", + "header": "BBuddy: Plattform für persönlichen und beruflichen Erfolg", + "header-desc": "Erhalten Sie Beratungen von führenden Coaches und Mentoren auf BBuddy. Unsere Experten helfen Ihnen, sich zu entwickeln, zu lernen und Ihre persönlichen und beruflichen Ziele zu erreichen. Nutzen Sie unsere Web-Plattform und mobile App für professionelle Unterstützung und Wachstum.", + "news": "Fachartikel & Projektneuigkeiten", "popular": "Popular Topics" }, "BbClient": { @@ -89,7 +79,7 @@ } }, "Experts": { - "title": "Find a expert", + "title": "Find an expert", "filter": { "price": "Price from {from}€ to {to}€", "duration": "Duration from {from}min to {to}min", diff --git a/messages/en.json b/messages/en.json index cbee258..1765bc8 100644 --- a/messages/en.json +++ b/messages/en.json @@ -2,8 +2,8 @@ "Main": { "title": "Bbuddy - Main", "description": "Bbuddy desc", - "header": "Mentorship, Career\nDevelopment & Coaching.", - "header-desc": "The ins-and-outs of building a career in tech, gaining experience from a mentor, and getting your feet wet with coaching.", + "header": "BBuddy: Platform for Personal and Career Success", + "header-desc": "Receive consultations from leading coaches and mentors on BBuddy. Our experts will help you develop, learn, and achieve your personal and career goals. Use our web platform and mobile app for professional support and growth.", "news": "Professional Articles & Project News", "popular": "Popular Topics" }, @@ -69,7 +69,7 @@ } }, "Experts": { - "title": "Find a expert", + "title": "Find an expert", "filter": { "price": "Price from {from}€ to {to}€", "duration": "Duration from {from}min to {to}min", diff --git a/messages/es.json b/messages/es.json index 5ca66b1..0342887 100644 --- a/messages/es.json +++ b/messages/es.json @@ -1,20 +1,10 @@ { - "Header": { - "registration": "Registration", - "enter": "Enter", - "account": "My Account", - "menu": { - "bb-client": "Start grow with BB", - "bb-expert": "Become BB Expert", - "blog": "Blog&News" - } - }, "Main": { "title": "Bbuddy - Main", "description": "Bbuddy desc", - "header": "Mentorship, Career\nDevelopment & Coaching.", - "header-desc": "The ins-and-outs of building a career in tech, gaining experience from a mentor, and getting your feet wet with coaching.", - "news": "Professional Articles & Project News", + "header": "BBuddy: Plataforma para el éxito personal y profesional", + "header-desc": "Reciba consultas de entrenadores y mentores líderes en BBuddy. Nuestros expertos le ayudarán a desarrollarse, aprender y alcanzar sus objetivos personales y profesionales. Utilice nuestra plataforma web y aplicación móvil para apoyo profesional y crecimiento.", + "news": "Artículos profesionales y Noticias de proyectos", "popular": "Popular Topics" }, "BbClient": { @@ -89,7 +79,7 @@ } }, "Experts": { - "title": "Find a expert", + "title": "Find an expert", "filter": { "price": "Price from {from}€ to {to}€", "duration": "Duration from {from}min to {to}min", diff --git a/messages/fr.json b/messages/fr.json index 5ca66b1..48b42e3 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -1,20 +1,10 @@ { - "Header": { - "registration": "Registration", - "enter": "Enter", - "account": "My Account", - "menu": { - "bb-client": "Start grow with BB", - "bb-expert": "Become BB Expert", - "blog": "Blog&News" - } - }, "Main": { "title": "Bbuddy - Main", "description": "Bbuddy desc", - "header": "Mentorship, Career\nDevelopment & Coaching.", - "header-desc": "The ins-and-outs of building a career in tech, gaining experience from a mentor, and getting your feet wet with coaching.", - "news": "Professional Articles & Project News", + "header": "BBuddy: Plateforme pour le succès personnel et professionnel", + "header-desc": "Recevez des consultations de coachs et mentors de premier plan sur BBuddy. Nos experts vous aideront à développer, apprendre et atteindre vos objectifs personnels et professionnels. Utilisez notre plateforme web et notre application mobile pour un soutien professionnel et une croissance.", + "news": "Articles professionnels et actualités des projets", "popular": "Popular Topics" }, "BbClient": { @@ -89,7 +79,7 @@ } }, "Experts": { - "title": "Find a expert", + "title": "Find an expert", "filter": { "price": "Price from {from}€ to {to}€", "duration": "Duration from {from}min to {to}min", diff --git a/messages/it.json b/messages/it.json index 5ca66b1..379adca 100644 --- a/messages/it.json +++ b/messages/it.json @@ -1,20 +1,10 @@ { - "Header": { - "registration": "Registration", - "enter": "Enter", - "account": "My Account", - "menu": { - "bb-client": "Start grow with BB", - "bb-expert": "Become BB Expert", - "blog": "Blog&News" - } - }, "Main": { "title": "Bbuddy - Main", "description": "Bbuddy desc", - "header": "Mentorship, Career\nDevelopment & Coaching.", - "header-desc": "The ins-and-outs of building a career in tech, gaining experience from a mentor, and getting your feet wet with coaching.", - "news": "Professional Articles & Project News", + "header": "BBuddy: Piattaforma per il successo personale e professionale", + "header-desc": "Ricevi consulenze da coach e mentori leader su BBuddy. I nostri esperti ti aiuteranno a svilupparti, imparare e raggiungere i tuoi obiettivi personali e professionali. Usa la nostra piattaforma web e l'app mobile per supporto professionale e crescita.", + "news": "Articoli professionali e novità sui progetti", "popular": "Popular Topics" }, "BbClient": { @@ -89,7 +79,7 @@ } }, "Experts": { - "title": "Find a expert", + "title": "Find an expert", "filter": { "price": "Price from {from}€ to {to}€", "duration": "Duration from {from}min to {to}min", diff --git a/messages/ru.json b/messages/ru.json index 64fb88a..94d8e2e 100644 --- a/messages/ru.json +++ b/messages/ru.json @@ -1,20 +1,10 @@ { - "Header": { - "registration": "Регистрация", - "enter": "Вход", - "account": "Мой аккаунт", - "menu": { - "bb-client": "Начни вместе с BB", - "bb-expert": "Стань BB экспертом", - "blog": "Блог&Новости" - } - }, "Main": { "title": "Bbuddy - Главная", "description": "Bbuddy описание", - "header": "Mentorship, Career\nDevelopment & Coaching.", - "header-desc": "The ins-and-outs of building a career in tech, gaining experience from a mentor, and getting your feet wet with coaching.", - "news": "Professional Articles & Project News", + "header": "BBuddy: Платформа для Личного и Карьерного Успеха", + "header-desc": "Получайте консультации от ведущих коучей и менторов в BBuddy. Наши эксперты помогут вам развиваться, обучаться и достигать личных и карьерных целей. Используйте нашу веб-платформу и мобильное приложение для получения профессиональной поддержки и роста.", + "news": "Профессиональные статьи и новости проекта", "popular": "Popular Topics" }, "BbClient": { diff --git a/public/favicon.ico b/public/favicon.ico index 718d6fea4835ec2d246af9800eddb7ffb276240c..f285885408be9880d0b9297bac0b264c49b80d4b 100644 GIT binary patch literal 4286 zcmeH~TWC~A7=Zt{jj`UgSO}B|Q4|%m)oKz*lr}1gLWy7!Nn*39lvV_*K7?K0F_MfxGzEUdI;To~_zAaWuoiZKXfLfRflfd*nRr>cGG5!8r+UCIyxByAG1SjAV z{9`@-D4uHA3Wwnw9E43UAD(jS^E3E|rbu41WK7c%O6ayRS`5TrPdfI#9RT+P7joale4?;Ru|8i*Osf<66hFJBASdcyc=p zt*{lE;C-loY4D1DwRnhqwMgRUmWb6_{a-#NuCE-;^8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ions/auth.ts +++ b/src/actions/auth.ts @@ -1,26 +1,14 @@ -import { AxiosResponse } from 'axios'; -import { apiClient } from '../lib/apiClient'; +import { apiRequest } from './helpers'; -export const getAuth = (locale: string, data: { login: string, password: string }): Promise> => ( - apiClient.post( - '/auth/login', - data, - { - headers: { - 'X-User-Language': locale - } - } - ) -); +export const getAuth = (locale: string, data: { login: string, password: string }): Promise<{ jwtToken: string }> => apiRequest({ + url: '/auth/login', + method: 'post', + data, + locale +}); -export const getRegister = (locale: string): Promise> => ( - apiClient.post( - '/auth/register', - {}, - { - headers: { - 'X-User-Language': locale - } - } - ) -); +export const getRegister = (locale: string): Promise<{ jwtToken: string }> => apiRequest({ + url: '/auth/register', + method: 'post', + locale +}); diff --git a/src/actions/experts.ts b/src/actions/experts.ts index 91e0d73..93aa3fa 100644 --- a/src/actions/experts.ts +++ b/src/actions/experts.ts @@ -1,30 +1,16 @@ -import { apiClient } from '../lib/apiClient'; import { GeneralFilter, ExpertsData, ExpertDetails } from '../types/experts'; +import { apiRequest } from './helpers'; -export const getExpertsList = async (locale: string, filter?: GeneralFilter) => { - const response = await apiClient.post( - '/home/coachsearch1', - { ...filter }, - { - headers: { - 'X-User-Language': locale - } - } - ); +export const getExpertsList = (locale: string, filter?: GeneralFilter): Promise => apiRequest({ + url: '/home/coachsearch1', + method: 'post', + data: { ...filter }, + locale +}); - return response.data as ExpertsData || null; -}; - -export const getExpertById = async (id: string, locale: string) => { - const response = await apiClient.post( - '/home/coachdetails', - { id }, - { - headers: { - 'X-User-Language': locale - } - } - ); - - return response.data as ExpertDetails || null; -}; +export const getExpertById = (id: string, locale: string): Promise => apiRequest({ + url: '/home/coachdetails', + method: 'post', + data: { id }, + locale +}); diff --git a/src/actions/helpers.ts b/src/actions/helpers.ts new file mode 100644 index 0000000..d3841c5 --- /dev/null +++ b/src/actions/helpers.ts @@ -0,0 +1,43 @@ +import { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'; +import { apiClient } from '../lib/apiClient'; + +type RequiredConfigParams = Required> & Pick, 'data'>; +export type PageRequestConfig = RequiredConfigParams & { locale?: string, token?: string }; + +export const apiRequest = async ( + baseParams: PageRequestConfig, +): Promise => { + try { + const config = { + url: baseParams.url, + method: baseParams.method, + data: baseParams?.data, + headers: { + 'X-User-Language': baseParams?.locale || 'en', + 'X-Referrer-Channel': 'site', + ...(baseParams?.token ? { Authorization: `Bearer ${baseParams.token}` } : {}) + } + }; + const response: AxiosResponse = await apiClient.request, T>(config as AxiosRequestConfig); + + return response.data; + } catch (err) { + const { + response: { + status: responseCode = null, + statusText = '', + data: { message = '', status: errorKey = '' } = {}, + } = {}, + code: statusCode = '', + } = err as AxiosError; + + throw new Error( + JSON.stringify({ + statusCode, + statusMessage: message || statusText, + responseCode, + errorKey, + }), + ); + } +}; diff --git a/src/actions/hooks/useProfileSettings.ts b/src/actions/hooks/useProfileSettings.ts index 14a67d1..58b02e8 100644 --- a/src/actions/hooks/useProfileSettings.ts +++ b/src/actions/hooks/useProfileSettings.ts @@ -15,7 +15,7 @@ export const useProfileSettings = (locale: string) => { useEffect(() => { if (jwt) { getPersonalData(locale, jwt) - .then(({ data }) => { + .then((data) => { setProfileSettings(data); }) .catch((err) => { diff --git a/src/actions/hooks/useSessionDetails.ts b/src/actions/hooks/useSessionDetails.ts index b1c7bb0..107590d 100644 --- a/src/actions/hooks/useSessionDetails.ts +++ b/src/actions/hooks/useSessionDetails.ts @@ -18,8 +18,8 @@ export const useSessionDetails = (locale: string, sessionId: number) => { setSession(undefined); getSessionDetails(locale, jwt, sessionId) - .then(({ data }) => { - setSession(data); + .then((session) => { + setSession(session); }) .catch((err) => { setErrorData(err); diff --git a/src/actions/profile.ts b/src/actions/profile.ts index 8e78fca..d2c9d96 100644 --- a/src/actions/profile.ts +++ b/src/actions/profile.ts @@ -1,29 +1,17 @@ -import { AxiosResponse } from 'axios'; -import { apiClient } from '../lib/apiClient'; import { Profile } from '../types/profile'; +import { apiRequest } from './helpers'; -export const setPersonData = (person: { login: string, password: string, role: string, languagesLinks: any[] }, locale: string, jwt: string): Promise> => ( - apiClient.post( - '/home/applyperson1', - { ...person }, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const setPersonData = (data: { login: string, password: string, role: string, languagesLinks: any[] }, locale: string, token: string): Promise<{ userData: Profile }> => apiRequest({ + url: '/home/applyperson1', + method: 'post', + data, + locale, + token +}); -export const getPersonalData = (locale: string, jwt: string): Promise> => ( - apiClient.post( - '/home/userdata', - {}, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const getPersonalData = (locale: string, token: string): Promise => apiRequest({ + url: '/home/userdata', + method: 'post', + locale, + token +}); diff --git a/src/actions/sessions.ts b/src/actions/sessions.ts index d1aac29..3ae9872 100644 --- a/src/actions/sessions.ts +++ b/src/actions/sessions.ts @@ -1,145 +1,93 @@ -import { AxiosResponse } from 'axios'; -import { apiClient } from '../lib/apiClient'; import { DeclineSessionData, Session, SessionsFilter, SessionCommentData } from '../types/sessions'; +import { apiRequest } from './helpers'; -export const getUpcomingSessions = (locale: string, jwt: string, filter?: SessionsFilter): Promise> => ( - apiClient.post( - '/home/upcomingsessionsall', - { - sessionType: 'session', - ...(filter || {}) - }, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const getUpcomingSessions = (locale: string, token: string, filter?: SessionsFilter): Promise => apiRequest({ + url: '/home/upcomingsessionsall', + method: 'post', + data: { + sessionType: 'session', + ...(filter || {}) + }, + locale, + token +}); -export const getRequestedSessions = (locale: string, jwt: string): Promise> => ( - apiClient.post( - '/home/coachhomedata', - {}, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const getRequestedSessions = (locale: string, token: string): Promise<{ requestedSessions: Session[] }> => apiRequest({ + url: '/home/coachhomedata', + method: 'post', + locale, + token +}); -export const getRecentSessions = (locale: string, jwt: string, filter?: SessionsFilter): Promise> => ( - apiClient.post( - '/home/historicalmeetings', - { - sessionType: 'session', - ...(filter || {}) - }, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const getRecentSessions = (locale: string, token: string, filter?: SessionsFilter): Promise => apiRequest({ + url: '/home/historicalmeetings', + method: 'post', + data: { + sessionType: 'session', + ...(filter || {}) + }, + locale, + token +}); -export const getSessionDetails = (locale: string, jwt: string, id: number): Promise> => ( - apiClient.post( - '/home/session', - { id }, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const getSessionDetails = (locale: string, token: string, id: number): Promise => apiRequest({ + url: '/home/session', + method: 'post', + data: { id }, + locale, + token +}); -export const approveRequestedSession = (locale: string, jwt: string, sessionId: number): Promise => ( - apiClient.post( - '/home/approverequestedsession', - { sessionId }, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const approveRequestedSession = (locale: string, token: string, sessionId: number): Promise => apiRequest({ + url: '/home/approverequestedsession', + method: 'post', + data: { sessionId }, + locale, + token +}); -export const declineRequestedSession = (locale: string, jwt: string, { sessionId, reason }: DeclineSessionData): Promise => ( - apiClient.post( - '/home/declinerequestedsession', - { - sessionId, - coachDeclineReason: reason - }, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const declineRequestedSession = (locale: string, token: string, { sessionId, reason }: DeclineSessionData): Promise => apiRequest({ + url: '/home/declinerequestedsession', + method: 'post', + data: { + sessionId, + coachDeclineReason: reason + }, + locale, + token +}); -export const cancelUpcomingSession = (locale: string, jwt: string, { sessionId, reason }: DeclineSessionData): Promise => ( - apiClient.post( - '/home/cancelupcomingsession', - { - sessionId, - coachCancelReason: reason - }, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const cancelUpcomingSession = (locale: string, token: string, { sessionId, reason }: DeclineSessionData): Promise => apiRequest({ + url: '/home/cancelupcomingsession', + method: 'post', + data: { + sessionId, + coachCancelReason: reason + }, + locale, + token +}); -export const addSessionComment = (locale: string, jwt: string, data: SessionCommentData): Promise => ( - apiClient.post( - '/home/session_comment', - data, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const addSessionComment = (locale: string, token: string, data: SessionCommentData): Promise => apiRequest({ + url: '/home/session_comment', + method: 'post', + data, + locale, + token +}); -export const trackingStartSession = (locale: string, jwt: string, id: number): Promise => ( - apiClient.post( - '/home/sessiontracking', - { id }, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const trackingStartSession = (locale: string, token: string, id: number): Promise => apiRequest({ + url: '/home/sessiontracking', + method: 'post', + data: { id }, + locale, + token +}); -export const finishSession = (locale: string, jwt: string, sessionId: number): Promise => ( - apiClient.post( - '/home/finishsession', - { sessionId }, - { - headers: { - 'X-User-Language': locale, - Authorization: `Bearer ${jwt}` - } - } - ) -); +export const finishSession = (locale: string, token: string, sessionId: number): Promise => apiRequest({ + url: '/home/finishsession', + method: 'post', + data: { sessionId }, + locale, + token +}); diff --git a/src/actions/tags.ts b/src/actions/tags.ts index 7443607..7fd18cd 100644 --- a/src/actions/tags.ts +++ b/src/actions/tags.ts @@ -1,29 +1,14 @@ -import { apiClient } from '../lib/apiClient'; import { SearchData, Languages } from '../types/tags'; +import { apiRequest } from './helpers'; -export const getTagList = async (locale: string) => { - const response = await apiClient.post( - '/home/searchdata', - {}, - { - headers: { - 'X-User-Language': locale - } - } - ); +export const getTagList = (locale: string): Promise => apiRequest({ + url: '/home/searchdata', + method: 'post', + locale +}); - return response.data as SearchData || null; -}; - -export const getLanguages = async (locale: string) => { - const response = await apiClient.get( - '/home/languages', - { - headers: { - 'X-User-Language': locale - } - } - ); - - return response.data as Languages || null; -}; +export const getLanguages = (locale: string): Promise => apiRequest({ + url: '/home/languages', + method: 'get', + locale +}); diff --git a/src/app/[locale]/(main)/@news/page.tsx b/src/app/[locale]/(main)/@news/page.tsx index 15bce46..2aa2a09 100644 --- a/src/app/[locale]/(main)/@news/page.tsx +++ b/src/app/[locale]/(main)/@news/page.tsx @@ -1,10 +1,16 @@ import React from 'react'; +import { useTranslations } from 'next-intl'; +import { unstable_setRequestLocale } from 'next-intl/server'; +import { i18nText } from '../../../../i18nKeys'; + +export default function News({ params: { locale } }: { params: { locale: string }}) { + unstable_setRequestLocale(locale); + const t = useTranslations('Main'); -export default function News() { return (
-

Professional Articles & Project News

+

{t('news')}

@@ -18,7 +24,7 @@ export default function News() { performance from many angles, such as human resources management, IT, operations management, risks etc.
- Read more + {i18nText('readMore', locale)}
@@ -36,7 +42,7 @@ export default function News() { performance from many angles, such as human resources management, IT, operations management, risks etc.
- Read more + {i18nText('readMore', locale)}
@@ -54,7 +60,7 @@ export default function News() { performance from many angles, such as human resources management, IT, operations management, risks etc.
- Read more + {i18nText('readMore', locale)} diff --git a/src/app/[locale]/(main)/layout.tsx b/src/app/[locale]/(main)/layout.tsx index daa1e7d..a22926a 100644 --- a/src/app/[locale]/(main)/layout.tsx +++ b/src/app/[locale]/(main)/layout.tsx @@ -12,17 +12,15 @@ import React, { ReactNode } from 'react'; // }; // } -export default function MainLayout({ children, news, directions, experts }: { +export default function MainLayout({ children, news, experts }: { children: ReactNode, news: ReactNode, - directions: ReactNode, experts: ReactNode }) { return ( <> {children} {news} - {directions} {experts} ); diff --git a/src/app/[locale]/account/(account)/work-with-us/coaching/page.tsx b/src/app/[locale]/account/(account)/work-with-us/coaching/page.tsx index 9b8fd55..2b00727 100644 --- a/src/app/[locale]/account/(account)/work-with-us/coaching/page.tsx +++ b/src/app/[locale]/account/(account)/work-with-us/coaching/page.tsx @@ -1,7 +1,11 @@ import React from 'react'; +import { unstable_setRequestLocale } from 'next-intl/server'; import { Link } from '../../../../../../navigation'; +import { i18nText } from '../../../../../../i18nKeys'; + +export default function Coaching({ params: { locale } }: { params: { locale: string } }) { + unstable_setRequestLocale(locale); -export default function Coaching() { return ( <>
    @@ -94,9 +98,7 @@ export default function Coaching() {
    -

    - Professional Certification -

    +

    {i18nText('profCertification', locale)}

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra diff --git a/src/app/[locale]/account/(account)/work-with-us/page.tsx b/src/app/[locale]/account/(account)/work-with-us/page.tsx index f55ba69..465b5a0 100644 --- a/src/app/[locale]/account/(account)/work-with-us/page.tsx +++ b/src/app/[locale]/account/(account)/work-with-us/page.tsx @@ -1,30 +1,24 @@ import React from 'react'; -import type { Metadata } from 'next'; import { unstable_setRequestLocale } from 'next-intl/server'; -import { useTranslations } from 'next-intl'; import { i18nText } from '../../../../../i18nKeys'; -export const metadata: Metadata = { - title: 'Bbuddy - Account - Work with us', - description: 'Bbuddy desc work with us' -}; - export default function WorkWithUs({ params: { locale } }: { params: { locale: string } }) { unstable_setRequestLocale(locale); - const t = useTranslations('Account.WorkWithUs'); return ( <>
    1. {i18nText('accountMenu.work-with-us', locale)}
    -
    +
    -
    {i18nText('insertInfo', locale)}
    - -
    {i18nText('changeUserData', locale)}
    +
    +
    {i18nText('insertInfo', locale)}
    +
    {i18nText('changeUserData', locale)}
    + +
    ); diff --git a/src/app/[locale]/experts/[expertId]/page.tsx b/src/app/[locale]/experts/[expertId]/page.tsx index 6d1a701..8a19c42 100644 --- a/src/app/[locale]/experts/[expertId]/page.tsx +++ b/src/app/[locale]/experts/[expertId]/page.tsx @@ -11,6 +11,7 @@ import { } from '../../../../components/Experts/ExpertDetails'; import { Details } from '../../../../types/experts'; import { BackButton } from '../../../../components/view/BackButton'; +import { i18nText } from '../../../../i18nKeys'; export const metadata: Metadata = { title: 'Bbuddy - Experts item', @@ -31,10 +32,11 @@ export async function generateStaticParams({ return result; } -export default async function ExpertItem({ params: { expertId = '', locale} }: { params: { expertId: string, locale: string } }) { +export default async function ExpertItem({ params: { expertId = '', locale } }: { params: { expertId: string, locale: string } }) { if (!expertId) notFound(); const expert = await getExpertById(expertId, locale); + console.log(expert); const getAssociationLevel = (accLevelId?: number) => { if (accLevelId) { @@ -75,16 +77,16 @@ export default async function ExpertItem({ params: { expertId = '', locale} }: {
    - + - Back to experts list + {i18nText('backToExperts', locale)}
    - + -

    Expert Background

    +

    {i18nText('expertBackground', locale)}

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra malesuada, ligula sem tempor risus, non posuere urna diam a libero. @@ -92,7 +94,7 @@ export default async function ExpertItem({ params: { expertId = '', locale} }: { {expert?.publicCoachDetails?.educations && expert.publicCoachDetails.educations?.map(generateDescription)} {expert?.publicCoachDetails?.certificates && expert.publicCoachDetails.certificates.length > 0 && (

    -

    Professional Certification

    +

    {i18nText('profCertification', locale)}

    {expert.publicCoachDetails.certificates?.map((cert) => (

    @@ -110,7 +112,7 @@ export default async function ExpertItem({ params: { expertId = '', locale} }: { {expert?.publicCoachDetails?.trainings && expert.publicCoachDetails.trainings?.map(generateDescription)} {expert?.publicCoachDetails?.mbas && expert.publicCoachDetails.mbas?.map(generateDescription)} {expert?.publicCoachDetails?.experiences && expert.publicCoachDetails.experiences?.map(generateDescription)} - + {/*

    All Offers by this Expert

    diff --git a/src/components/Account/AccountMenu.tsx b/src/components/Account/AccountMenu.tsx index f7f61af..601a8b7 100644 --- a/src/components/Account/AccountMenu.tsx +++ b/src/components/Account/AccountMenu.tsx @@ -1,20 +1,17 @@ 'use client'; -import React, { useState } from 'react'; import { Button } from 'antd'; import { useSelectedLayoutSegment, usePathname } from 'next/navigation'; import { Link } from '../../navigation'; import { AUTH_TOKEN_KEY, AUTH_USER } from '../../constants/common'; import { deleteStorageKey } from '../../hooks/useLocalStorage'; import { i18nText } from '../../i18nKeys'; -import { DeleteAccountModal } from '../Modals/DeleteAccountModal'; import { getMenuConfig } from '../../utils/account'; export const AccountMenu = ({ locale }: { locale: string }) => { const selectedLayoutSegment = useSelectedLayoutSegment(); const pathname = selectedLayoutSegment || ''; const paths = usePathname(); - const [showDeleteModal, setShowDeleteModal] = useState(false); const menu: { path: string, title: string, count?: number }[] = getMenuConfig(locale); const onLogout = () => { @@ -23,8 +20,6 @@ export const AccountMenu = ({ locale }: { locale: string }) => { window?.location?.replace(`/${paths.split('/')[1]}/`); }; - const onDeleteAccount = () => setShowDeleteModal(true); - return (
      {menu.map(({ path, title, count }) => ( @@ -46,19 +41,6 @@ export const AccountMenu = ({ locale }: { locale: string }) => { {i18nText('logout', locale)} -
    • - - setShowDeleteModal(false)} - /> -
    ); }; diff --git a/src/components/Account/ProfileSettings.tsx b/src/components/Account/ProfileSettings.tsx index e40ee88..0d6c4a4 100644 --- a/src/components/Account/ProfileSettings.tsx +++ b/src/components/Account/ProfileSettings.tsx @@ -1,15 +1,18 @@ 'use client'; import React, { FC, useEffect, useState } from 'react'; -import { Form, Upload, Button } from 'antd'; +import { Form, Upload } from 'antd'; import type { UploadFile, UploadProps } from 'antd'; import ImgCrop from 'antd-img-crop'; -import { CameraOutlined } from '@ant-design/icons'; -import { Link } from '../../navigation'; -import { CustomInput } from '../view/CustomInput'; +import { CameraOutlined, DeleteOutlined } from '@ant-design/icons'; +import { useRouter } from '../../navigation'; +import { i18nText } from '../../i18nKeys'; import { Profile } from '../../types/profile'; import { useProfileSettings } from '../../actions/hooks/useProfileSettings'; -import { i18nText } from '../../i18nKeys'; +import { CustomInput } from '../view/CustomInput'; +import { OutlinedButton } from '../view/OutlinedButton'; +import { FilledYellowButton } from '../view/FilledButton'; +import { DeleteAccountModal } from "../Modals/DeleteAccountModal"; type ProfileSettingsProps = { locale: string; @@ -20,6 +23,8 @@ type ProfileSettingsProps = { export const ProfileSettings: FC = ({ locale }) => { const [form] = Form.useForm(); const { profileSettings } = useProfileSettings(locale); + const [showDeleteModal, setShowDeleteModal] = useState(false); + const router = useRouter(); useEffect(() => { if (profileSettings) { @@ -27,6 +32,13 @@ export const ProfileSettings: FC = ({ locale }) => { } }, [profileSettings]); + const saveProfileSettings = () => { + form.validateFields() + .then(() => { + console.log('success') + }) + } + const [fileList, setFileList] = useState(); const onChange: UploadProps['onChange'] = ({ fileList: newFileList }) => { @@ -48,6 +60,8 @@ export const ProfileSettings: FC = ({ locale }) => { // imgWindow?.document.write(image.outerHTML); }; + const onDeleteAccount = () => setShowDeleteModal(true); + return (
    @@ -67,32 +81,45 @@ export const ProfileSettings: FC = ({ locale }) => { */} -
    - - - -
    -
    - - - -
    - {/*
    +
    +
    + + + +
    +
    + + + +
    + {/*
    */} -
    - - - +
    + + + +
    -
    - +
    + {i18nText('save', locale)} + router.push('change-password')}> {i18nText('changePass', locale)} - + + } + danger + > + {i18nText('deleteAcc', locale)} +
    - + setShowDeleteModal(false)} + /> ); }; diff --git a/src/components/Account/sessions/SessionDetailsContent.tsx b/src/components/Account/sessions/SessionDetailsContent.tsx index fb17e54..f714917 100644 --- a/src/components/Account/sessions/SessionDetailsContent.tsx +++ b/src/components/Account/sessions/SessionDetailsContent.tsx @@ -1,19 +1,19 @@ 'use client' -import React, {useState} from 'react'; -import {Button, Empty, notification, Tag} from 'antd'; -import {LeftOutlined, PlusOutlined, RightOutlined} from '@ant-design/icons'; +import React, { useState } from 'react'; +import { Button, Empty, notification, Tag } from 'antd'; +import { LeftOutlined, PlusOutlined, RightOutlined } from '@ant-design/icons'; import Image from 'next/image'; import dayjs from 'dayjs'; -import {Link, useRouter} from '../../../navigation'; -import {i18nText} from '../../../i18nKeys'; -import {getDuration, getPrice} from '../../../utils/expert'; -import {PublicUser, Session, SessionState, SessionType} from '../../../types/sessions'; -import {AUTH_TOKEN_KEY} from '../../../constants/common'; -import {approveRequestedSession, finishSession} from '../../../actions/sessions'; -import {useLocalStorage} from '../../../hooks/useLocalStorage'; -import {DeclineSessionModal} from '../../Modals/DeclineSessionModal'; -import {AddCommentModal} from '../../Modals/AddCommentModal'; +import { Link, useRouter } from '../../../navigation'; +import { i18nText } from '../../../i18nKeys'; +import { getDuration, getPrice } from '../../../utils/expert'; +import { PublicUser, Session, SessionState, SessionType } from '../../../types/sessions'; +import { AUTH_TOKEN_KEY } from '../../../constants/common'; +import { approveRequestedSession, finishSession } from '../../../actions/sessions'; +import { useLocalStorage } from '../../../hooks/useLocalStorage'; +import { DeclineSessionModal } from '../../Modals/DeclineSessionModal'; +import { AddCommentModal } from '../../Modals/AddCommentModal'; type SessionDetailsContentProps = { locale: string; @@ -43,7 +43,7 @@ export const SessionDetailsContent = ({ session, locale, activeType, startSessio }) .catch((err) => { notification.error({ - message: 'Error approve session', + message: i18nText('errors.approvingSession', locale), description: err?.response?.data?.errMessage }); }) @@ -64,7 +64,7 @@ export const SessionDetailsContent = ({ session, locale, activeType, startSessio }) .catch((err) => { notification.error({ - message: 'Error finish session', + message: i18nText('errors.finishingSession', locale), description: err?.response?.data?.errMessage }); }) @@ -166,7 +166,7 @@ export const SessionDetailsContent = ({ session, locale, activeType, startSessio icon={} onClick={goBack} > - Back + {i18nText('back', locale)}
    {Current} @@ -181,8 +181,8 @@ export const SessionDetailsContent = ({ session, locale, activeType, startSessio disabled={finishLoading} > {activeType === SessionType.UPCOMING - ? (session?.state === SessionState.STARTED ? 'Join Session' : 'Start Session') - : 'Confirm Session'} + ? (session?.state === SessionState.STARTED ? i18nText('session.join', locale) : i18nText('session.start', locale)) + : i18nText('session.confirm', locale)} {session?.state === SessionState.STARTED && isCoach && ( )} {session?.id && session?.state !== SessionState.STARTED && ( @@ -200,7 +200,7 @@ export const SessionDetailsContent = ({ session, locale, activeType, startSessio onClick={() => setOpenDeclineModal(true)} disabled={approveLoading} > - Decline Session + {i18nText('session.decline', locale)} {activeType === SessionType.RECENT && ( <> -
    Course Info
    +
    {i18nText('courseInfo', locale)}
    {/*
    {current?.specialityDesc}
    @@ -249,7 +249,9 @@ export const SessionDetailsContent = ({ session, locale, activeType, startSessio
    - {session?.clientComments?.length === 0 && session?.coachComments?.length === 0 ? 'Comments' : 'My Comments'} + {session?.clientComments?.length === 0 && session?.coachComments?.length === 0 + ? i18nText('session.comments', locale) + : i18nText('session.myComments', locale)}
    {activeType === SessionType.UPCOMING && ( <> @@ -260,7 +262,7 @@ export const SessionDetailsContent = ({ session, locale, activeType, startSessio icon={} onClick={() => setOpenAddCommentModal(true)} > - Add new + {i18nText('session.addComment', locale)} { ]) .then(([upcoming, requested, recent]) => { setSessions({ - [SessionType.UPCOMING]: upcoming.data || [], - [SessionType.REQUESTED]: requested.data?.requestedSessions || [], - [SessionType.RECENT]: recent.data || [] + [SessionType.UPCOMING]: upcoming || [], + [SessionType.REQUESTED]: requested?.requestedSessions || [], + [SessionType.RECENT]: recent || [] }); }) .catch((err) => { @@ -115,7 +115,7 @@ export const SessionsTabs = ({ locale, activeTab }: SessionsTabsProps) => {
    ) }) : ( - + )}
    diff --git a/src/components/Experts/ExpertDetails.tsx b/src/components/Experts/ExpertDetails.tsx index 0c06c74..4398016 100644 --- a/src/components/Experts/ExpertDetails.tsx +++ b/src/components/Experts/ExpertDetails.tsx @@ -7,13 +7,15 @@ import { ZoomInOutlined, ZoomOutOutlined, StarFilled } from '@ant-design/icons'; import { ExpertDetails, ExpertDocument } from '../../types/experts'; import { Locale } from '../../types/locale'; import { CustomRate } from '../view/CustomRate'; +import { i18nText } from '../../i18nKeys'; +import { FilledYellowButton } from '../view/FilledButton'; type ExpertDetailsProps = { expert: ExpertDetails; locale?: string; }; -export const ExpertCard: FC = ({ expert }) => { +export const ExpertCard: FC = ({ expert, locale }) => { const { publicCoachDetails } = expert || {}; return ( @@ -25,39 +27,43 @@ export const ExpertCard: FC = ({ expert }) => {

    {`${publicCoachDetails?.name} ${publicCoachDetails?.surname || ''}`}

    - {`${publicCoachDetails?.practiceHours} Practice hours`} + {`${publicCoachDetails?.practiceHours} ${i18nText('practiceHours', locale)}`} | - {`${publicCoachDetails?.supervisionPerYearId} Supervision per year`} + {`${publicCoachDetails?.supervisionPerYearId} ${i18nText('supervisionCount', locale)}`}
    } disabled /> - 4/5 (out of 345) + {`4/5 (${i18nText('outOf', locale)} 345)`}
    ); }; export const ExpertInformation: FC = ({ expert, locale }) => { - const { publicCoachDetails: { tags = [], sessionCost = 0, sessionDuration = 0 } } = expert || {}; + const { publicCoachDetails: { tags = [], sessionCost = 0, sessionDuration = 0, coachLanguages = [] } } = expert || {}; const isRus = locale === Locale.ru; return ( <> -

    Current Offer

    -
    - {tags?.map((skill) => {skill?.name})} +
    + {/*

    {}

    */} +
    + {coachLanguages?.map((skill) => {skill})} +

    Hello, my name is Marcelo. I am a Senior UX Designer with more than 6 years of experience working @@ -74,10 +80,11 @@ export const ExpertInformation: FC = ({ expert, locale }) => Oh, and I also speak Spanish!

    +
    + {tags?.map((skill) => {skill?.name})} +
    - - Sign Up Now - + console.log('schedule')}>{i18nText('signUp', locale)}
    {`${sessionCost}€`} / {`${sessionDuration}${isRus ? 'мин' : 'min'}`}
    @@ -86,7 +93,7 @@ export const ExpertInformation: FC = ({ expert, locale }) => ); }; -export const ExpertPractice: FC = ({ expert }) => { +export const ExpertPractice: FC = ({ expert, locale }) => { const { publicCoachDetails: { practiceCases = [], themesGroups = [] } } = expert || {}; return practiceCases?.length > 0 ? ( @@ -100,7 +107,7 @@ export const ExpertPractice: FC = ({ expert }) => { {themesGroupIds && (
    {filtered?.map(({ id, name }) => ( -
    {name}
    + {name} ))}
    )} diff --git a/src/components/Experts/ExpertsList.tsx b/src/components/Experts/ExpertsList.tsx index f84351a..28db1e5 100644 --- a/src/components/Experts/ExpertsList.tsx +++ b/src/components/Experts/ExpertsList.tsx @@ -84,6 +84,7 @@ export const ExpertsList = ({ size="large" className="search-result" dataSource={experts.coaches} + locale={{ emptyText: i18nText('notFound', locale) }} renderItem={(item) => ( (
    -

    {name}

    +

    {name}

    {getList('themesTagIds', tags)}
    )) : null; @@ -214,7 +214,7 @@ export const ExpertsFilter = ({ key: 'themesTagIds', label: ( <> -
    Direction
    +
    {i18nText('direction', locale)}
    {!openedTabs.includes('themesTagIds') && filter?.themesTagIds?.length > 0 && (
    {getSelectedTags()}
    )} diff --git a/src/components/Modals/AddCommentModal.tsx b/src/components/Modals/AddCommentModal.tsx index 43e4a0c..9fa1d83 100644 --- a/src/components/Modals/AddCommentModal.tsx +++ b/src/components/Modals/AddCommentModal.tsx @@ -83,7 +83,7 @@ export const AddCommentModal: FC = ({ rules={[ { required: true, - message: 'Please input your comment' + message: i18nText('errors.emptyComment', locale) } ]} > @@ -91,7 +91,7 @@ export const AddCommentModal: FC = ({ className="b-textarea" rows={4} maxLength={1000} - placeholder="Your comment" + placeholder={i18nText('session.commentPlaceholder', locale)} /> @@ -101,7 +101,7 @@ export const AddCommentModal: FC = ({ onClick={onAddComment} loading={loading} > - Send + {i18nText('send', locale)}
    diff --git a/src/components/Modals/AuthModal.tsx b/src/components/Modals/AuthModal.tsx index b7758a0..034225c 100644 --- a/src/components/Modals/AuthModal.tsx +++ b/src/components/Modals/AuthModal.tsx @@ -6,6 +6,7 @@ import Link from 'next/link'; import { Modal, Form } from 'antd'; import { CloseOutlined } from '@ant-design/icons'; import { RegisterContent, ResetContent, FinishContent, EnterContent } from './authModalContent'; +import { i18nText } from '../../i18nKeys'; type AuthModalProps = { open: boolean; @@ -13,6 +14,7 @@ type AuthModalProps = { mode: 'enter' | 'register' | 'reset' | 'finish'; updateMode: (mode: 'enter' | 'register' | 'reset' | 'finish') => void; updateToken: string | Dispatch> | undefined; + locale: string; }; export const AuthModal: FC = ({ @@ -20,7 +22,8 @@ export const AuthModal: FC = ({ handleCancel, mode, updateMode, - updateToken + updateToken, + locale }) => { const [form] = Form.useForm<{ login: string, password: string, confirmPassword: string }>(); const paths = usePathname().split('/'); @@ -50,7 +53,7 @@ export const AuthModal: FC = ({ onCancel={handleCancel} afterClose={onAfterClose} footer={false} - width={498} + width={598} closeIcon={} >
    @@ -82,8 +85,8 @@ export const AuthModal: FC = ({ )}
    - I have read and agree with the terms of the - User Agreement, Privacy Policy + {`${i18nText('agreementText', locale)} `} + {i18nText('privacyPolicy', locale)}
    diff --git a/src/components/Modals/DeclineSessionModal.tsx b/src/components/Modals/DeclineSessionModal.tsx index 44f23b4..ab6f508 100644 --- a/src/components/Modals/DeclineSessionModal.tsx +++ b/src/components/Modals/DeclineSessionModal.tsx @@ -7,7 +7,7 @@ import { SessionType } from '../../types/sessions'; import { AUTH_TOKEN_KEY } from '../../constants/common'; import { useLocalStorage } from '../../hooks/useLocalStorage'; import { cancelUpcomingSession, declineRequestedSession } from '../../actions/sessions'; -// import { i18nText } from '../../i18nKeys'; +import { i18nText } from '../../i18nKeys'; import { FilledButton } from '../view/FilledButton'; type DeclineModalProps = { @@ -79,7 +79,7 @@ export const DeclineSessionModal: FC = ({
    - Enter a reason for cancelling the session + {i18nText('session.cancelReason', locale)}
    = ({ rules={[ { required: true, - message: 'Please input the reason' + message: i18nText('errors.emptyCancelReason', locale) } ]} >
    @@ -106,7 +106,7 @@ export const DeclineSessionModal: FC = ({ onClick={onDecline} loading={loading} > - Decline + {i18nText('decline', locale)}
    diff --git a/src/components/Modals/authModalContent/EnterContent.tsx b/src/components/Modals/authModalContent/EnterContent.tsx index 2bc79c7..004a776 100644 --- a/src/components/Modals/authModalContent/EnterContent.tsx +++ b/src/components/Modals/authModalContent/EnterContent.tsx @@ -37,10 +37,10 @@ export const EnterContent: FC = ({ const { login, password } = form.getFieldsValue(); setIsLoading(true); getAuth(locale, { login, password }) - .then(({ data }) => { + .then((data) => { if (data.jwtToken) { getPersonalData(locale, data.jwtToken) - .then(({ data: profile }) => { + .then((profile) => { localStorage.setItem(AUTH_USER, JSON.stringify(profile)); updateToken(data.jwtToken); handleCancel(); @@ -110,11 +110,11 @@ export const EnterContent: FC = ({ rules={[ { type: 'email', - message: 'The input is not valid E-mail' + message: i18nText('errors.validEmail', locale) }, { required: true, - message: 'Please input your E-mail' + message: i18nText('error.emptyEmail', locale) } ]} > @@ -129,7 +129,7 @@ export const EnterContent: FC = ({ noStyle rules={[{ required: true, - message: 'Please input your password' + message: i18nText('errors.emptyPass', locale) }]} > = ({ type="link" onClick={() => updateMode('reset')} > - Forgot password? + {`${i18nText('forgotPass', locale)}?`} - or + {i18nText('or', locale)} } onClick={() => onSocialEnter(Social.FACEBOOK)} > - Facebook account + {i18nText('facebook', locale)} } onClick={() => onSocialEnter(Social.APPLE)} > - Apple account + {i18nText('apple', locale)} } onClick={() => onSocialEnter(Social.GOOGLE)} > - Google account + {i18nText('google', locale)} ); diff --git a/src/components/Modals/authModalContent/FinishContent.tsx b/src/components/Modals/authModalContent/FinishContent.tsx index 9ed06bb..e8271da 100644 --- a/src/components/Modals/authModalContent/FinishContent.tsx +++ b/src/components/Modals/authModalContent/FinishContent.tsx @@ -5,14 +5,10 @@ import { i18nText } from '../../../i18nKeys'; export const FinishContent = ({ locale }: { locale: string }) => ( <>
    - A link to reset your password has been sent -
    - to your email + {i18nText('resetPassText', locale)}
    - - {i18nText('enter', locale)} + + {i18nText('enterAccount', locale)} ); diff --git a/src/components/Modals/authModalContent/RegisterContent.tsx b/src/components/Modals/authModalContent/RegisterContent.tsx index ce3775e..f62fc59 100644 --- a/src/components/Modals/authModalContent/RegisterContent.tsx +++ b/src/components/Modals/authModalContent/RegisterContent.tsx @@ -36,10 +36,10 @@ export const RegisterContent: FC = ({ const { login, password } = form.getFieldsValue(); setIsLoading(true); getRegister(locale) - .then(({ data }) => { + .then((data) => { if (data.jwtToken) { setPersonData( { login, password, role: 'client', languagesLinks: [] }, locale, data.jwtToken) - .then(({ data: profile }) => { + .then((profile) => { updateToken(data.jwtToken); localStorage.setItem(AUTH_USER, JSON.stringify(profile.userData)); handleCancel(); @@ -115,11 +115,11 @@ export const RegisterContent: FC = ({ rules={[ { type: 'email', - message: 'The input is not valid E-mail' + message: i18nText('errors.validEmail', locale) }, { required: true, - message: 'Please input your E-mail' + message: i18nText('error.emptyEmail', locale) } ]} > @@ -134,7 +134,7 @@ export const RegisterContent: FC = ({ noStyle rules={[{ required: true, - message: 'Please input your password' + message: i18nText('errors.emptyPass', locale) }]} > = ({ rules={[ { required: true, - message: 'Please confirm your password', + message: i18nText('errors.confirmPass', locale), }, ({ getFieldValue }) => ({ validator(_, value) { if (!value || getFieldValue('password') === value) { return Promise.resolve(); } - return Promise.reject(new Error('The new password that you entered do not match')); + return Promise.reject(new Error(i18nText('errors.notMatchPass', locale))); }, }), ]} @@ -176,24 +176,24 @@ export const RegisterContent: FC = ({ {i18nText('registration', locale)} updateMode('enter')}>{i18nText('enter', locale)} - or + {i18nText('or', locale)} } onClick={() => onSocialRegister(Social.FACEBOOK)} > - Facebook account + {i18nText('facebook', locale)} } onClick={() => onSocialRegister(Social.APPLE)} > - Apple account + {i18nText('apple', locale)} } onClick={() => onSocialRegister(Social.GOOGLE)} > - Google account + {i18nText('google', locale)} ); diff --git a/src/components/Modals/authModalContent/ResetContent.tsx b/src/components/Modals/authModalContent/ResetContent.tsx index 6f34207..277d07d 100644 --- a/src/components/Modals/authModalContent/ResetContent.tsx +++ b/src/components/Modals/authModalContent/ResetContent.tsx @@ -29,11 +29,11 @@ export const ResetContent: FC = ({ rules={[ { type: 'email', - message: 'The input is not valid E-mail' + message: i18nText('errors.validEmail', locale) }, { required: true, - message: 'Please input your E-mail' + message: i18nText('error.emptyEmail', locale) } ]} > @@ -48,7 +48,7 @@ export const ResetContent: FC = ({ type="primary" onClick={onResetPassword} > - Reset Password + {i18nText('resetPass', locale)} (
    -
    +

    {title}

    {description &&

    {description}

    } diff --git a/src/components/Page/Header/HeaderAuthLinks.tsx b/src/components/Page/Header/HeaderAuthLinks.tsx index 362dfbe..d8e3d5e 100644 --- a/src/components/Page/Header/HeaderAuthLinks.tsx +++ b/src/components/Page/Header/HeaderAuthLinks.tsx @@ -72,6 +72,7 @@ function HeaderAuthLinks ({ mode={mode} updateMode={setMode} updateToken={setToken} + locale={locale} /> ); diff --git a/src/components/Page/Header/HeaderMenu.tsx b/src/components/Page/Header/HeaderMenu.tsx index 62eae81..a33af1d 100644 --- a/src/components/Page/Header/HeaderMenu.tsx +++ b/src/components/Page/Header/HeaderMenu.tsx @@ -18,6 +18,7 @@ export const HeaderMenu = ({ }: HeaderMenuProps) => { const selectedLayoutSegment = useSelectedLayoutSegment(); const pathname = selectedLayoutSegment || ''; + const url = pathname === '(main)' ? '' : pathname; return (
    @@ -25,7 +26,7 @@ export const HeaderMenu = ({
      {linkConfig.map(({ path, title }) => (
    • - {title} + {title}
    • ))} diff --git a/src/components/Page/Header/index.tsx b/src/components/Page/Header/index.tsx index 6752313..25cbf09 100644 --- a/src/components/Page/Header/index.tsx +++ b/src/components/Page/Header/index.tsx @@ -13,7 +13,7 @@ type HeaderProps = { export const Header: FC = ({ locale }) => { const routes: { path: string, title: string }[] = HEAD_ROUTES.map((item) => ({ path: item, - title: i18nText(`menu.${item}`, locale) + title: i18nText(item ? `menu.${item}` : 'menu.home', locale) })); return ( diff --git a/src/components/view/FilledButton.tsx b/src/components/view/FilledButton.tsx index 4f42a78..3b875b6 100644 --- a/src/components/view/FilledButton.tsx +++ b/src/components/view/FilledButton.tsx @@ -6,3 +6,9 @@ export const FilledButton = (props: any) => ( {props.children} ); + +export const FilledYellowButton = (props: any) => ( + +); diff --git a/src/components/view/OutlinedButton.tsx b/src/components/view/OutlinedButton.tsx index 04bb269..4f23ebb 100644 --- a/src/components/view/OutlinedButton.tsx +++ b/src/components/view/OutlinedButton.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Button } from 'antd'; export const OutlinedButton = (props: any) => ( - ); diff --git a/src/constants/routes.ts b/src/constants/routes.ts index 125bafe..52fb200 100644 --- a/src/constants/routes.ts +++ b/src/constants/routes.ts @@ -1 +1,2 @@ -export const HEAD_ROUTES = ['bb-client', 'bb-expert', 'blog']; +// export const HEAD_ROUTES = ['bb-client', 'bb-expert', 'blog']; +export const HEAD_ROUTES = ['', 'blog']; diff --git a/src/i18nKeys/de.ts b/src/i18nKeys/de.ts index 6d38422..21bb176 100644 --- a/src/i18nKeys/de.ts +++ b/src/i18nKeys/de.ts @@ -11,12 +11,16 @@ export default { menu: { 'bb-client': 'Mit BB wachsen', 'bb-expert': 'Werde BB-Experte', + home: 'Startseite', blog: 'Blog&News' }, registration: 'Registrieren', enter: 'Anmelden', + enterAccount: 'Konto anmelden', account: 'Mein Konto', logout: 'Abmelden', + decline: 'Ablehnen', + send: 'Senden', deleteAcc: 'Konto löschen', footer: { faq: 'FAQ', @@ -25,8 +29,29 @@ export default { session: { upcoming: 'Kommende Sitzungen', requested: 'Angefragte Sitzungen', - recent: 'Letzte Sitzungen' + recent: 'Letzte Sitzungen', + cancelReason: 'Gib einen Grund für die Absage der Sitzung ein', + reasonPlaceholder: 'Beschreibe den Grund für die Ablehnung', + decline: 'Sitzung ablehnen', + confirm: 'Sitzung bestätigen', + join: 'Sitzung beitreten', + start: 'Sitzung starten', + finish: 'Sitzung abschließen', + comments: 'Kommentare', + myComments: 'Meine Kommentare', + addComment: 'Neuen Kommentar hinzufügen', + commentPlaceholder: 'Ihr Kommentar', }, + room: { + upcoming: 'Zukünftige Räume', + requested: 'Angeforderte Räume', + recent: 'Kürzliche Räume', + newRoom: 'Neuer Raum' + }, + agreementText: 'Folgendes habe ich gelesen und erkläre mich damit einverstanden: Benutzervereinbarung,', + userAgreement: 'Benutzervereinbarung', + privacyPolicy: 'Datenschutzrichtlinie', + readMore: 'Mehr erfahren', photoDesc: 'Füge ein echtes Foto hinzu, mit Gesicht wirkt es immer glaubwürdiger.', dayStart: 'Tagesbeginn', topic: 'Thema', @@ -37,6 +62,12 @@ export default { oldPass: 'Altes Passwort', newPass: 'Neues Passwort', confirmPass: 'Passwort bestätigen', + forgotPass: 'Passwort vergessen', + resetPassText: 'Ein Link zum Zurücksetzen Ihres Passworts wurde an Ihre E-Mail gesendet', + or: 'oder', + facebook: 'Facebook-Konto', + apple: 'Apple-Konto', + google: 'Google-Konto', becomeExpert: '', insertInfo: 'Füge deine persönlichen Informationen ein, um deine Reise als BBuddy-Experte zu beginnen', changeUserData: 'Du kannst deine Angaben jederzeit ergänzen oder ändern\n', @@ -49,11 +80,36 @@ export default { sortPriceDesc: 'Nach Preis absteigend', details: 'Details', sessionLang: 'Sitzungssprache', + direction: 'Wegbeschreibung', fromTo: 'von $ bis $', apply: 'Anwenden', save: 'Speichern', changePass: 'Passwort ändern', + resetPass: 'Passwort zurücksetzen', getStarted: 'Loslegen', delete: 'Löschen', - today: 'Heute' + today: 'Heute', + back: 'Zurück', + backToExperts: 'Zurück zur Expertenliste', + courseInfo: 'Kursinfo', + expertBackground: 'Expertenhintergrund', + profCertification: 'Professionelle Zertifizierung', + practiceHours: 'Praxisstunden', + supervisionCount: 'Supervision pro Jahr', + outOf: 'von', + schedule: 'Zeitplan', + signUp: 'Jetzt anmelden', + noData: 'Keine Daten', + notFound: 'Nicht gefunden', + errors: { + invalidEmail: 'Die E-Mail-Adresse ist ungültig', + emptyEmail: 'Bitte geben Sie Ihre E-Mail ein', + emptyPass: 'Bitte geben Sie Ihr Passwort ein', + confirmPass: 'Bitte bestätigen Sie Ihr Passwort', + notMatchPass: 'Die neuen Passwörter stimmen nicht überein', + emptyCancelReason: 'Bitte gib den Grund ein', + approvingSession: 'Fehler beim Genehmigen der Sitzung', + finishingSession: 'Fehler beim Beenden der Sitzung', + emptyComment: 'Bitte geben Sie Ihren Kommentar ein', + }, } diff --git a/src/i18nKeys/en.ts b/src/i18nKeys/en.ts index cb90828..cc538c3 100644 --- a/src/i18nKeys/en.ts +++ b/src/i18nKeys/en.ts @@ -11,12 +11,16 @@ export default { menu: { 'bb-client': 'Start grow with BB', 'bb-expert': 'Become BB Expert', + home: 'Home', blog: 'Blog&News' }, registration: 'Registration', enter: 'Enter', + enterAccount: 'Enter account', account: 'My Account', logout: 'Log out', + decline: 'Decline', + send: 'Send', deleteAcc: 'Delete account', footer: { faq: 'FAQ', @@ -25,8 +29,29 @@ export default { session: { upcoming: 'Upcoming Sessions', requested: 'Sessions Requested', - recent: 'Recent Sessions' + recent: 'Recent Sessions', + cancelReason: 'Enter a reason for cancelling the session', + reasonPlaceholder: 'Describe the reason for the rejection', + decline: 'Decline session', + confirm: 'Confirm session', + join: 'Join session', + start: 'Start session', + finish: 'Finish session', + comments: 'Comments', + myComments: 'My comments', + addComment: 'Add new', + commentPlaceholder: 'Your comment', }, + room: { + upcoming: 'Upcoming Rooms', + requested: 'Rooms Requested', + recent: 'Recent Rooms', + newRoom: 'New Room' + }, + agreementText: 'I have read and agree with the terms of the User Agreement,', + userAgreement: 'User Agreement', + privacyPolicy: 'Privacy Policy', + readMore: 'Read more', photoDesc: 'Add a real photo, as a person\'s face is always more credible.', dayStart: 'Day start', topic: 'Topic', @@ -37,6 +62,12 @@ export default { oldPass: 'Old Password', newPass: 'New Password', confirmPass: 'Confirm Password', + forgotPass: 'Forgot password', + resetPassText: 'A link to reset your password has been sent to your email', + or: 'or', + facebook: 'Facebook account', + apple: 'Apple account', + google: 'Google account', becomeExpert: '', insertInfo: 'Insert your personal information to start your journey as a BBuddy Expert', changeUserData: 'Your info can either be added or amended at anytime', @@ -49,11 +80,36 @@ export default { sortPriceDesc: 'By price descending', details: 'Details', sessionLang: 'Session Language', + direction: 'Direction', fromTo: 'from $ to $', apply: 'Apply', save: 'Save', changePass: 'Change password', + resetPass: 'Reset password', getStarted: 'Get started', delete: 'Delete', - today: 'Today' + today: 'Today', + back: 'Back', + backToExperts: 'Back to experts list', + courseInfo: 'Course Info', + expertBackground: 'Expert Background', + profCertification: 'Professional Certification', + practiceHours: 'Practice hours', + supervisionCount: 'Supervision per year', + outOf: 'out of', + schedule: 'Schedule', + signUp: 'Sign up now', + noData: 'No data', + notFound: 'Not found', + errors: { + invalidEmail: 'The email address is not valid', + emptyEmail: 'Please enter your E-mail', + emptyPass: 'Please enter your password', + confirmPass: 'Please confirm your password', + notMatchPass: 'The new passwords you entered do not match', + emptyCancelReason: 'Please enter the reason', + approvingSession: 'Error approving session', + finishingSession: 'Error finishing session', + emptyComment: 'Please enter your comment', + }, } diff --git a/src/i18nKeys/es.ts b/src/i18nKeys/es.ts index dac42c9..9c7d096 100644 --- a/src/i18nKeys/es.ts +++ b/src/i18nKeys/es.ts @@ -11,12 +11,16 @@ export default { menu: { 'bb-client': 'Empieza a crecer con BB', 'bb-expert': 'Conviértete en un experto en BB', + home: 'Inicio', blog: 'Blog y noticias' }, registration: 'Registro', enter: 'Entrar', + enterAccount: 'Introducir cuenta', account: 'Mi cuenta', logout: 'Cerrar sesión', + decline: 'Rechazar', + send: 'Enviar', deleteAcc: 'Eliminar cuenta', footer: { faq: 'Preguntas frecuentes', @@ -25,8 +29,29 @@ export default { session: { upcoming: 'Próximas sesiones', requested: 'Sesiones solicitadas', - recent: 'Sesiones recientes' + recent: 'Sesiones recientes', + cancelReason: 'Introduce el motivo por el que has cancelado la sesión', + reasonPlaceholder: 'Describe el motivo del rechazo', + decline: 'Rechazar sesión', + confirm: 'Confirmar sesión', + join: 'Unirse a la sesión', + start: 'Iniciar sesión', + finish: 'Finalizar la sesión', + comments: 'Comentarios', + myComments: 'Mis comentarios', + addComment: 'Añadir nuevo comentario', + commentPlaceholder: 'Tu comentario', }, + room: { + upcoming: 'Próximas salas', + requested: 'Salas solicitadas', + recent: 'Salas recientes', + newRoom: 'Nueva sala' + }, + agreementText: 'He leído y acepto las condiciones del Acuerdo de usuario,', + userAgreement: 'Acuerdo de usuario', + privacyPolicy: 'Política de privacidad', + readMore: 'Seguir leyendo', photoDesc: 'Añade una foto real, ya que la cara de una persona siempre es más creíble.', dayStart: 'Inicio del día', topic: 'Tema', @@ -37,6 +62,12 @@ export default { oldPass: 'Contraseña antigua', newPass: 'Nueva contraseña', confirmPass: 'Confirmar contraseña', + forgotPass: 'Se te ha olvidado la contraseña', + resetPassText: 'Se ha enviado un enlace para restablecer la contraseña a tu correo electrónico', + or: 'o', + facebook: 'Cuenta de Facebook', + apple: 'Cuenta de Apple', + google: 'Cuenta de Google', becomeExpert: '', insertInfo: 'Introduce tu información personal para comenzar tu viaje como experto en BBuddy', changeUserData: 'Tus datos pueden añadirse o modificarse en cualquier momento', @@ -49,11 +80,36 @@ export default { sortPriceDesc: 'Por precio descendiente', details: 'Detalles', sessionLang: 'Idioma de la sesión', + direction: 'Dirección', fromTo: 'de $ a $', apply: 'Solicitar', save: 'Guardar', changePass: 'Cambiar contraseña', + resetPass: 'Restablecer contraseña', getStarted: 'Empieza', delete: 'Eliminar', - today: 'Hoy día' + today: 'Hoy', + back: 'Volver', + backToExperts: 'Volver a la lista de expertos', + courseInfo: 'Información del curso', + expertBackground: 'Antecedentes del experto', + profCertification: 'Certificación profesional', + practiceHours: 'horas de práctica', + supervisionCount: 'supervisiones anuales', + outOf: 'de', + schedule: 'Horario', + signUp: 'Regístrate ahora', + noData: 'Sin datos', + notFound: 'No encontrado', + errors: { + invalidEmail: 'La dirección de correo electrónico no es válida', + emptyEmail: 'Introduce tu correo electrónico', + emptyPass: 'Introduce tu contraseña', + confirmPass: 'Confirma tu contraseña', + notMatchPass: 'Las nuevas contraseñas que has introducido no coinciden', + emptyCancelReason: 'Introduce el motivo', + approvingSession: 'Error al aprobar la sesión', + finishingSession: 'Error al finalizar la sesión', + emptyComment: 'Introduce tu comentario', + }, } diff --git a/src/i18nKeys/fr.ts b/src/i18nKeys/fr.ts index e1afbf6..9b5c471 100644 --- a/src/i18nKeys/fr.ts +++ b/src/i18nKeys/fr.ts @@ -11,12 +11,16 @@ export default { menu: { 'bb-client': 'Commencez à vous développer avec BB', 'bb-expert': 'Devenez Expert BB', + home: 'Accueil', blog: 'Blog et actus' }, registration: 'Inscription', enter: 'Saisir', + enterAccount: 'Saisir le compte', account: 'Mon compte', logout: 'Déconnexion', + decline: 'Refuser', + send: 'Envoyer', deleteAcc: 'Supprimer le compte', footer: { faq: 'FAQ', @@ -25,8 +29,29 @@ export default { session: { upcoming: 'Prochaines sessions', requested: 'Sessions demandées', - recent: 'Sessions récentes' + recent: 'Sessions récentes', + cancelReason: 'Saisissez une raison pour l\'annulation de la session', + reasonPlaceholder: 'Décrivez la raison du refus', + decline: 'Refuser la session', + confirm: 'Confirmer la session', + join: 'Rejoindre la session', + start: 'Commencer la session', + finish: 'Terminer la session', + comments: 'Commentaires', + myComments: 'Mes commentaires', + addComment: 'Ajouter un nouveau commentaire', + commentPlaceholder: 'Votre commentaire', }, + room: { + upcoming: 'Salles futures', + requested: 'Salles demandées', + recent: 'Salles récentes', + newRoom: 'Nouvelle salle' + }, + agreementText: 'J\'ai lu et j\'accepte les dispositions de l\'Accord Utilisateur et de la', + userAgreement: '', + privacyPolicy: 'Politique de Confidentialité', + readMore: 'En savoir plus', photoDesc: 'Ajoutez une photo réelle, le visage d\'une personne est toujours plus crédible.', dayStart: 'Début de la journée', topic: 'Sujet', @@ -37,6 +62,12 @@ export default { oldPass: 'Ancien mot de passe', newPass: 'Nouveau mot de passe', confirmPass: 'Confirmer le mot de passe', + forgotPass: 'Mot de passe oublié', + resetPassText: 'Un lien pour réinitialiser votre mot de passe a été envoyé à votre adresse e-mail', + or: 'ou', + facebook: 'Compte Facebook', + apple: 'Compte Apple', + google: 'Compte Google', becomeExpert: '', insertInfo: 'Insérez vos informations personnelles pour commencer votre voyage en tant qu\'expert BBuddy', changeUserData: 'Vos informations peuvent être ajoutées ou modifiées à tout moment', @@ -49,11 +80,36 @@ export default { sortPriceDesc: 'Par prix décroissant', details: 'Détails', sessionLang: 'Langue de la session', + direction: 'Direction', fromTo: 'de $ à $', apply: 'Appliquer', save: 'Sauvegarder', changePass: 'Modifier le mot de passe', + resetPass: 'Réinitialiser le mot de passe', getStarted: 'Commencer', delete: 'Supprimer', - today: 'Ce jour' + today: 'Aujourd\'hui', + back: 'Retour', + backToExperts: 'Retour à la liste d\'experts', + courseInfo: 'Infos sur le cours', + expertBackground: 'Antécédents de l\'expert', + profCertification: 'Certification professionnelle', + practiceHours: 'heures de pratique', + supervisionCount: 'Supervision par an', + outOf: 'sur', + schedule: 'Programme', + signUp: 'Inscrivez-vous maintenant', + noData: 'Aucune donnée', + notFound: 'Non trouvé', + errors: { + invalidEmail: 'L\'adresse e-mail n\'est pas valide', + emptyEmail: 'Veuillez saisir votre e-mail', + emptyPass: 'Veuillez saisir votre mot de passe', + confirmPass: 'Veuillez confirmer votre mot de passe', + notMatchPass: 'Les nouveaux mots de passe que vous avez saisis ne sont pas identiques', + emptyCancelReason: 'Veuillez saisir la raison', + approvingSession: 'Erreur lors de l\'approbation de la session', + finishingSession: 'Erreur lors de la fin de la session', + emptyComment: 'Veuillez saisir votre commentaire', + }, } diff --git a/src/i18nKeys/it.ts b/src/i18nKeys/it.ts index 9b7e3f1..575b165 100644 --- a/src/i18nKeys/it.ts +++ b/src/i18nKeys/it.ts @@ -11,12 +11,16 @@ export default { menu: { 'bb-client': 'Inizia a crescere con BB', 'bb-expert': 'Diventa esperto BB', + home: 'Home', blog: 'Blog&Notizie' }, registration: 'Registrazione', enter: 'Inserisci', + enterAccount: 'Inserisci account', account: 'Il mio account', logout: 'Disconnetti', + decline: 'Rifiuta', + send: 'Invia', deleteAcc: 'Elimina account', footer: { faq: 'Domande frequenti', @@ -25,8 +29,29 @@ export default { session: { upcoming: 'Prossime sessioni', requested: 'Sessioni richieste', - recent: 'Sessioni recenti' + recent: 'Sessioni recenti', + cancelReason: 'Inserisci un motivo per l\'annullamento della sessione', + reasonPlaceholder: 'Descrivi il motivo del rifiuto', + decline: 'Rifiuta sessione', + confirm: 'Conferma sessione', + join: 'Partecipa alla sessione', + start: 'Avvia sessione', + finish: 'Termina sessione', + comments: 'Commenti', + myComments: 'I miei commenti', + addComment: 'Aggiungi nuovo commento', + commentPlaceholder: 'Il tuo commento', }, + room: { + upcoming: 'Prossime sale', + requested: 'Sale richieste', + recent: 'Sale recenti', + newRoom: 'Nuova sala' + }, + agreementText: 'Ho letto e accetto i termini dell\'Accordo con l\'utente,', + userAgreement: '', + privacyPolicy: 'Informativa sulla privacy', + readMore: 'Leggi di più', photoDesc: 'Aggiungi una foto vera: il volto di una persona è sempre più credibile.', dayStart: 'Inizio del giorno', topic: 'Argomento', @@ -37,6 +62,12 @@ export default { oldPass: 'Vecchia password', newPass: 'Nuova password', confirmPass: 'Conferma password', + forgotPass: 'Hai dimenticato la password', + resetPassText: 'Un link per reimpostare la password è stato inviato al tuo indirizzo e-mail', + or: 'o', + facebook: 'Account Facebook', + apple: 'Account Apple', + google: 'Account Google', becomeExpert: '', insertInfo: 'Inserisci i tuoi dati personali per iniziare il tuo viaggio come esperto BBuddy', changeUserData: 'I tuoi dati possono essere aggiunti o modificati in qualsiasi momento', @@ -49,11 +80,36 @@ export default { sortPriceDesc: 'Per prezzo decrescente', details: 'Dettagli', sessionLang: 'Lingua sessione', + direction: 'Direzione', fromTo: 'da $ a $', apply: 'Applica', save: 'Salva', changePass: 'Cambia password', + resetPass: 'Reimposta password', getStarted: 'Inizia', delete: 'Elimina', - today: 'Oggi' + today: 'Oggi', + back: 'Indietro', + backToExperts: 'Torna all\'elenco degli esperti', + courseInfo: 'Informazioni sul corso', + expertBackground: 'Background esperto', + profCertification: 'Certificazione professionale', + practiceHours: 'ore di pratica', + supervisionCount: 'supervisioni per anno', + outOf: 'su', + schedule: 'Programma', + signUp: 'Iscriviti ora', + noData: 'Nessun dato', + notFound: 'Non trovato', + errors: { + invalidEmail: 'L\'indirizzo e-mail non è valido', + emptyEmail: 'Inserisci l\'e-mail', + emptyPass: 'Inserisci la password', + confirmPass: 'Conferma la password', + notMatchPass: 'Le nuove password inserite non corrispondono', + emptyCancelReason: 'Inserisci il motivo', + approvingSession: 'Errore nell\'approvazione della sessione', + finishingSession: 'Errore durante la chiusura della sessione', + emptyComment: 'Inserisci il tuo commento', + }, } diff --git a/src/i18nKeys/ru.ts b/src/i18nKeys/ru.ts index 480915f..16da8a3 100644 --- a/src/i18nKeys/ru.ts +++ b/src/i18nKeys/ru.ts @@ -11,12 +11,16 @@ export default { menu: { 'bb-client': 'Начните свой рост с BB', 'bb-expert': 'Станьте экспертом BB', + home: 'Главная', blog: 'Блог и новости' }, registration: 'Регистрация', enter: 'Войти', + enterAccount: 'Войти в аккаунт', account: 'Учетная запись', logout: 'Выйти', + decline: 'Отклонить', + send: 'Отправить', deleteAcc: 'Удалить учетную запись', footer: { faq: 'Частые вопросы', @@ -25,8 +29,29 @@ export default { session: { upcoming: 'Предстоящие сессии', requested: 'Запрошенные сессии', - recent: 'Недавние сессии' + recent: 'Недавние сессии', + cancelReason: 'Введите причину отмены сессии', + reasonPlaceholder: 'Опишите причину отказа', + decline: 'Отклонить сессию', + confirm: 'Подтвердить сессию', + join: 'Присоединиться к сессии', + start: 'Начать сессию', + finish: 'Завершить сессию', + comments: 'Комментарии', + myComments: 'Мои комментарии', + addComment: 'Добавить новый', + commentPlaceholder: 'Ваш комментарий', }, + room: { + upcoming: 'Предстоящие комнаты', + requested: 'Запрошенные комнаты', + recent: 'Недавние комнаты', + newRoom: 'Новая комната' + }, + agreementText: 'Я прочитал и согласен с условиями Пользовательского соглашения,', + userAgreement: 'Пользовательского соглашения', + privacyPolicy: 'Политикой конфиденциальности', + readMore: 'Читать дальше', photoDesc: 'Добавьте реальную фотографию, ведь лицо человека всегда вызывает больше доверия.', dayStart: 'День начала', topic: 'Тема', @@ -37,6 +62,12 @@ export default { oldPass: 'Старый пароль', newPass: 'Новый пароль', confirmPass: 'Подтвердите пароль', + forgotPass: 'Забыли пароль', + resetPassText: 'Ссылка для сброса пароля была отправлена на ваш E-mail', + or: 'или', + facebook: 'Аккаунт Facebook', + apple: 'Аккаунт Apple', + google: 'Аккаунт Google', becomeExpert: '', insertInfo: 'Введите личные данные и начните свой путь эксперта BBuddy', changeUserData: 'Добавить и изменить информацию о себе можно в любое время', @@ -49,11 +80,36 @@ export default { sortPriceDesc: 'Цена по убыванию', details: 'Информация', sessionLang: 'Язык сессии', + direction: 'Направление', fromTo: 'от $ до $', apply: 'Применить', save: 'Сохранить', changePass: 'Изменить пароль', + resetPass: 'Сбросить пароль', getStarted: 'Начать работу', delete: 'Удалить', - today: 'Сегодня' + today: 'Сегодня', + back: 'Назад', + backToExperts: 'Вернуться к списку экспертов', + courseInfo: 'Информация о курсе', + expertBackground: 'Профессиональный опыт эксперта', + profCertification: 'Профессиональная сертификация', + practiceHours: 'часов практики', + supervisionCount: 'часов супервизии в год', + outOf: 'из', + schedule: 'Расписание', + signUp: 'Записаться сейчас', + noData: 'Нет данных', + notFound: 'Не найдено', + errors: { + invalidEmail: 'Адрес электронной почты недействителен', + emptyEmail: 'Пожалуйста, введите ваш E-mail', + emptyPass: 'Пожалуйста, введите ваш пароль', + confirmPass: 'Пожалуйста, подтвердите ваш пароль', + notMatchPass: 'Введенные новые пароли не совпадают', + emptyCancelReason: 'Пожалуйста, введите причину', + approvingSession: 'Ошибка при подтверждении сессии', + finishingSession: 'Ошибка при завершении сессии', + emptyComment: 'Пожалуйста, введите ваш комментарий', + }, } diff --git a/src/styles/_default.scss b/src/styles/_default.scss index 1cde301..3f7f347 100644 --- a/src/styles/_default.scss +++ b/src/styles/_default.scss @@ -70,11 +70,11 @@ a { line-height: normal; @media (min-width: 576px) { - @include rem(30); + @include rem(28); } @media (min-width: 768px) { - @include rem(42); + @include rem(40); } } @@ -309,6 +309,14 @@ a { margin-bottom: 10px; } + .title-h4 { + color: #003B46; + font-size: 1rem; + line-height: 1.5rem; + font-weight: bold; + margin-bottom: 10px; + } + .title-h3 { color: #003B46; font-size: 18px; @@ -561,6 +569,10 @@ a { font-style: normal; font-weight: 400; line-height: 160%; + + &__auto { + width: auto; + } } .btn-video { @@ -762,6 +774,8 @@ a { padding: 16px; flex-flow: wrap; display: flex; + margin-bottom: 42px; + top: 24px; &__avatar { width: 80px; @@ -815,8 +829,8 @@ a { color: $white; @include rem(13); font-style: normal; - font-weight: 500; - line-height: 123.077%; + font-weight: 300; + line-height: 120%; display: flex; flex-flow: column; gap: 8px; @@ -831,6 +845,7 @@ a { display: flex; gap: 8px; flex-flow: wrap; + align-items: center; & > span { display: block; @@ -853,7 +868,7 @@ a { } @media (min-width: 992px) { - padding: 38px 24px 38px 24px; + padding: 24px; flex-flow: nowrap; justify-content: space-between; @@ -861,7 +876,7 @@ a { width: 220px; height: 220px; position: absolute; - top: 24px; + top: -18px; left: 24px; } @@ -903,7 +918,7 @@ a { } &__info { - @include rem(18); + @include rem(15); flex-flow: nowrap; gap: 16px; i { @@ -922,6 +937,17 @@ a { } } +.expert-info { + display: flex; + gap: 16px; + align-items: center; + padding-top: 24px; + + .skills__list { + align-self: initial; + } +} + .base-text { color: #66A5AD; @include rem(13); @@ -964,7 +990,7 @@ a { flex-flow: wrap; .breadcrumb-item { - color: #6FB98F; + color: #003B46; @include rem(18); font-style: normal; font-weight: 500; @@ -985,14 +1011,6 @@ a { } } } - - @media (min-width: 768px) { - margin-bottom: 24px; - - .breadcrumb-item { - @include rem(24); - } - } } diff --git a/src/styles/_form.scss b/src/styles/_form.scss index 13da4b1..db377ea 100644 --- a/src/styles/_form.scss +++ b/src/styles/_form.scss @@ -57,6 +57,21 @@ } } +.form-fieldset { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 16px; + + .ant-form-item { + margin: 0 !important; + } +} + +.form-actions { + display: flex; + gap: 16px; +} + input { &.base-input { height: 54px; diff --git a/src/styles/_main.scss b/src/styles/_main.scss index 37e38ba..c5a0c43 100644 --- a/src/styles/_main.scss +++ b/src/styles/_main.scss @@ -6,6 +6,14 @@ max-height: 570px; position: relative; + .b-main-desc { + min-height: 440px; + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: center; + } + @media (min-width: 576px) { max-height: 600px; } @@ -110,16 +118,12 @@ text-align: center; margin-bottom: 16px; padding-top: 8px; - - @media (min-width: 768px) { - padding-top: 24px; - } + position: relative; + z-index: 1; @media (min-width: 992px) { max-width: 690px; text-align: left; - padding-top: 70px; - margin-bottom: 24px; } } @@ -148,11 +152,11 @@ line-height: 133.333%; @media (min-width: 576px) { - @include rem(16); + @include rem(15); } @media (min-width: 768px) { - @include rem(24); + @include rem(18); } @media (max-width: 1249px) { @@ -166,13 +170,14 @@ display: flex; align-items: center; gap: 16px; - margin-bottom: 24px; justify-content: center; position: relative; + margin: auto; @media (min-width: 992px) { gap: 24px; justify-content: flex-start; + margin: 0; } @media (min-width: 1200px) { @@ -321,16 +326,17 @@ .main-articles { position: relative; background: #DFF5FB; - padding-bottom: 4px; + padding-bottom: 10px; + margin-bottom: 94px; &:before { content: ""; position: absolute; background-image: url(/images/wave-top.svg); background-position: center; - height: 86px; + height: 80px; width: 100%; - top: -86px; + top: -80px; overflow: hidden; background-size: 893px 87px; diff --git a/src/styles/_pages.scss b/src/styles/_pages.scss index d3ffa48..200aea8 100644 --- a/src/styles/_pages.scss +++ b/src/styles/_pages.scss @@ -7,12 +7,8 @@ margin-bottom: 16px; } - .expert-card { - } - .title-h2 { margin-bottom: 16px; - padding-top: 16px; } .title-h3 { @@ -29,6 +25,9 @@ flex-flow: column; gap: 8px; align-items: center; + padding-bottom: 16px; + border-bottom: 1px solid #C4DFE6; + margin-bottom: 24px; &__text { color: #6FB98F; @@ -80,14 +79,6 @@ margin-bottom: 24px; } - .title-h2 { - padding-top: 24px; - } - - .expert-card { - margin-bottom: 32px; - } - .offers-list { margin-bottom: 72px; } @@ -95,7 +86,6 @@ } .b-news { - &__header { position: relative; padding-top: 24px; @@ -749,6 +739,11 @@ &__item { border-bottom: 1px solid #C4DFE6; width: 100%; + padding: 8px 0; + + &:first-child { + padding: 0 0 8px; + } &:last-child { border-bottom: none; @@ -783,13 +778,11 @@ display: flex; align-items: center; justify-content: space-between; - height: 49px; gap: 8px; - color: #003B46 !important; - @include rem(18); + @include rem(15); font-style: normal; font-weight: 600; - line-height: 133.333%; + line-height: 160%; text-decoration: none; padding-right: 32px; position: relative; @@ -809,7 +802,7 @@ &.active { - color: #66A5AD !important; + color: #003B46 !important; padding-right: 0; &:before { @@ -831,16 +824,16 @@ &__item { cursor: pointer; - height: 48px; - padding-bottom: 16px; + height: 40px; + padding: 8px 0; position: relative; display: flex; gap: 10px; justify-content: center; color: #66A5AD; - @include rem(24); + @include rem(18); font-style: normal; - font-weight: 300; + font-weight: 500; line-height: 133.333%; align-items: center; width: calc(33.33333333% - 8px); @@ -865,12 +858,12 @@ position: absolute; bottom: 0; width: 100%; - height: 8px; + height: 4px; border-radius: 8px; } &.active { - color: #6FB98F; + color: #2C7873; &:before{ background: #2C7873; } @@ -1113,6 +1106,31 @@ } } +.b-work { + display: flex; + gap: 16px; + align-items: center; + + &__text { + color: #2C7873; + @include rem(16); + font-style: normal; + font-weight: 600; + line-height: 100%; + } + + &__description { + display: flex; + flex-direction: column; + gap: 16px; + align-items: flex-start; + } + + .btn-apply { + width: auto; + } +} + .image-info { display: flex; justify-content: center; diff --git a/src/styles/view/_buttons.scss b/src/styles/view/_buttons.scss index 8f69701..dfd9b8a 100644 --- a/src/styles/view/_buttons.scss +++ b/src/styles/view/_buttons.scss @@ -6,6 +6,17 @@ height: 54px !important; box-shadow: 0px 2px 4px 0px rgba(102, 165, 173, 0.32) !important; + &_yellow { + background: #FFBD00 !important; + border-color: #FFBD00 !important; + color: #003B46 !important; + font-size: 15px !important; + border-radius: 8px !important; + height: 54px !important; + box-shadow: none !important; + padding: 4px 24px !important; + } + &.danger { background: #D93E5C !important; box-shadow: none !important; @@ -30,6 +41,11 @@ border-radius: 8px !important; height: 54px !important; + &.danger { + border-color: #D93E5C !important; + color: #D93E5C !important; + } + span { margin-inline-end: 0 !important; line-height: 15px !important; @@ -38,12 +54,12 @@ &__logout { width: 100%; - height: 49px !important; + height: 24px !important; color: #D93E5C !important; font-style: normal; font-weight: 600 !important; padding: 0 !important; - font-size: 1.125rem !important; + font-size: 15px !important; justify-content: flex-start !important; } } diff --git a/src/styles/view/_slider.scss b/src/styles/view/_slider.scss index b3de62c..9456dfa 100644 --- a/src/styles/view/_slider.scss +++ b/src/styles/view/_slider.scss @@ -32,7 +32,8 @@ &:focus, &:hover { &::after { - box-shadow: 0 0 0 12px rgba(102, 165, 173, .2) !important; + outline: none !important; + box-shadow: 0 0 0 8px rgba(102, 165, 173, .2) !important; } } } From ff74e5ba49db5916e8aba83a012e94447e15ed75 Mon Sep 17 00:00:00 2001 From: SD Date: Fri, 9 Aug 2024 12:54:33 +0400 Subject: [PATCH 8/9] feat: add experts profile --- messages/de.json | 2 +- messages/es.json | 2 +- messages/fr.json | 2 +- messages/it.json | 2 +- src/actions/helpers.ts | 39 +-- src/actions/hooks/useProfileSettings.ts | 17 +- src/actions/profile.ts | 94 +++++++- src/actions/upload.ts | 13 + .../add-offer/page.tsx | 4 +- .../new-topic/page.tsx | 2 +- .../account/(account)/expert-profile/page.tsx | 66 +++++ .../account/(account)/settings/page.tsx | 8 - .../(account)/work-with-us/coaching/page.tsx | 133 ---------- .../account/(account)/work-with-us/page.tsx | 25 -- src/app/loading.tsx | 2 +- src/components/Account/ProfileSettings.tsx | 227 +++++++++++------- .../sessions/SessionDetailsContent.tsx | 2 +- .../ExpertProfile/EmptyExpertProfile.tsx | 19 ++ .../ExpertProfile/ExpertProfile.tsx | 98 ++++++++ src/components/ExpertProfile/MyOffers.tsx | 34 +++ .../ExpertProfile/content/ExpertEducation.tsx | 65 +++++ .../ExpertProfile/content/ExpertPayData.tsx | 28 +++ .../ExpertProfile/content/ExpertSchedule.tsx | 28 +++ .../ExpertProfile/content/ExpertTags.tsx | 47 ++++ src/components/ExpertProfile/index.ts | 5 + src/components/Experts/ExpertDetails.tsx | 2 +- src/components/Modals/EditExpertTagsModal.tsx | 114 +++++++++ src/i18nKeys/de.ts | 16 +- src/i18nKeys/en.ts | 15 +- src/i18nKeys/es.ts | 20 +- src/i18nKeys/fr.ts | 18 +- src/i18nKeys/it.ts | 20 +- src/i18nKeys/ru.ts | 20 +- src/lib/apiClient.ts | 5 +- src/styles/_default.scss | 15 ++ src/styles/_modal.scss | 49 ++++ src/styles/_pages.scss | 67 +++++- src/types/education.ts | 44 ++++ src/types/experts.ts | 46 +--- src/types/file.ts | 12 + src/types/practice.ts | 29 +++ src/types/profile.ts | 40 ++- src/types/schedule.ts | 10 + src/types/tags.ts | 15 ++ src/utils/account.ts | 18 +- 45 files changed, 1175 insertions(+), 364 deletions(-) create mode 100644 src/actions/upload.ts rename src/app/[locale]/account/(account)/{work-with-us/coaching => expert-profile}/add-offer/page.tsx (97%) rename src/app/[locale]/account/(account)/{work-with-us => expert-profile}/new-topic/page.tsx (97%) create mode 100644 src/app/[locale]/account/(account)/expert-profile/page.tsx delete mode 100644 src/app/[locale]/account/(account)/work-with-us/coaching/page.tsx delete mode 100644 src/app/[locale]/account/(account)/work-with-us/page.tsx create mode 100644 src/components/ExpertProfile/EmptyExpertProfile.tsx create mode 100644 src/components/ExpertProfile/ExpertProfile.tsx create mode 100644 src/components/ExpertProfile/MyOffers.tsx create mode 100644 src/components/ExpertProfile/content/ExpertEducation.tsx create mode 100644 src/components/ExpertProfile/content/ExpertPayData.tsx create mode 100644 src/components/ExpertProfile/content/ExpertSchedule.tsx create mode 100644 src/components/ExpertProfile/content/ExpertTags.tsx create mode 100644 src/components/ExpertProfile/index.ts create mode 100644 src/components/Modals/EditExpertTagsModal.tsx create mode 100644 src/types/education.ts create mode 100644 src/types/file.ts create mode 100644 src/types/practice.ts create mode 100644 src/types/schedule.ts diff --git a/messages/de.json b/messages/de.json index 14d749a..27ce487 100644 --- a/messages/de.json +++ b/messages/de.json @@ -79,7 +79,7 @@ } }, "Experts": { - "title": "Find an expert", + "title": "Einen Experten finden", "filter": { "price": "Price from {from}€ to {to}€", "duration": "Duration from {from}min to {to}min", diff --git a/messages/es.json b/messages/es.json index 0342887..3f7470b 100644 --- a/messages/es.json +++ b/messages/es.json @@ -79,7 +79,7 @@ } }, "Experts": { - "title": "Find an expert", + "title": "Encontrar un experto", "filter": { "price": "Price from {from}€ to {to}€", "duration": "Duration from {from}min to {to}min", diff --git a/messages/fr.json b/messages/fr.json index 48b42e3..bad196d 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -79,7 +79,7 @@ } }, "Experts": { - "title": "Find an expert", + "title": "Trouver un expert", "filter": { "price": "Price from {from}€ to {to}€", "duration": "Duration from {from}min to {to}min", diff --git a/messages/it.json b/messages/it.json index 379adca..0874d7a 100644 --- a/messages/it.json +++ b/messages/it.json @@ -79,7 +79,7 @@ } }, "Experts": { - "title": "Find an expert", + "title": "Trova un esperto", "filter": { "price": "Price from {from}€ to {to}€", "duration": "Duration from {from}min to {to}min", diff --git a/src/actions/helpers.ts b/src/actions/helpers.ts index d3841c5..6522b69 100644 --- a/src/actions/helpers.ts +++ b/src/actions/helpers.ts @@ -2,7 +2,7 @@ import { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'; import { apiClient } from '../lib/apiClient'; type RequiredConfigParams = Required> & Pick, 'data'>; -export type PageRequestConfig = RequiredConfigParams & { locale?: string, token?: string }; +export type PageRequestConfig = RequiredConfigParams & Partial> & { locale?: string, token?: string }; export const apiRequest = async ( baseParams: PageRequestConfig, @@ -15,29 +15,30 @@ export const apiRequest = async ( headers: { 'X-User-Language': baseParams?.locale || 'en', 'X-Referrer-Channel': 'site', - ...(baseParams?.token ? { Authorization: `Bearer ${baseParams.token}` } : {}) + ...(baseParams?.token ? { Authorization: `Bearer ${baseParams.token}` } : {}), + ...(baseParams.headers || {}) } }; const response: AxiosResponse = await apiClient.request, T>(config as AxiosRequestConfig); return response.data; } catch (err) { - const { - response: { - status: responseCode = null, - statusText = '', - data: { message = '', status: errorKey = '' } = {}, - } = {}, - code: statusCode = '', - } = err as AxiosError; - - throw new Error( - JSON.stringify({ - statusCode, - statusMessage: message || statusText, - responseCode, - errorKey, - }), - ); + // const { + // response: { + // status: responseCode = null, + // statusText = '', + // data: { message = '', status: errorKey = '' } = {}, + // } = {}, + // code: statusCode = '', + // } = err as AxiosError; + // + // throw new Error( + // JSON.stringify({ + // statusCode, + // statusMessage: message || statusText, + // responseCode, + // errorKey, + // }), + // ); } }; diff --git a/src/actions/hooks/useProfileSettings.ts b/src/actions/hooks/useProfileSettings.ts index 58b02e8..bff3878 100644 --- a/src/actions/hooks/useProfileSettings.ts +++ b/src/actions/hooks/useProfileSettings.ts @@ -1,18 +1,17 @@ 'use client' import { useCallback, useEffect, useState } from 'react'; -import { Profile } from '../../types/profile'; -import { getPersonalData } from '../profile'; +import { ProfileData, ProfileRequest } from '../../types/profile'; +import { getPersonalData, setPersonData } from '../profile'; import { useLocalStorage } from '../../hooks/useLocalStorage'; import { AUTH_TOKEN_KEY } from '../../constants/common'; export const useProfileSettings = (locale: string) => { const [jwt] = useLocalStorage(AUTH_TOKEN_KEY, ''); - const [profileSettings, setProfileSettings] = useState(); + const [profileSettings, setProfileSettings] = useState(); const [fetchLoading, setFetchLoading] = useState(false); - const [saveLoading, setSaveLoading] = useState(false); - useEffect(() => { + const fetchProfileSettings = () => { if (jwt) { getPersonalData(locale, jwt) .then((data) => { @@ -25,16 +24,14 @@ export const useProfileSettings = (locale: string) => { setFetchLoading(false); }); } - }, []); + }; - const save = useCallback(() => { - - }, []); + const save = useCallback((data: ProfileRequest) => setPersonData(data, locale, jwt), []); return { fetchLoading, + fetchProfileSettings, save, - saveLoading, profileSettings }; }; diff --git a/src/actions/profile.ts b/src/actions/profile.ts index d2c9d96..5d517ef 100644 --- a/src/actions/profile.ts +++ b/src/actions/profile.ts @@ -1,7 +1,25 @@ -import { Profile } from '../types/profile'; +import { PayInfo, Profile, ProfileRequest, ProfileData } from '../types/profile'; +import { ExpertsTags } from '../types/tags'; +import { EducationData, EducationDTO } from '../types/education'; +import { PracticeData, PracticeDTO } from '../types/practice'; +import { ScheduleDTO } from '../types/schedule'; import { apiRequest } from './helpers'; -export const setPersonData = (data: { login: string, password: string, role: string, languagesLinks: any[] }, locale: string, token: string): Promise<{ userData: Profile }> => apiRequest({ +export const getUserData = (locale: string, token: string): Promise => apiRequest({ + url: '/home/userdata', + method: 'post', + locale, + token +}); + +export const getPersonalData = (locale: string, token: string): Promise => apiRequest({ + url: '/home/person1', + method: 'post', + locale, + token +}); + +export const setPersonData = (data: ProfileRequest, locale: string, token: string): Promise<{ userData: Profile }> => apiRequest({ url: '/home/applyperson1', method: 'post', data, @@ -9,9 +27,77 @@ export const setPersonData = (data: { login: string, password: string, role: str token }); -export const getPersonalData = (locale: string, token: string): Promise => apiRequest({ - url: '/home/userdata', +export const getEducation = (locale: string, token: string): Promise => apiRequest({ + url: '/home/person2', method: 'post', locale, token }); + +export const setEducation = (locale: string, token: string, data: EducationData): Promise => apiRequest({ + url: '/home/applyperson2', + method: 'post', + data, + locale, + token +}); + +export const getTags = (locale: string, token: string): Promise => apiRequest({ + url: '/home/person3', + method: 'post', + locale, + token +}); + +export const setTags = (locale: string, token: string, data: ExpertsTags): Promise => apiRequest({ + url: '/home/applyperson3', + method: 'post', + data, + locale, + token +}); + +export const getPractice = (locale: string, token: string): Promise => apiRequest({ + url: '/home/person4', + method: 'post', + locale, + token +}); + +export const setPractice = (locale: string, token: string, data: PracticeData): Promise => apiRequest({ + url: '/home/applyperson4', + method: 'post', + data, + locale, + token +}); + +export const getSchedule = (locale: string, token: string): Promise => apiRequest({ + url: '/home/person51', + method: 'post', + locale, + token +}); + +export const setSchedule = (locale: string, token: string, data: ScheduleDTO): Promise => apiRequest({ + url: '/home/applyperson51', + method: 'post', + data, + locale, + token +}); + +export const getPayData = (locale: string, token: string): Promise<{ person6Data?: PayInfo }> => apiRequest({ + url: '/home/person6', + method: 'post', + locale, + token +}); + +export const setPayData = (locale: string, token: string, data: PayInfo): Promise => apiRequest({ + url: '/home/applyperson6', + method: 'post', + data, + locale, + token +}); diff --git a/src/actions/upload.ts b/src/actions/upload.ts new file mode 100644 index 0000000..f41ef95 --- /dev/null +++ b/src/actions/upload.ts @@ -0,0 +1,13 @@ +import { ExpertDocument } from '../types/file'; +import { apiRequest } from './helpers'; + +export const setUploadFile = (locale: string, token: string, data: any): Promise => apiRequest({ + url: '/home/uploadfile', + method: 'post', + data, + locale, + token, + headers: { + 'Content-Type': 'multipart/form-data' + } +}); diff --git a/src/app/[locale]/account/(account)/work-with-us/coaching/add-offer/page.tsx b/src/app/[locale]/account/(account)/expert-profile/add-offer/page.tsx similarity index 97% rename from src/app/[locale]/account/(account)/work-with-us/coaching/add-offer/page.tsx rename to src/app/[locale]/account/(account)/expert-profile/add-offer/page.tsx index 04ec673..e669b63 100644 --- a/src/app/[locale]/account/(account)/work-with-us/coaching/add-offer/page.tsx +++ b/src/app/[locale]/account/(account)/expert-profile/add-offer/page.tsx @@ -7,12 +7,12 @@ export default function AddOffer() { <>
      1. - + Work With Us
      2. - + Coaching
      3. diff --git a/src/app/[locale]/account/(account)/work-with-us/new-topic/page.tsx b/src/app/[locale]/account/(account)/expert-profile/new-topic/page.tsx similarity index 97% rename from src/app/[locale]/account/(account)/work-with-us/new-topic/page.tsx rename to src/app/[locale]/account/(account)/expert-profile/new-topic/page.tsx index a7b33ed..f8b6774 100644 --- a/src/app/[locale]/account/(account)/work-with-us/new-topic/page.tsx +++ b/src/app/[locale]/account/(account)/expert-profile/new-topic/page.tsx @@ -7,7 +7,7 @@ export default function NewTopic() { <>
        1. - + Work With Us
        2. diff --git a/src/app/[locale]/account/(account)/expert-profile/page.tsx b/src/app/[locale]/account/(account)/expert-profile/page.tsx new file mode 100644 index 0000000..c9cd00d --- /dev/null +++ b/src/app/[locale]/account/(account)/expert-profile/page.tsx @@ -0,0 +1,66 @@ +'use client' + +import { useEffect, useState } from 'react'; +import { message } from 'antd'; +// import { unstable_setRequestLocale } from 'next-intl/server'; +import { ExpertData } from '../../../../../types/profile'; +import { AUTH_TOKEN_KEY } from '../../../../../constants/common'; +import { useLocalStorage } from '../../../../../hooks/useLocalStorage'; +import { getEducation, getPersonalData, getTags, getPractice, getSchedule, getPayData } from '../../../../../actions/profile'; +import { ExpertProfile } from '../../../../../components/ExpertProfile'; +import { Loader } from '../../../../../components/view/Loader'; + +export default function ExpertProfilePage({ params: { locale } }: { params: { locale: string } }) { + // unstable_setRequestLocale(locale); + const [jwt] = useLocalStorage(AUTH_TOKEN_KEY, ''); + const [loading, setLoading] = useState(false); + const [data, setData] = useState(); + + useEffect(() => { + if (jwt) { + setLoading(true); + Promise.all([ + getPersonalData(locale, jwt), + getEducation(locale, jwt), + getTags(locale, jwt), + getPractice(locale, jwt), + getSchedule(locale, jwt), + getPayData(locale, jwt) + ]) + .then(([person, education, tags, practice, schedule, payData]) => { + console.log('person', person); + console.log('education', education); + console.log('tags', tags); + console.log('practice', practice); + console.log('schedule', schedule); + console.log('payData', payData); + setData({ + person, + education, + tags, + practice, + schedule, + payData + }); + }) + .catch(() => { + message.error('Не удалось загрузить данные эксперта'); + }) + .finally(() => { + setLoading(false); + }) + } + }, [jwt]); + + return ( + + {data && ( + + )} + + ); +}; diff --git a/src/app/[locale]/account/(account)/settings/page.tsx b/src/app/[locale]/account/(account)/settings/page.tsx index 87504f3..984d596 100644 --- a/src/app/[locale]/account/(account)/settings/page.tsx +++ b/src/app/[locale]/account/(account)/settings/page.tsx @@ -1,18 +1,10 @@ import React, { Suspense } from 'react'; -import type { Metadata } from 'next'; import { unstable_setRequestLocale } from 'next-intl/server'; -import { useTranslations } from 'next-intl'; import { ProfileSettings } from '../../../../../components/Account'; import { i18nText } from '../../../../../i18nKeys'; -export const metadata: Metadata = { - title: 'Bbuddy - Account - Profile Settings', - description: 'Bbuddy desc Profile settings' -}; - export default function Settings({ params: { locale } }: { params: { locale: string } }) { unstable_setRequestLocale(locale); - const t = useTranslations('Account.Settings'); return ( <> diff --git a/src/app/[locale]/account/(account)/work-with-us/coaching/page.tsx b/src/app/[locale]/account/(account)/work-with-us/coaching/page.tsx deleted file mode 100644 index 2b00727..0000000 --- a/src/app/[locale]/account/(account)/work-with-us/coaching/page.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import React from 'react'; -import { unstable_setRequestLocale } from 'next-intl/server'; -import { Link } from '../../../../../../navigation'; -import { i18nText } from '../../../../../../i18nKeys'; - -export default function Coaching({ params: { locale } }: { params: { locale: string } }) { - unstable_setRequestLocale(locale); - - return ( - <> -
            -
          1. - - Work With Us - -
          2. -
          3. Coaching
          4. -
          -
          -
          -
          -
          - -
          -
          -
          - David -
          -
          - 12 Practice hours -
          -
          - 15 Supervision per year -
          -
          -
          -
          -
          - Edit - Add Offer -
          -
          -
          -

          - My Offers -

          -
          -
          -
          -
          - Senior Software Engineer -
          -
          - Edit - Remove -
          -
          -
          - 45$ / 45min -
          -
          -
          Engineering & Data
          -
          Engineering & Data
          -
          +6
          -
          -
          - I have worked across a variety of organizations, lead teams, and delivered quality software - for 8 years. In that time I've worked as an independent consultant, at agencies as a team - lead, and as a senior engineer at Auth0. I also host a podcast - https://anchor.fm/work-in-programming where I break down how … -
          -
          -
          -
          -
          -

          - About Coach -

          -
          - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra - malesuada, ligula sem tempor risus, non posuere urna diam a libero. -
          -
          - -
          -

          - Education -

          -
          -

          Psychologist

          -
          - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra - malesuada, ligula sem tempor risus, non posuere urna diam a libero. -
          -
          - -
          -
          -
          -
          -

          {i18nText('profCertification', locale)}

          -
          -
          - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra - malesuada, ligula sem tempor risus, non posuere urna diam a libero. -
          -
          -
          -
          -

          - Trainings | Seminars | Courses -

          -
          -
          - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra - malesuada, ligula sem tempor risus, non posuere urna diam a libero. -
          -
          -
          -
          -

          - MBA Information -

          -
          -
          - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra - malesuada, ligula sem tempor risus, non posuere urna diam a libero. -
          -
          -
          - - ); -} diff --git a/src/app/[locale]/account/(account)/work-with-us/page.tsx b/src/app/[locale]/account/(account)/work-with-us/page.tsx deleted file mode 100644 index 465b5a0..0000000 --- a/src/app/[locale]/account/(account)/work-with-us/page.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import { unstable_setRequestLocale } from 'next-intl/server'; -import { i18nText } from '../../../../../i18nKeys'; - -export default function WorkWithUs({ params: { locale } }: { params: { locale: string } }) { - unstable_setRequestLocale(locale); - - return ( - <> -
            -
          1. {i18nText('accountMenu.work-with-us', locale)}
          2. -
          -
          -
          - -
          -
          -
          {i18nText('insertInfo', locale)}
          -
          {i18nText('changeUserData', locale)}
          - -
          -
          - - ); -} diff --git a/src/app/loading.tsx b/src/app/loading.tsx index b64006d..937170a 100644 --- a/src/app/loading.tsx +++ b/src/app/loading.tsx @@ -6,4 +6,4 @@ export default function Loading() { ...loading
    ); -} +}; diff --git a/src/components/Account/ProfileSettings.tsx b/src/components/Account/ProfileSettings.tsx index 0d6c4a4..674ae2c 100644 --- a/src/components/Account/ProfileSettings.tsx +++ b/src/components/Account/ProfileSettings.tsx @@ -1,125 +1,190 @@ 'use client'; import React, { FC, useEffect, useState } from 'react'; -import { Form, Upload } from 'antd'; -import type { UploadFile, UploadProps } from 'antd'; +import { Button, Form, message, Upload } from 'antd'; +import type { GetProp, UploadFile, UploadProps } from 'antd'; import ImgCrop from 'antd-img-crop'; import { CameraOutlined, DeleteOutlined } from '@ant-design/icons'; import { useRouter } from '../../navigation'; import { i18nText } from '../../i18nKeys'; -import { Profile } from '../../types/profile'; +import { ProfileRequest } from '../../types/profile'; +import { validateImage } from '../../utils/account'; import { useProfileSettings } from '../../actions/hooks/useProfileSettings'; import { CustomInput } from '../view/CustomInput'; import { OutlinedButton } from '../view/OutlinedButton'; import { FilledYellowButton } from '../view/FilledButton'; -import { DeleteAccountModal } from "../Modals/DeleteAccountModal"; +import { DeleteAccountModal } from '../Modals/DeleteAccountModal'; +import { Loader } from '../view/Loader'; type ProfileSettingsProps = { locale: string; }; -// type FileType = Parameters>[0]; +type FileType = Parameters>[0]; export const ProfileSettings: FC = ({ locale }) => { - const [form] = Form.useForm(); - const { profileSettings } = useProfileSettings(locale); + const [form] = Form.useForm(); + const { profileSettings, fetchProfileSettings, save, fetchLoading } = useProfileSettings(locale); const [showDeleteModal, setShowDeleteModal] = useState(false); + const [saveLoading, setSaveLoading] = useState(false); + const [photo, setPhoto] = useState(); const router = useRouter(); + useEffect(() => { + fetchProfileSettings() + }, []); + useEffect(() => { if (profileSettings) { form.setFieldsValue(profileSettings); } }, [profileSettings]); - const saveProfileSettings = () => { + const onSaveProfile = () => { form.validateFields() - .then(() => { - console.log('success') + .then(({ login, surname, username }) => { + const { phone, role, languagesLinks } = profileSettings; + const newProfile: ProfileRequest = { + phone, + role, + login, + surname, + username, + isPasswordKeepExisting: true, + isFaceImageKeepExisting: true, + languagesLinks: languagesLinks?.map(({ languageId }) => ({ languageId })) || [] + }; + + // if (photo) { + // console.log(photo); + // const formData = new FormData(); + // formData.append('file', photo as FileType); + // + // newProfile.faceImage = photo; + // newProfile.isFaceImageKeepExisting = false; + // } + + console.log(newProfile); + + setSaveLoading(true); + save(newProfile) + .then(() => { + fetchProfileSettings(); + }) + .catch(() => { + message.error('Не удалось сохранить изменения'); + }) + .finally(() => { + setSaveLoading(false); + }) }) } - const [fileList, setFileList] = useState(); + const beforeCrop = (file: UploadFile) => { + return validateImage(file, true); + } - const onChange: UploadProps['onChange'] = ({ fileList: newFileList }) => { - setFileList(newFileList); - }; + const beforeUpload = (file: UploadFile) => { + const isValid = validateImage(file); - const onPreview = async (file: UploadFile) => { - // let src = file.url as string; - // if (!src) { - // src = await new Promise((resolve) => { - // const reader = new FileReader(); - // reader.readAsDataURL(file.originFileObj as FileType); - // reader.onload = () => resolve(reader.result as string); - // }); - // } - // const image = new Image(); - // image.src = src; - // const imgWindow = window.open(src); - // imgWindow?.document.write(image.outerHTML); - }; + if (isValid) { + setPhoto(file); + } + + return false; + } const onDeleteAccount = () => setShowDeleteModal(true); return ( -
    -
    -
    - -
    - {/* - - - - */} -
    -
    - - + + {photo && } + + + +
    +
    + + + +
    +
    + + + +
    + {/*
    + + +
    */} +
    + + + +
    -
    - - - +
    + + {i18nText('save', locale)} + + router.push('change-password')}> + {i18nText('changePass', locale)} + + } + danger + > + {i18nText('deleteAcc', locale)} +
    - {/*
    - - - -
    */} -
    - - - -
    -
    -
    - {i18nText('save', locale)} - router.push('change-password')}> - {i18nText('changePass', locale)} - - } - danger - > - {i18nText('deleteAcc', locale)} - -
    - setShowDeleteModal(false)} - /> - + setShowDeleteModal(false)} + /> + + ); }; diff --git a/src/components/Account/sessions/SessionDetailsContent.tsx b/src/components/Account/sessions/SessionDetailsContent.tsx index f714917..f32622e 100644 --- a/src/components/Account/sessions/SessionDetailsContent.tsx +++ b/src/components/Account/sessions/SessionDetailsContent.tsx @@ -283,7 +283,7 @@ export const SessionDetailsContent = ({ session, locale, activeType, startSessio ))} {(isCoach ? session?.clientComments : session?.coachComments)?.length > 0 && (
    - {isCoach ? 'Client Comments' : 'Coach Comments'} + {isCoach ? i18nText('session.clientComments', locale) : i18nText('session.coachComments', locale)}
    )} {(isCoach ? session?.clientComments : session?.coachComments)?.map(({ id , comment }) => ( diff --git a/src/components/ExpertProfile/EmptyExpertProfile.tsx b/src/components/ExpertProfile/EmptyExpertProfile.tsx new file mode 100644 index 0000000..aaa7fcf --- /dev/null +++ b/src/components/ExpertProfile/EmptyExpertProfile.tsx @@ -0,0 +1,19 @@ +import { i18nText } from '../../i18nKeys'; + +export const EmptyExpertProfile = ({ locale }: { locale: string }) => ( + <> +
      +
    1. {i18nText('accountMenu.expert-profile', locale)}
    2. +
    +
    +
    + +
    +
    +
    {i18nText('insertInfo', locale)}
    +
    {i18nText('changeUserData', locale)}
    + +
    +
    + +); diff --git a/src/components/ExpertProfile/ExpertProfile.tsx b/src/components/ExpertProfile/ExpertProfile.tsx new file mode 100644 index 0000000..669bf77 --- /dev/null +++ b/src/components/ExpertProfile/ExpertProfile.tsx @@ -0,0 +1,98 @@ +'use client' + +import { useState } from 'react'; +import { message } from 'antd'; +import { EditOutlined } from '@ant-design/icons'; +import { i18nText } from '../../i18nKeys'; +import { ExpertData } from '../../types/profile'; +import { AUTH_TOKEN_KEY } from '../../constants/common'; +import { useLocalStorage } from '../../hooks/useLocalStorage'; +import { getTags } from '../../actions/profile'; +import { Loader } from '../view/Loader'; +import { LinkButton } from '../view/LinkButton'; +import { ExpertTags } from './content/ExpertTags'; +import { ExpertSchedule } from './content/ExpertSchedule'; +import { ExpertPayData } from './content/ExpertPayData'; +import { ExpertEducation } from './content/ExpertEducation'; + +type ExpertProfileProps = { + locale: string; + data: ExpertData; + updateData: (data: ExpertData) => void; +}; + +export const ExpertProfile = ({ locale, data, updateData }: ExpertProfileProps) => { + const [jwt] = useLocalStorage(AUTH_TOKEN_KEY, ''); + const [loading, setLoading] = useState<(keyof ExpertData)[]>([]); + + const updateExpert = (key: keyof ExpertData) => { + switch (key) { + case 'tags': + setLoading([key]); + getTags(locale, jwt) + .then((tags) => { + updateData({ + ...data, + tags + }); + }) + .catch(() => message.error('Не удалось обновить направления')) + .finally(() => setLoading([])); + break; + default: + break; + } + }; + + return ( + <> +
      +
    1. {i18nText('coaching', locale)}
    2. +
    +
    +
    +
    + +
    +
    +
    + David +
    +
    +
    +
    +
    +
    +

    {i18nText('aboutCoach', locale)}

    +

    person1 + person4

    + } + /> +
    +
    + {`12 ${i18nText('practiceHours', locale)}`} +
    +
    + {`15 ${i18nText('supervisionCount', locale)}`} +
    +
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra + malesuada, ligula sem tempor risus, non posuere urna diam a libero. +
    +
    +
    + + + + + + +
    + + ) +}; diff --git a/src/components/ExpertProfile/MyOffers.tsx b/src/components/ExpertProfile/MyOffers.tsx new file mode 100644 index 0000000..7a3111c --- /dev/null +++ b/src/components/ExpertProfile/MyOffers.tsx @@ -0,0 +1,34 @@ +export const MyOffers = () => ( +
    +

    + My Offers +

    +
    +
    +
    +
    + Senior Software Engineer +
    +
    + Edit + Remove +
    +
    +
    + 45$ / 45min +
    +
    +
    Engineering & Data
    +
    Engineering & Data
    +
    +6
    +
    +
    + I have worked across a variety of organizations, lead teams, and delivered quality software + for 8 years. In that time I've worked as an independent consultant, at agencies as a team + lead, and as a senior engineer at Auth0. I also host a podcast + https://anchor.fm/work-in-programming where I break down how … +
    +
    +
    +
    +); diff --git a/src/components/ExpertProfile/content/ExpertEducation.tsx b/src/components/ExpertProfile/content/ExpertEducation.tsx new file mode 100644 index 0000000..8ddc1e6 --- /dev/null +++ b/src/components/ExpertProfile/content/ExpertEducation.tsx @@ -0,0 +1,65 @@ +import { EditOutlined } from '@ant-design/icons'; +import { EducationDTO } from '../../../types/education'; +import { i18nText } from '../../../i18nKeys'; +import { LinkButton } from '../../view/LinkButton'; + +type ExpertEducationProps = { + locale: string; + data?: EducationDTO; +}; + +export const ExpertEducation = ({ locale, data }: ExpertEducationProps) => { + return ( +
    +
    +
    +

    {i18nText('education', locale)}

    +

    person2

    + } + /> +
    +
    +

    Psychologist

    +
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra + malesuada, ligula sem tempor risus, non posuere urna diam a libero. +
    +
    + +
    +
    +
    +
    +

    {i18nText('profCertification', locale)}

    +
    +
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra + malesuada, ligula sem tempor risus, non posuere urna diam a libero. +
    +
    +
    +
    +

    + {`${i18nText('trainings', locale)} | ${i18nText('seminars', locale)} | ${i18nText('courses', locale)}`} +

    +
    +
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra + malesuada, ligula sem tempor risus, non posuere urna diam a libero. +
    +
    +
    +
    +

    {i18nText('mba', locale)}

    +
    +
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra + malesuada, ligula sem tempor risus, non posuere urna diam a libero. +
    +
    +
    +
    + ); +}; diff --git a/src/components/ExpertProfile/content/ExpertPayData.tsx b/src/components/ExpertProfile/content/ExpertPayData.tsx new file mode 100644 index 0000000..648aed2 --- /dev/null +++ b/src/components/ExpertProfile/content/ExpertPayData.tsx @@ -0,0 +1,28 @@ +import { EditOutlined } from '@ant-design/icons'; +import { i18nText } from '../../../i18nKeys'; +import { PayInfo } from '../../../types/profile'; +import { LinkButton } from '../../view/LinkButton'; + +type ExpertPayDataProps = { + locale: string; + data?: PayInfo +}; + +export const ExpertPayData = ({ locale, data }: ExpertPayDataProps) => { + return ( +
    +
    +
    +

    Card data - person6

    + } + /> +
    +
    + Card +
    +
    +
    + ); +}; diff --git a/src/components/ExpertProfile/content/ExpertSchedule.tsx b/src/components/ExpertProfile/content/ExpertSchedule.tsx new file mode 100644 index 0000000..907aa22 --- /dev/null +++ b/src/components/ExpertProfile/content/ExpertSchedule.tsx @@ -0,0 +1,28 @@ +import { EditOutlined } from '@ant-design/icons'; +import { ScheduleDTO } from '../../../types/schedule'; +import { i18nText } from '../../../i18nKeys'; +import { LinkButton } from '../../view/LinkButton'; + +type ExpertScheduleProps = { + locale: string; + data?: ScheduleDTO; +}; + +export const ExpertSchedule = ({ locale, data }: ExpertScheduleProps) => { + return ( +
    +
    +
    +

    Schedule - person51

    + } + /> +
    +
    + Schedule +
    +
    +
    + ); +}; diff --git a/src/components/ExpertProfile/content/ExpertTags.tsx b/src/components/ExpertProfile/content/ExpertTags.tsx new file mode 100644 index 0000000..7441bed --- /dev/null +++ b/src/components/ExpertProfile/content/ExpertTags.tsx @@ -0,0 +1,47 @@ +'use client' + +import { useState } from 'react'; +import { Tag } from 'antd'; +import { EditOutlined } from '@ant-design/icons'; +import { i18nText } from '../../../i18nKeys'; +import { ExpertsTags } from '../../../types/tags'; +import { ExpertData } from '../../../types/profile'; +import { LinkButton } from '../../view/LinkButton'; +import { EditExpertTagsModal } from '../../Modals/EditExpertTagsModal'; + +type ExpertTagsProps = { + locale: string; + data?: ExpertsTags; + updateExpert: (key: keyof ExpertData) => void; +} + +export const ExpertTags = ({ locale, data, updateExpert }: ExpertTagsProps) => { + const [showEdit, setShowEdit] = useState(false); + + return ( +
    +
    +
    +

    {i18nText('direction', locale)}

    + } + onClick={() => setShowEdit(true)} + /> +
    +
    + {data?.themesTags && data.themesTags?.length > 0 && data.themesTags + .filter(({ isActive, isSelected }) => isActive && isSelected) + .map(({ id, name }) => {name})} +
    +
    + setShowEdit(false)} + refresh={() => updateExpert('tags')} + /> +
    + ); +}; diff --git a/src/components/ExpertProfile/index.ts b/src/components/ExpertProfile/index.ts new file mode 100644 index 0000000..0fc5003 --- /dev/null +++ b/src/components/ExpertProfile/index.ts @@ -0,0 +1,5 @@ +'use client' + +export * from './EmptyExpertProfile'; +export * from './ExpertProfile'; +export * from './MyOffers'; diff --git a/src/components/Experts/ExpertDetails.tsx b/src/components/Experts/ExpertDetails.tsx index 4398016..e2c942c 100644 --- a/src/components/Experts/ExpertDetails.tsx +++ b/src/components/Experts/ExpertDetails.tsx @@ -98,7 +98,7 @@ export const ExpertPractice: FC = ({ expert, locale }) => { return practiceCases?.length > 0 ? (
    -

    Successful Cases From Practice

    +

    {i18nText('successfulCase', locale)}

    {practiceCases?.map(({ id, description, themesGroupIds }) => { const filtered = themesGroups?.filter(({ id }) => themesGroupIds?.includes(+id)); diff --git a/src/components/Modals/EditExpertTagsModal.tsx b/src/components/Modals/EditExpertTagsModal.tsx new file mode 100644 index 0000000..9b1677a --- /dev/null +++ b/src/components/Modals/EditExpertTagsModal.tsx @@ -0,0 +1,114 @@ +'use client'; + +import React, {FC, useCallback, useEffect, useState} from 'react'; +import { Modal, Button, List, message } from 'antd'; +import { CloseOutlined } from '@ant-design/icons'; +import { i18nText } from '../../i18nKeys'; +import { useLocalStorage } from '../../hooks/useLocalStorage'; +import { AUTH_TOKEN_KEY } from '../../constants/common'; +import { ExpertsTags, Tag } from '../../types/tags'; +import { CustomSwitch } from '../view/CustomSwitch'; +import { setTags } from '../../actions/profile'; + +type EditExpertTagsModalProps = { + open: boolean; + handleCancel: () => void; + locale: string; + data?: ExpertsTags; + refresh: () => void; +}; + +export const EditExpertTagsModal: FC = ({ + open, + handleCancel, + locale, + data, + refresh +}) => { + const [jwt] = useLocalStorage(AUTH_TOKEN_KEY, ''); + const [loading, setLoading] = useState(false); + const [expertTags, setExpertTags] = useState([]); + + useEffect(() => { + setExpertTags(data?.themesTags || []); + }, [data]); + + const onSaveTags = () => { + setLoading(true); + setTags(locale, jwt, { themesGroups: data?.themesGroups, themesTags: expertTags }) + .then(() => { + handleCancel(); + refresh(); + }) + .catch(() => { + message.error('Не удалось сохранить направления'); + }) + .finally(() => { + setLoading(false); + }) + }; + + const updateTag = useCallback((id: number, isSelected: boolean) => { + setExpertTags(expertTags.map((tag) => { + if (tag.id === id) { + tag.isSelected = isSelected; + } + return tag; + })) + }, [expertTags, setExpertTags]); + + return ( + } + > +
    +
    {i18nText('direction', locale)}
    +
    + {data?.themesGroups && data.themesGroups.filter(({ isActive }) => isActive).map(({ id, name }) => ( +
    +

    {name}

    + {expertTags?.length > 0 ? ( +
    + (isActive && groupId == id)) || []} + split={false} + style={{ width: '100%' }} + renderItem={({ id, name, isSelected }) => ( + +
    +
    {name}
    + updateTag(id, checked)} + /> +
    +
    + )} + /> +
    + ) :
    No tags
    } +
    + ))} +
    +
    + +
    +
    +
    + ); +}; diff --git a/src/i18nKeys/de.ts b/src/i18nKeys/de.ts index 21bb176..f27812b 100644 --- a/src/i18nKeys/de.ts +++ b/src/i18nKeys/de.ts @@ -4,9 +4,9 @@ export default { notifications: 'Benachrichtigung', support: 'Hilfe & Support', information: 'Rechtliche Informationen', - settings: 'Profileinstellungen', + settings: 'Kontoeinstellungen', messages: 'Nachrichten', - 'work-with-us': 'Arbeite mit uns' + 'expert-profile': 'Expertenprofil' }, menu: { 'bb-client': 'Mit BB wachsen', @@ -41,6 +41,8 @@ export default { myComments: 'Meine Kommentare', addComment: 'Neuen Kommentar hinzufügen', commentPlaceholder: 'Ihr Kommentar', + clientComments: 'Kundenkommentare', + coachComments: 'Trainerkommentare' }, room: { upcoming: 'Zukünftige Räume', @@ -84,6 +86,7 @@ export default { fromTo: 'von $ bis $', apply: 'Anwenden', save: 'Speichern', + edit: 'Bearbeiten', changePass: 'Passwort ändern', resetPass: 'Passwort zurücksetzen', getStarted: 'Loslegen', @@ -98,9 +101,18 @@ export default { supervisionCount: 'Supervision pro Jahr', outOf: 'von', schedule: 'Zeitplan', + successfulCase: 'Erfolgreiche Fälle aus der Praxis', signUp: 'Jetzt anmelden', noData: 'Keine Daten', notFound: 'Nicht gefunden', + trainings: 'Trainings', + seminars: 'Seminare', + courses: 'Kurse', + mba: 'MBA-Information', + aboutCoach: 'Über Coach', + education: 'Bildung', + coaching: 'Coaching', + errors: { invalidEmail: 'Die E-Mail-Adresse ist ungültig', emptyEmail: 'Bitte geben Sie Ihre E-Mail ein', diff --git a/src/i18nKeys/en.ts b/src/i18nKeys/en.ts index cc538c3..9857844 100644 --- a/src/i18nKeys/en.ts +++ b/src/i18nKeys/en.ts @@ -4,9 +4,9 @@ export default { notifications: 'Notification', support: 'Help & Support', information: 'Legal Information', - settings: 'Profile Settings', + settings: 'Account Settings', messages: 'Messages', - 'work-with-us': 'Work With Us' + 'expert-profile': 'Expert profile' }, menu: { 'bb-client': 'Start grow with BB', @@ -41,6 +41,8 @@ export default { myComments: 'My comments', addComment: 'Add new', commentPlaceholder: 'Your comment', + clientComments: 'Client Comments', + coachComments: 'Coach Comments' }, room: { upcoming: 'Upcoming Rooms', @@ -84,6 +86,7 @@ export default { fromTo: 'from $ to $', apply: 'Apply', save: 'Save', + edit: 'Edit', changePass: 'Change password', resetPass: 'Reset password', getStarted: 'Get started', @@ -98,9 +101,17 @@ export default { supervisionCount: 'Supervision per year', outOf: 'out of', schedule: 'Schedule', + successfulCase: 'Successful Cases From Practice', signUp: 'Sign up now', noData: 'No data', notFound: 'Not found', + trainings: 'Trainings', + seminars: 'Seminars', + courses: 'Courses', + mba: 'MBA Information', + aboutCoach: 'About Coach', + education: 'Education', + coaching: 'Coaching', errors: { invalidEmail: 'The email address is not valid', emptyEmail: 'Please enter your E-mail', diff --git a/src/i18nKeys/es.ts b/src/i18nKeys/es.ts index 9c7d096..f94d8a5 100644 --- a/src/i18nKeys/es.ts +++ b/src/i18nKeys/es.ts @@ -4,9 +4,9 @@ export default { notifications: 'Notificación', support: 'Ayuda y asistencia', information: 'Información jurídica', - settings: 'Ajustes del perfil', + settings: 'Ajustes de cuenta', messages: 'Mensajes', - 'work-with-us': 'Trabaja con nosotros' + 'expert-profile': 'Perfil del experto' }, menu: { 'bb-client': 'Empieza a crecer con BB', @@ -41,6 +41,8 @@ export default { myComments: 'Mis comentarios', addComment: 'Añadir nuevo comentario', commentPlaceholder: 'Tu comentario', + clientComments: 'Comentarios del cliente', + coachComments: 'Comentarios del entrenador' }, room: { upcoming: 'Próximas salas', @@ -84,6 +86,7 @@ export default { fromTo: 'de $ a $', apply: 'Solicitar', save: 'Guardar', + edit: 'Editar', changePass: 'Cambiar contraseña', resetPass: 'Restablecer contraseña', getStarted: 'Empieza', @@ -94,13 +97,22 @@ export default { courseInfo: 'Información del curso', expertBackground: 'Antecedentes del experto', profCertification: 'Certificación profesional', - practiceHours: 'horas de práctica', - supervisionCount: 'supervisiones anuales', + practiceHours: 'Horas de práctica', + supervisionCount: 'Supervisiones anuales', outOf: 'de', schedule: 'Horario', + successfulCase: 'Casos de éxito de la práctica', signUp: 'Regístrate ahora', noData: 'Sin datos', notFound: 'No encontrado', + trainings: 'Formación', + seminars: 'Seminarios', + courses: 'Cursos', + mba: 'Información sobre máster en ADE (MBA)', + aboutCoach: 'Sobre el coach', + education: 'Educación', + coaching: 'Coaching', + errors: { invalidEmail: 'La dirección de correo electrónico no es válida', emptyEmail: 'Introduce tu correo electrónico', diff --git a/src/i18nKeys/fr.ts b/src/i18nKeys/fr.ts index 9b5c471..7978155 100644 --- a/src/i18nKeys/fr.ts +++ b/src/i18nKeys/fr.ts @@ -4,9 +4,9 @@ export default { notifications: 'Notification', support: 'Aide et support', information: 'Informations légales', - settings: 'Paramètres du profil', + settings: 'Paramètres du compte', messages: 'Messages', - 'work-with-us': 'Travaillez avec nous' + 'expert-profile': 'Profil de l\'expert' }, menu: { 'bb-client': 'Commencez à vous développer avec BB', @@ -41,6 +41,8 @@ export default { myComments: 'Mes commentaires', addComment: 'Ajouter un nouveau commentaire', commentPlaceholder: 'Votre commentaire', + clientComments: 'Commentaires du client', + coachComments: 'Commentaires du coach' }, room: { upcoming: 'Salles futures', @@ -84,6 +86,7 @@ export default { fromTo: 'de $ à $', apply: 'Appliquer', save: 'Sauvegarder', + edit: 'Modifier', changePass: 'Modifier le mot de passe', resetPass: 'Réinitialiser le mot de passe', getStarted: 'Commencer', @@ -94,13 +97,22 @@ export default { courseInfo: 'Infos sur le cours', expertBackground: 'Antécédents de l\'expert', profCertification: 'Certification professionnelle', - practiceHours: 'heures de pratique', + practiceHours: 'Heures de pratique', supervisionCount: 'Supervision par an', outOf: 'sur', schedule: 'Programme', + successfulCase: 'Cas réussis de la pratique', signUp: 'Inscrivez-vous maintenant', noData: 'Aucune donnée', notFound: 'Non trouvé', + trainings: 'Formations', + seminars: 'Séminaires', + courses: 'Cours', + mba: 'Infos Maîtrise en gestion', + aboutCoach: 'À propos du coach', + education: 'Éducation', + coaching: 'Coaching', + errors: { invalidEmail: 'L\'adresse e-mail n\'est pas valide', emptyEmail: 'Veuillez saisir votre e-mail', diff --git a/src/i18nKeys/it.ts b/src/i18nKeys/it.ts index 575b165..5520c2a 100644 --- a/src/i18nKeys/it.ts +++ b/src/i18nKeys/it.ts @@ -4,9 +4,9 @@ export default { notifications: 'Notifica', support: 'Assistenza e supporto', information: 'Informazioni legali', - settings: 'Impostazioni profilo', + settings: 'Impostazioni account', messages: 'Messaggi', - 'work-with-us': 'Lavora con noi' + 'expert-profile': 'Profilo dell\'esperto' }, menu: { 'bb-client': 'Inizia a crescere con BB', @@ -41,6 +41,8 @@ export default { myComments: 'I miei commenti', addComment: 'Aggiungi nuovo commento', commentPlaceholder: 'Il tuo commento', + clientComments: 'Commenti del cliente', + coachComments: 'Commenti dell\'allenatore' }, room: { upcoming: 'Prossime sale', @@ -84,6 +86,7 @@ export default { fromTo: 'da $ a $', apply: 'Applica', save: 'Salva', + edit: 'Modifica', changePass: 'Cambia password', resetPass: 'Reimposta password', getStarted: 'Inizia', @@ -94,13 +97,22 @@ export default { courseInfo: 'Informazioni sul corso', expertBackground: 'Background esperto', profCertification: 'Certificazione professionale', - practiceHours: 'ore di pratica', - supervisionCount: 'supervisioni per anno', + practiceHours: 'Ore di pratica', + supervisionCount: 'Supervisioni per anno', outOf: 'su', schedule: 'Programma', + successfulCase: 'Casi di successo dalla pratica', signUp: 'Iscriviti ora', noData: 'Nessun dato', notFound: 'Non trovato', + trainings: 'Training', + seminars: 'Seminari', + courses: 'Corsi', + mba: 'Info sull\'MBA', + aboutCoach: 'Informazioni sul coach', + education: 'Istruzione', + coaching: 'Coaching', + errors: { invalidEmail: 'L\'indirizzo e-mail non è valido', emptyEmail: 'Inserisci l\'e-mail', diff --git a/src/i18nKeys/ru.ts b/src/i18nKeys/ru.ts index 16da8a3..aa99952 100644 --- a/src/i18nKeys/ru.ts +++ b/src/i18nKeys/ru.ts @@ -4,9 +4,9 @@ export default { notifications: 'Уведомления', support: 'Служба поддержки', information: 'Юридическая информация', - settings: 'Настройки профиля', + settings: 'Настройки учетной записи', messages: 'Сообщения', - 'work-with-us': 'Сотрудничество' + 'expert-profile': 'Профиль эксперта' }, menu: { 'bb-client': 'Начните свой рост с BB', @@ -41,6 +41,8 @@ export default { myComments: 'Мои комментарии', addComment: 'Добавить новый', commentPlaceholder: 'Ваш комментарий', + clientComments: 'Комментарии клиента', + coachComments: 'Комментарии коуча' }, room: { upcoming: 'Предстоящие комнаты', @@ -84,6 +86,7 @@ export default { fromTo: 'от $ до $', apply: 'Применить', save: 'Сохранить', + edit: 'Редактировать', changePass: 'Изменить пароль', resetPass: 'Сбросить пароль', getStarted: 'Начать работу', @@ -94,13 +97,22 @@ export default { courseInfo: 'Информация о курсе', expertBackground: 'Профессиональный опыт эксперта', profCertification: 'Профессиональная сертификация', - practiceHours: 'часов практики', - supervisionCount: 'часов супервизии в год', + practiceHours: 'Часов практики', + supervisionCount: 'Часов супервизии в год', outOf: 'из', schedule: 'Расписание', + successfulCase: 'Успешные случаи из практики', signUp: 'Записаться сейчас', noData: 'Нет данных', notFound: 'Не найдено', + trainings: 'Тренинги', + seminars: 'Семинары', + courses: 'Курсы', + mba: 'Информация о MBA', + aboutCoach: 'О коуче', + education: 'Образование', + coaching: 'Коучинг', + errors: { invalidEmail: 'Адрес электронной почты недействителен', emptyEmail: 'Пожалуйста, введите ваш E-mail', diff --git a/src/lib/apiClient.ts b/src/lib/apiClient.ts index f6beada..713dbe7 100644 --- a/src/lib/apiClient.ts +++ b/src/lib/apiClient.ts @@ -12,7 +12,10 @@ export const onSuccessRequestCallback = (config: InternalAxiosRequestConfig) => // if (IS_DEV && !newConfig.headers.Authorization && getAuthToken()) { // newConfig.headers.Authorization = `Bearer ${getAuthToken()}`; // } - newConfig.headers['Content-Type'] = 'application/json'; + + if (!newConfig.headers['Content-Type']) { + newConfig.headers['Content-Type'] = 'application/json'; + } return newConfig; }; diff --git a/src/styles/_default.scss b/src/styles/_default.scss index 3f7f347..93f42f9 100644 --- a/src/styles/_default.scss +++ b/src/styles/_default.scss @@ -8,6 +8,21 @@ body{ --font: var(--font-comfortaa), -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-family: var(--font); background-color: #ffffff; + + & * { + &::-webkit-scrollbar { + width: 8px; + height: 8px; + } + &::-webkit-scrollbar-track { + background: #C4DFE6; + border-radius: 8px; + } + &::-webkit-scrollbar-thumb { + background-color: #2C7873; + border-radius: 8px; + } + } } *::selection { diff --git a/src/styles/_modal.scss b/src/styles/_modal.scss index c04824a..bf5423e 100644 --- a/src/styles/_modal.scss +++ b/src/styles/_modal.scss @@ -32,6 +32,55 @@ padding: 44px 40px; gap: 24px; } + + &__expert { + &__title { + color: #003B46; + @include rem(20); + font-style: normal; + font-weight: 600; + line-height: 133.333%; + } + + &__button { + width: 100%; + + button { + width: 100% !important; + } + } + + &__inner { + height: 60vh; + overflow-y: auto; + + & > div { + display: flex; + flex-direction: column; + padding-right: 20px; + + & > * { + width: 100%; + } + } + } + + &__content { + display: flex; + flex-direction: column; + padding: 40px; + gap: 24px; + + .title-h4 { + color: #003B46; + @include rem(16); + font-style: normal; + font-weight: 700; + line-height: 150%; + padding-bottom: 16px; + } + } + } } .ant-modal-mask { diff --git a/src/styles/_pages.scss b/src/styles/_pages.scss index 200aea8..49ceb51 100644 --- a/src/styles/_pages.scss +++ b/src/styles/_pages.scss @@ -1140,15 +1140,13 @@ height: 146px; object-fit: cover; } - } .coaching-info { display: flex; flex-flow: column; justify-content: space-between; - gap: 24px; - margin-bottom: 24px; + gap: 16px; .card-profile { border: none !important; @@ -1172,9 +1170,6 @@ } @media (min-width: 768px) { - flex-flow: nowrap; - gap: 10px; - &__wrap-btn { display: flex; gap: 10px; @@ -1183,8 +1178,66 @@ } } +.coaching-profile { + display: flex; + gap: 16px; + align-items: flex-start; + + &__portrait { + width: 86px; + height: 86px; + border-radius: 16px; + border: 2px solid #FFF; + background: lightgray 50%; + box-shadow: 0 8px 16px 0 rgba(102, 165, 173, 0.32); + overflow: hidden; + + img { + object-fit: cover; + width: 100%; + height: 100%; + display: block; + border-radius: 16px; + } + } + + &__inner { + padding-top: 10px; + } + + &__name { + color: #003B46; + @include rem(18); + font-weight: 600; + line-height: 150%; + } +} + .coaching-section { - margin-bottom: 24px; + &__wrap { + border-top: 1px solid #C4DFE6; + padding-top: 16px; + display: flex; + flex-direction: column; + gap: 16px; + } + + &__title { + display: flex; + width: 100%; + justify-content: space-between; + align-self: center; + + .b-button__link { + height: 24px !important; + } + } + + .title-h2 { + color: #003B46; + @include rem(18); + line-height: 24px; + } .base-text { margin-bottom: 0; diff --git a/src/types/education.ts b/src/types/education.ts new file mode 100644 index 0000000..aa41a70 --- /dev/null +++ b/src/types/education.ts @@ -0,0 +1,44 @@ +import { ExpertDocument } from './file'; + +export type Details = { + id: number; + userId?:number; + title?: string; + description?: string; + document?: ExpertDocument; +}; + +export type Certificate = { + id: number; + userId?: number; + associationLevelId?: number; + document?: ExpertDocument; +}; + +export type Experience = { + id: number, + userId?: number, + title?: string, + description?: string +}; + +export type Association = { + id: number; + name?: string; +}; + +export type AssociationLevel = Association & { associationId?: number }; + +export type EducationData = { + certificates?: Certificate[], + educations?: Details[], + trainings?: Details[], + mbas?: Details[], + experiences?: Experience[] +}; + +export interface EducationDTO { + person2Data?: EducationData, + associations?: Association[], + associationLevels?: AssociationLevel[] +} diff --git a/src/types/experts.ts b/src/types/experts.ts index 160db87..5917d31 100644 --- a/src/types/experts.ts +++ b/src/types/experts.ts @@ -1,4 +1,5 @@ import { Tag, ThemeGroups } from './tags'; +import { Association, AssociationLevel, EducationData } from './education'; export type GeneralFilter = Filter & AdditionalFilter; @@ -19,34 +20,6 @@ export type AdditionalFilter = { coachSort?: string; }; -export type File = { - id: number; - fileType: string; - url: string; -}; - -export interface ExpertDocument { - fileName: string; - original?: File; - preview?: File; - fullSize?: File; -} - -export type Details = { - id: number; - userId?:number; - title?: string; - description?: string; - document?: ExpertDocument; -}; - -export type Certificate = { - id: number; - userId?: number; - associationLevelId?: number; - document?: ExpertDocument; -}; - export type Practice = { id: number; userId?: number; @@ -61,16 +34,6 @@ export type ThemeGroup = { canDeleted?: boolean; }; -export type Association = { - id: number; - name: string; -}; - -export type AssociationLevel = { - id: number; - associationId: number; - name: string; -}; export interface ExpertItem { id: number; @@ -98,14 +61,9 @@ export type ExpertsData = { }; export type ExpertDetails = { - publicCoachDetails: ExpertItem & { + publicCoachDetails: ExpertItem & EducationData & { practiceHours?: number; supervisionPerYearId?: number; - educations?: Details[]; - certificates?: Certificate[]; - trainings?: Details[]; - mbas?: Details[]; - experiences?: Details[]; practiceCases?: Practice[]; themesGroups?: ThemeGroup[]; }; diff --git a/src/types/file.ts b/src/types/file.ts new file mode 100644 index 0000000..48a73fd --- /dev/null +++ b/src/types/file.ts @@ -0,0 +1,12 @@ +export type File = { + id: number; + fileType: string; + url: string; +}; + +export interface ExpertDocument { + fileName: string; + original?: File; + preview?: File; + fullSize?: File; +} diff --git a/src/types/practice.ts b/src/types/practice.ts new file mode 100644 index 0000000..438e125 --- /dev/null +++ b/src/types/practice.ts @@ -0,0 +1,29 @@ +import { ExpertsThemesGroups } from './tags'; + +export type Supervision = { + id: number, + name: string +}; + +export type PracticeCase = { + id: number, + userId?: number, + description?: string, + themesGroupIds?: number[] +}; + +export type PracticeData = { + practiceHours?: number, + supervisionPerYearId?: number, + sessionDuration?: number, + sessionCost?: number, + practiceCases?: PracticeCase[] +} + +export interface PracticeDTO { + person4Data: PracticeData & { + themesGroups?: ExpertsThemesGroups[], + supervisionPerYears?: Supervision[], + sessionCosts?: number[] + } +} diff --git a/src/types/profile.ts b/src/types/profile.ts index c606879..548398c 100644 --- a/src/types/profile.ts +++ b/src/types/profile.ts @@ -1,5 +1,10 @@ -export type Profile = { - id: number; +import { UploadFile } from 'antd'; +import {EducationDTO} from "./education"; +import {ExpertsTags} from "./tags"; +import {PracticeDTO} from "./practice"; +import {ScheduleDTO} from "./schedule"; + +export type ProfileData = { username?: string; surname?: string; fillProgress?: string; @@ -9,4 +14,35 @@ export type Profile = { hasPassword?: boolean; hasExternalLogin?: boolean; isTestMode?: boolean; + phone?: string; + languagesLinks?: { language: { id: number, code: string, nativeSpelling: string }, languageId: number }[] +} + +export type Profile = ProfileData & { id: number }; + +export type ProfileRequest = { + login?: string; + password?: string; + isPasswordKeepExisting?: boolean; + languagesLinks?: { languageId: number }[]; + username?: string; + surname?: string; + faceImage?: UploadFile; + isFaceImageKeepExisting?: boolean; + phone?: string; }; + +export type PayInfo = { + beneficiaryName?: string, + iban?: string, + bicOrSwift?: string +}; + +export interface ExpertData { + person?: ProfileData, + education?: EducationDTO, + tags?: ExpertsTags, + practice?: PracticeDTO, + schedule?: ScheduleDTO, + payData?: { person6Data?: PayInfo }, +} diff --git a/src/types/schedule.ts b/src/types/schedule.ts new file mode 100644 index 0000000..fc18ca9 --- /dev/null +++ b/src/types/schedule.ts @@ -0,0 +1,10 @@ +export type WorkingTime = { + startDayOfWeekUtc?: string, + startTimeUtc?: number, + endDayOfWeekUtc?: string, + endTimeUtc?: number +} + +export interface ScheduleDTO { + workingTimes?: WorkingTime[] +} diff --git a/src/types/tags.ts b/src/types/tags.ts index 821ebec..eb1985e 100644 --- a/src/types/tags.ts +++ b/src/types/tags.ts @@ -4,6 +4,9 @@ export type Tag = { name: string couchCount?: number; group?: string | null; + isActive?: boolean, + isSelected?: boolean, + canDeleted?: boolean }; export type ThemeGroups = { @@ -27,3 +30,15 @@ export type Language = { } export type Languages = Language[]; + +export type ExpertsThemesGroups = { + id: number, + name: string, + isActive?: boolean, + canDeleted?: boolean +}; + +export interface ExpertsTags { + themesGroups?: ExpertsThemesGroups[], + themesTags?: Tag[] +} diff --git a/src/utils/account.ts b/src/utils/account.ts index 91725b1..e67e439 100644 --- a/src/utils/account.ts +++ b/src/utils/account.ts @@ -1,6 +1,8 @@ +import { message } from 'antd'; +import type { UploadFile } from 'antd'; import { i18nText } from '../i18nKeys'; -const ROUTES = ['sessions', 'notifications', 'support', 'information', 'settings', 'messages', 'work-with-us']; +const ROUTES = ['sessions', 'notifications', 'support', 'information', 'settings', 'messages', 'expert-profile']; const COUNTS: Record = { sessions: 12, notifications: 5, @@ -12,3 +14,17 @@ export const getMenuConfig = (locale: string) => ROUTES.map((path) => ({ title: i18nText(`accountMenu.${path}`, locale), count: COUNTS[path] || undefined })); + +export const validateImage = (file: UploadFile, showMessage?: boolean): boolean => { + const isImage = file.type === 'image/jpg' || file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif'; + if (!isImage && showMessage) { + message.error('You can only upload JPG/PNG file'); + } + + const isLt5M = file.size / 1024 / 1024 <= 5; + if (!isLt5M && showMessage) { + message.error('Image must smaller than 5MB'); + } + + return isImage && isLt5M; +}; From 44674a191002fe1d34b1d79beeca47c36e0e59fb Mon Sep 17 00:00:00 2001 From: norton81 Date: Tue, 20 Aug 2024 13:06:40 +0300 Subject: [PATCH 9/9] fix master --- .../account/(account)/expert-profile/add-offer/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/[locale]/account/(account)/expert-profile/add-offer/page.tsx b/src/app/[locale]/account/(account)/expert-profile/add-offer/page.tsx index e669b63..7ed015c 100644 --- a/src/app/[locale]/account/(account)/expert-profile/add-offer/page.tsx +++ b/src/app/[locale]/account/(account)/expert-profile/add-offer/page.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { Link } from '../../../../../../../navigation'; -import { CustomSelect } from '../../../../../../../components/view/CustomSelect'; +import { Link } from '../../../../../../navigation'; +import { CustomSelect } from '../../../../../../components/view/CustomSelect'; export default function AddOffer() { return (