Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ page to schedule mentorship #1607

Merged
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
f4be842
guided experience for lesson and remove unnecesary contextState variable
gustavomm19 Aug 13, 2024
853d834
fix colors variables
gustavomm19 Aug 14, 2024
21fb3bd
improve sidebar functionality
gustavomm19 Aug 14, 2024
54f4b8b
add guided experience for exercises
gustavomm19 Aug 19, 2024
d0b0675
fix scroll behavior on guided experience sidebar
gustavomm19 Aug 20, 2024
aec5796
refactor useCohortHandler
gustavomm19 Aug 20, 2024
f812ee2
remove unused param
gustavomm19 Aug 20, 2024
fa031ca
remove promise syntax in cohort handler
gustavomm19 Aug 20, 2024
de3590c
Merge branch 'development' of https://github.com/gustavomm19/app into…
gustavomm19 Aug 20, 2024
a1a1fc1
remove back to dashboard button
gustavomm19 Aug 21, 2024
e1fe4aa
doing projects version
gustavomm19 Aug 22, 2024
cc0c7a4
adding guided experience to projects
gustavomm19 Aug 26, 2024
1dbd94f
fix conflict
gustavomm19 Aug 26, 2024
7b6c9cf
:bug: fix1 when user in basic plan run out of consumables and then up…
lumi-tip Aug 26, 2024
cd8b9c6
make markdown mas width 1280px
gustavomm19 Aug 27, 2024
4b0ca7c
componetize CodeRevissionsList
gustavomm19 Aug 29, 2024
126259d
Merge branch 'development' of https://github.com/gustavomm19/app into…
gustavomm19 Aug 29, 2024
d44eaa2
move current task to module handler hook
gustavomm19 Aug 29, 2024
3f19ba4
:bug: user will get its consumables if needed and has them
lumi-tip Aug 29, 2024
b5ecbf4
:recycle: refactor mentorshipService (was not getting info at all) mo…
lumi-tip Aug 30, 2024
240a54d
added coderevissions to guided-experience
gustavomm19 Sep 2, 2024
a7018bd
remove unused code
gustavomm19 Sep 2, 2024
e4a70bc
fix code details
gustavomm19 Sep 3, 2024
3cd13ce
fix syntax in TaskCodeRevision
gustavomm19 Sep 3, 2024
56c0d04
fix code in coderevisionslist
gustavomm19 Sep 3, 2024
cd89b02
remove duplicated function nestAssignments
gustavomm19 Sep 3, 2024
1b40369
remove duplicated admissions user me call
gustavomm19 Sep 3, 2024
aa2f712
fix bug
gustavomm19 Sep 3, 2024
2ff0fd1
add button on no info modal to sync cohorts tasks
gustavomm19 Sep 5, 2024
50bfd8f
small refactor to useCohortHandler
gustavomm19 Sep 5, 2024
a9a0e90
remove option to start code review if there is no commit files
gustavomm19 Sep 5, 2024
c7a9ae5
remove comment to force redeploy
gustavomm19 Sep 5, 2024
e98549b
:sparkles: new url for students to schedule mentorships
lumi-tip Sep 5, 2024
b08bcea
fix visual details
gustavomm19 Sep 6, 2024
3de19cd
Merge pull request #1596 from breatheco-de/development
tommygonzaleza Sep 9, 2024
1494445
:recycle: refactor of the code, sort consumables to avoid bug avoid u…
lumi-tip Sep 10, 2024
4ac4844
:recycle: refactor of small pieces of code
lumi-tip Sep 10, 2024
11a4536
:recycle: changes in the code related to colors, padding, margin
lumi-tip Sep 10, 2024
25d8ef0
Merge branch 'development' of https://github.com/gustavomm19/app into…
gustavomm19 Sep 11, 2024
2d7f652
fix bug with modal layout
gustavomm19 Sep 11, 2024
df18c21
:recycle: refactor of the code of mentoring
lumi-tip Sep 11, 2024
aa17be4
sidebar new design
gustavomm19 Sep 12, 2024
d1531fa
remove consoles log
gustavomm19 Sep 12, 2024
686a0d8
added rigobot ai chat
gustavomm19 Sep 12, 2024
5ace6fc
fix conflict
gustavomm19 Sep 12, 2024
8809e0a
fix typo
gustavomm19 Sep 12, 2024
2d2bb08
replace bottom buttons text by tooltps
gustavomm19 Sep 12, 2024
03273a1
Update AuthContext.jsx
tommygonzaleza Sep 12, 2024
791ab1a
Update AuthContext.jsx
tommygonzaleza Sep 12, 2024
d82d424
Merge pull request #1601 from breatheco-de/development
tommygonzaleza Sep 12, 2024
8c1acf9
redesign guided experience navbar
gustavomm19 Sep 13, 2024
5095bce
redesign bottom controls panel
gustavomm19 Sep 13, 2024
f0ac417
change cohortProgram initial value
gustavomm19 Sep 13, 2024
e967875
add prop cohort to onlyfor component
gustavomm19 Sep 13, 2024
0bcf9a6
fix conflict
gustavomm19 Sep 13, 2024
3361653
fix control buttons sizing
gustavomm19 Sep 13, 2024
7671db4
:recycle: refactor of the jsx
lumi-tip Sep 13, 2024
5796592
fix some code details
gustavomm19 Sep 16, 2024
878c9e0
diminish padding in exercises view
gustavomm19 Sep 16, 2024
f87f747
fix issue with related assets
gustavomm19 Sep 16, 2024
bd6432b
fix codeviewer excesive scroll length
gustavomm19 Sep 16, 2024
b7da943
:sparkles: page to schedule mentorship
lumi-tip Sep 16, 2024
2f75f79
small change
lumi-tip Sep 16, 2024
d8f4c46
:bug: fix bug related to consumables when user comes from /program/slug
lumi-tip Sep 16, 2024
bc3becf
Update signup.json
tommygonzaleza Sep 16, 2024
29104b9
Update signup.json
tommygonzaleza Sep 16, 2024
b6be5ff
Merge pull request #1608 from breatheco-de/tommygonzaleza-patch-6
tommygonzaleza Sep 16, 2024
aa9ac91
small change in border color
lumi-tip Sep 16, 2024
3d027e7
small change
lumi-tip Sep 16, 2024
bd23ce3
remove log
lumi-tip Sep 16, 2024
0cff98b
Update dashboard.json
tommygonzaleza Sep 17, 2024
f1e17e0
hide saas courses for non saas students
gustavomm19 Sep 17, 2024
3b2b428
fix details
gustavomm19 Sep 17, 2024
168e0b6
fix redirect to origin url from navbar login
gustavomm19 Sep 17, 2024
8779ef2
fix responsive bug with assets
gustavomm19 Sep 17, 2024
daebe4f
Merge pull request #1602 from lumi-tip/development-lumi-7752-v2
tommygonzaleza Sep 17, 2024
3259741
fix typo
gustavomm19 Sep 17, 2024
6b32e2b
Merge pull request #1606 from gustavomm19/fixes
tommygonzaleza Sep 17, 2024
27d4e9f
Update signup.json
tommygonzaleza Sep 17, 2024
157e64f
:recycle: refactor of consumablesCode
lumi-tip Sep 17, 2024
297ec66
:recycle: refactor of consumablesCode
lumi-tip Sep 17, 2024
b6a6ad9
Add terms and conditions on signup button
tommygonzaleza Sep 18, 2024
3d736f4
Merge pull request #1570 from gustavomm19/guided-experience
tommygonzaleza Sep 18, 2024
d469461
:recycle: refactor of the code
lumi-tip Sep 18, 2024
437e408
:recycle: refactor of the code
lumi-tip Sep 18, 2024
16991aa
:recycle: using Mentoring consumables component
lumi-tip Sep 18, 2024
e24dae4
update in dashborad json
lumi-tip Sep 18, 2024
c68d956
:recycle: using Mentoring consumables component
lumi-tip Sep 18, 2024
3a28d29
Merge pull request #1609 from breatheco-de/development
tommygonzaleza Sep 18, 2024
e91d2de
add classname to controls panel
gustavomm19 Sep 19, 2024
115f245
fix solution video component bug
gustavomm19 Sep 19, 2024
3e8dc42
fix controlls overflowing container
gustavomm19 Sep 19, 2024
1284b53
fix close icon
gustavomm19 Sep 19, 2024
0f1923e
Merge branch 'development' of https://github.com/gustavomm19/app into…
gustavomm19 Sep 19, 2024
a257de9
do not show option to start code review if there is no commit files
gustavomm19 Sep 19, 2024
c31e21c
fix details
gustavomm19 Sep 19, 2024
0b9a381
Merge branch 'development' of https://github.com/gustavomm19/app into…
gustavomm19 Sep 19, 2024
d144c7b
fix detail
gustavomm19 Sep 19, 2024
75f72b0
:recycle: refactor
lumi-tip Sep 19, 2024
06a182b
include call to action to open interactive projects
gustavomm19 Sep 20, 2024
bb3bb9d
fix menu bug
gustavomm19 Sep 20, 2024
97bfa86
Merge pull request #1605 from gustavomm19/saas-courses
tommygonzaleza Sep 20, 2024
cf17d89
Merge pull request #1612 from breatheco-de/main
tommygonzaleza Sep 20, 2024
b46523f
small change
lumi-tip Sep 23, 2024
049c09c
hide teachers feedback and codereviews if the asset has delivery_form…
gustavomm19 Sep 23, 2024
46ae3a5
fix typo
gustavomm19 Sep 23, 2024
37b4976
remove unnecesary manual translation
gustavomm19 Sep 23, 2024
ce48758
Merge pull request #1587 from lumi-tip/development-lumi-7659
tommygonzaleza Sep 24, 2024
060ea54
Update dashboard.json
tommygonzaleza Sep 24, 2024
8196a59
Merge pull request #1594 from gustavomm19/sync-cohort
tommygonzaleza Sep 24, 2024
1332ef5
Update index.jsx
tommygonzaleza Sep 24, 2024
29123cb
Merge pull request #1613 from gustavomm19/guided-experience
tommygonzaleza Sep 24, 2024
7a06d81
Update dashboard.json
tommygonzaleza Sep 24, 2024
4c5780e
Update dashboard.json
tommygonzaleza Sep 24, 2024
d2edf94
:sparkles: new url for students to schedule mentorships
lumi-tip Sep 5, 2024
10cdedf
:recycle: refactor of the jsx
lumi-tip Sep 13, 2024
8d88f5b
:sparkles: page to schedule mentorship
lumi-tip Sep 16, 2024
be69a9c
small change
lumi-tip Sep 16, 2024
326f48f
:recycle: using Mentoring consumables component
lumi-tip Sep 18, 2024
7f50a3e
Update dashboard.json
tommygonzaleza Sep 17, 2024
f2c7284
:recycle: using Mentoring consumables component
lumi-tip Sep 18, 2024
e9bd61c
small change
lumi-tip Sep 23, 2024
969eee4
merging
lumi-tip Sep 24, 2024
7d41b21
:sparkles: new url for students to schedule mentorships
lumi-tip Sep 5, 2024
ded7667
:recycle: refactor of the jsx
lumi-tip Sep 13, 2024
b4c5b20
:sparkles: page to schedule mentorship
lumi-tip Sep 16, 2024
677c55d
small change
lumi-tip Sep 16, 2024
cd8e313
:recycle: using Mentoring consumables component
lumi-tip Sep 18, 2024
07b45e3
Update dashboard.json
tommygonzaleza Sep 17, 2024
893ecd9
:recycle: using Mentoring consumables component
lumi-tip Sep 18, 2024
f397594
small change
lumi-tip Sep 23, 2024
6f50e0b
merge
lumi-tip Sep 24, 2024
b285ff6
:recycle: refactor of the jsx
lumi-tip Sep 13, 2024
90cbce5
:sparkles: page to schedule mentorship
lumi-tip Sep 16, 2024
1b4805c
:recycle: using Mentoring consumables component
lumi-tip Sep 18, 2024
d8c6346
Update dashboard.json
tommygonzaleza Sep 17, 2024
1735477
Update dashboard.json
tommygonzaleza Sep 24, 2024
07a23b1
Update dashboard.json
tommygonzaleza Sep 24, 2024
c2e3894
Update dashboard.json
tommygonzaleza Sep 24, 2024
4bcf4a0
Merge branch 'development-lumi-7728' of https://github.com/lumi-tip/a…
lumi-tip Sep 24, 2024
f113aaf
:recycle: small refactor
lumi-tip Sep 24, 2024
576e107
:recycle: samll refactor
lumi-tip Sep 24, 2024
da434fc
:bug: fix related to consumables
lumi-tip Sep 26, 2024
2f33cb7
adding max-w and when searching for mentor it will be the only option
lumi-tip Oct 1, 2024
23ed75f
changes in spacing
lumi-tip Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = {
'/syllabus/[cohortSlug]/[lesson]/[lessonSlug]': ['syllabus', 'dashboard', 'projects', 'assignments'],
'/survey/[surveyId]': ['survey'],
'/mentorship': ['mentorship'],
'/mentorship/schedule': ['mentorship', 'dashboard'],
'/how-to': ['how-to'],
'/pricing': ['pricing', 'signup'],
'/how-to/[slug]': ['how-to'],
Expand Down
18 changes: 14 additions & 4 deletions public/locales/en/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"title": "Dashboard"
},
"title": "Your News",
"back-to-dashboard": "Back to dashboard",
"backToChooseProgram": "Back to choose program",
"moduleMap": "Module map",
"progressText": "progress in the program",
Expand All @@ -14,9 +15,9 @@
"cta-description": "Your current plan does not include access to this cohort, please upgrade to access the content.",
"cta-cohort-not-found": "This cohort does not exist or you don't have access to join.",
"cta-button": "Review plan",
"join-next-cohort":"Join next cohort",
"start-course":"Start this course",
"join-more":"Join more than 100 people taking this course right now",
"join-next-cohort": "Join next cohort",
"start-course": "Start this course",
"join-more": "Join more than 100 people taking this course right now",
"preview-description": "You are reviewing this cohort dashboard on \"preview mode\", in order to start learning and interact with the materials please join the cohort."
},
"already-have-this-cohort": "You are already a member of this cohort",
Expand Down Expand Up @@ -104,7 +105,16 @@
"get-unlimited-mentorship": "and get unlimited mentorship",
"you-have": "You have",
"available-sessions": "available sessions",
"tooltip": "Mentorships reload every week"
"tooltip": "Mentorships reload every week",
"mentor-sessions-available": "mentoring sessions available",
"action": "Schedule session",
"no-available": "No services available",
"no-available-for-teacher": "No services available for"
},
"schedule-steps": {
"select-mentorship": "First select a type of mentorship",
"select-mentor": "Now search for a mentor",
"schedule": "Schedule the session"
},
"deliverProject": {
"title": "Deliver assignment",
Expand Down
34 changes: 22 additions & 12 deletions public/locales/es/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
},
"title": "Tus noticias",
"moduleMap": "Mapa de módulos",
"back-to-dashboard": "Volver al dashboard",
"backToChooseProgram": "Volver a elegir programa",
"progressText": "Progreso en el programa",
"whiteLabeledText": "Este curso es traído a ti gracias a nuestra alianza con esta universidad.",
Expand All @@ -15,9 +16,9 @@
"cta-description": "Tu plan actual no incluye acceso a esta cohorte, por favor actualiza para acceder al contenido.",
"cta-cohort-not-found": "Esta cohorte no existe o no tienes acceso para unirte.",
"cta-button": "Revisar plan",
"join-next-cohort":"Únete a la cohorte",
"start-course":"Empezar este curso",
"join-more":"Únete a más de 100 personas que toman este curso ahora mismo",
"join-next-cohort": "Únete a la cohorte",
"start-course": "Empezar este curso",
"join-more": "Únete a más de 100 personas que toman este curso ahora mismo",
"preview-description": "Estás revisando esta cohorte en \"modo de vista previa\". Para comenzar a aprender e interactuar con el material, únete a la cohorte."
},
"modules": {
Expand Down Expand Up @@ -72,17 +73,17 @@
"no-mentors": "No hay mentores disponibles",
"no-mentor-link": "No hay enlace para crear sesión con este mentor",
"search-mentor": "Buscar mentor por nombre",
"start-mentorship": "Para comenzar, seleccione un tipo de tutoría",
"start-mentorship": "Para comenzar, seleccione un tipo de mentoría",
"mentoring-label": "Mentoría",
"mentoring": "Programe una sesión de tutoría 1-1.",
"select-type": "Seleccione un tipo de tutoría",
"mentoring-available": "Tutorías disponibles",
"no-mentoring-available": "No tienes tutorías disponibles.",
"mentoring": "Programe una sesión de mentoría 1-1.",
"select-type": "Seleccione un tipo de mentoría",
"mentoring-available": "Mentorías disponibles",
"no-mentoring-available": "No tienes mentorías disponibles.",
"create-session-text": "Agendar ahora",
"learn-more": "Aprender mas.",
"learn-more-link": "https://4geeks.com/es/docs/knowledge-base-4geeks/sesiones-de-tutoria",
"get-more-mentorships": "Consigue más mentorías",
"schedule-button": "Programar una sesión de tutoría",
"schedule-button": "Programar una sesión de mentoría",
"mentors-available": "+{{count}} Mentores disponibles",
"actionButtons": [
{
Expand All @@ -100,11 +101,20 @@
]
},
"mentorship": {
"no-mentorship": "Se ha quedado sin tutorías, pero no se preocupe, puede obtener más con unos pocos clics.",
"get-unlimited-mentorship": "y obtén tutoría ilimitada",
"no-mentorship": "Se ha quedado sin mentorías, pero no se preocupe, puede obtener más con unos pocos clics.",
"get-unlimited-mentorship": "y obtén mentorías ilimitadas",
"you-have": "Tienes",
"available-sessions": "sesiones disponibles",
"tooltip": "Las tutorías se recargan cada semana"
"tooltip": "Las mentorías se recargan cada semana",
"mentor-sessions-available": "sesiones de mentoria disponibles",
"action": "Reservar mentoria",
"no-available": "No hay servicios disponibles",
"no-available-for-teacher": "No hay servicios disponibles para"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the connector for from common.json instead of adding here another line

},
"schedule-steps": {
"select-mentorship": "Primero selecciona un tipo de mentoría",
"select-mentor": "Ahora busca un mentor",
"schedule": "Agenda la sesión"
},
"deliverProject": {
"title": "Entregar tarea",
Expand Down
224 changes: 224 additions & 0 deletions src/pages/mentorship/schedule.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
import { useEffect, useState, useMemo } from 'react';
import { useColorModeValue, Container, Box } from '@chakra-ui/react';
import { useRouter } from 'next/router';
import useTranslation from 'next-translate/useTranslation';
import { reportDatalayer } from '../../utils/requests';
import useSubscriptionsHandler from '../../common/store/actions/subscriptionAction';
import useAuth from '../../common/hooks/useAuth';
import Icon from '../../common/components/Icon';
import Link from '../../common/components/NextChakraLink';
import bc from '../../common/services/breathecode';
import MentoringConsumables from '../../common/components/SupportSidebar/MentoringConsumables';

function MentorshipSchedule() {
let isTabletOrPhone = false;
if (typeof window !== 'undefined') {
isTabletOrPhone = window.innerWidth < 780;
}
const router = useRouter();
const { t } = useTranslation('dashboard');
const { fetchSubscriptions } = useSubscriptionsHandler();
const { service, mentor } = router.query;
const { isLoading, user, isAuthenticated } = useAuth();
const [mentorshipServices, setMentorshipServices] = useState({ isLoading: true, data: [] });
const [searchProps, setSearchProps] = useState({ serviceSearch: '', mentorSearch: '' });
const [mentoryProps, setMentoryProps] = useState({});
const [admissions, setAdmissions] = useState({});
const [consumables, setConsumables] = useState([]);
const [allMentorsAvailable, setAllMentorsAvailable] = useState([]);
const [mentorsByService, setMentorsByService] = useState([]);
const [subscriptionData, setSubscriptionData] = useState([]);

const getServices = async (userRoles) => {
if (userRoles?.length > 0) {
const mentorshipPromises = await userRoles.map((role) => bc.mentorship({ academy: role?.academy?.id }, true).getService()
.then((resp) => {
const data = resp?.data;
if (data !== undefined && data.length > 0) {
return data.map((serv) => ({
...serv,
academy: {
id: role?.academy.id,
available_as_saas: role?.academy?.available_as_saas,
},
}));
}
return [];
}));
const mentorshipResults = await Promise.all(mentorshipPromises);
const recopilatedServices = mentorshipResults.flat();

setMentorshipServices({
isLoading: false,
data: recopilatedServices,
});
}
};

const getAdmissionsData = async () => {
try {
const response = await bc.admissions().me();
const admissionsFromDB = response.data;
setAdmissions(response.data);
getServices(admissionsFromDB.roles);
} catch (error) {
console.error('Error fetching admissions data:', error);
}
};

useEffect(() => {
const checkAuthAndFetchData = async () => {
if (!isLoading && !isAuthenticated) {
router.push('/login');
} else if (isAuthenticated) {
await getAdmissionsData();
}
};

checkAuthAndFetchData();
}, [isLoading, isAuthenticated]);

const allSyllabus = useMemo(() => {
const allCohorts = admissions?.cohorts || [];
const syllabus = [...new Set(allCohorts.map(({ cohort }) => cohort.syllabus_version.slug))];
return syllabus;
}, [admissions]);

const getAllMentorsAvailable = async () => {
const servicesSlugs = mentorshipServices.data.map(({ slug }) => slug);

const academies = mentorshipServices.data.reduce((acc, { academy, ...restOfService }) => {
if (!acc[academy.id]) {
acc[academy.id] = { services: [] };
}
acc[academy.id].services.push(restOfService);
return acc;
}, {});

const academyData = Object.entries(academies).map(([id, { services }]) => ({
id: Number(id),
services,
}));

const getMentorsForAcademy = async (academy) => {
const res = await bc.mentorship({
services: academy.services.map((s) => s.slug).join(','),
status: 'ACTIVE',
syllabus: allSyllabus?.join(',') || undefined,
academy: academy.id,
}).getMentor();

return res?.data || [];
};

if (servicesSlugs.length > 0 || allSyllabus.length > 0) {
const mentorsPromises = academyData.map(getMentorsForAcademy);
const mentorsList = (await Promise.all(mentorsPromises)).flat();
return mentorsList;
}

return [];
};

const getMentorsAndConsumables = async () => {
const mentors = await getAllMentorsAvailable();
const reqConsumables = await bc.payment().service().consumable()
.then((res) => res?.data?.mentorship_service_sets.map((mentorshipServiceSet) => bc.mentorship()
.getServiceSet(mentorshipServiceSet?.id)
.then((rs) => ({
...rs?.data,
...mentorshipServiceSet,
}))));

const allConsumables = await Promise.all(reqConsumables);

setConsumables(allConsumables);
setAllMentorsAvailable(mentors);
};

useEffect(() => {
if (!mentorshipServices.isLoading && mentorshipServices?.data.length > 0) {
getMentorsAndConsumables();
}
}, [mentorshipServices]);

const mentorsFiltered = mentorsByService.filter(
(ment) => {
const fullName = `${ment.user.first_name} ${ment.user.last_name}`.toLowerCase();
return (
fullName.includes(searchProps.mentorSearch)
&& ment.services.some((sv) => sv.status === 'ACTIVE' && sv.slug === mentoryProps?.service?.slug)
);
},
);

const filterServices = () => {
if (subscriptionData?.selected_mentorship_service_set?.mentorship_services?.length > 0) {
return subscriptionData?.selected_mentorship_service_set?.mentorship_services?.filter(
(l) => l.name.toLowerCase().includes(searchProps.serviceSearch),
);
}
if (mentorshipServices.data.length > 0) {
return mentorshipServices.data?.filter(
(l) => l.name.toLowerCase().includes(searchProps.serviceSearch),
);
}

return [];
};
const suscriptionServicesFiltered = filterServices();

useEffect(() => {
if (mentoryProps.serviceSelected) {
fetchSubscriptions()
.then((data) => {
setSubscriptionData(data);
reportDatalayer({
dataLayer: {
event: 'subscriptions_load',
method: 'native',
plan_financings: data?.plan_financings?.filter((s) => s.status === 'ACTIVE').map((s) => s.plans.filter((p) => p.status === 'ACTIVE').map((p) => p.slug).join(',')).join(','),
subscriptions: data?.subscriptions?.filter((s) => s.status === 'ACTIVE').map((s) => s.plans.filter((p) => p.status === 'ACTIVE').map((p) => p.slug).join(',')).join(','),
},
});
});
}
}, [mentoryProps.serviceSelected]);

return !isLoading && user && !mentorshipServices.isLoading && (
<Container as="div" height="100%" maxWidth="full" minHeight="87.5vh" display="flex" flexDirection="column" padding={0} background={() => useColorModeValue('#f9f9f9', '#171f2a')} overflow="hidden">
<Link href="/choose-program" color="#0196d1" display="inline-block" letterSpacing="0.05em" fontWeight="700" width="fit-content" padding="3rem 0 0.6rem 1rem">
<Box display="flex" alignItems="center" justifyContent="center" gap="5px">
<Icon icon="arrowLeft2" color="#0196d1" width="15px" height="15px" />
<Box as="span">{`${t('back-to-dashboard')}`}</Box>
</Box>
</Link>
<Container as="div" display="flex" flexDirection="column" justifyContent="center" alignItems="center" marginTop="2.5rem" textAlign="center" padding="0px" borderRadius="10px">
<Box textAlign="start">
<MentoringConsumables
{...{
mentoryProps,
width: !isTabletOrPhone ? '650px' : '350px',
titleSize: !isTabletOrPhone && '30px',
consumables,
setMentoryProps,
programServices: mentorshipServices.data,
servicesFiltered: suscriptionServicesFiltered,
searchProps,
setSearchProps,
setProgramMentors: setMentorsByService,
mentorsFiltered,
allMentorsAvailable,
subscriptionData,
allSubscriptions: subscriptionData.subscriptions,
queryService: service,
queryMentor: mentor,
}}
/>
</Box>
</Container>
</Container>
);
}

export default MentorshipSchedule;