Skip to content

Commit

Permalink
remove replace all
Browse files Browse the repository at this point in the history
  • Loading branch information
Janderson Souza Matias authored and Janderson Souza Matias committed Aug 2, 2023
1 parent efc4fbc commit 88cb08c
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 70 deletions.
2 changes: 1 addition & 1 deletion src/pages/Coaches/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const CoachesPage: React.FC = () => {
title={t('Navbar.coaches')}
newButtonValue={t('coach.new-coach')}
onClickNew={() => setNewCoach(true)}
onClickDownload={() => handleDownloadJSON(coaches, t('Navbar.coaches').toLowerCase().replaceAll(' ', '-'))}
onClickDownload={() => handleDownloadJSON(coaches, t('Navbar.coaches').toLowerCase().replace(' ', '-'))}
/>
<CoachForm
onClose={closeForm}
Expand Down
33 changes: 15 additions & 18 deletions src/pages/Competencies/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Loader from "@/components/Base/Loader";
import CompetenceService from "@/services/competence";
import { ICompetence } from "@/types";
import { Box, Center } from "@chakra-ui/react";
import { useEffect, useState } from "react";
import CompetenceForm from "./CompetenceForm";
import CompetenceList from "./CompetenceList";
import HeaderPage from "@/components/HeaderPage";
import { useTranslation } from "react-i18next";
import handleDownloadJSON from "@/common/download";
import Loader from '@/components/Base/Loader';
import CompetenceService from '@/services/competence';
import { ICompetence } from '@/types';
import { Box, Center } from '@chakra-ui/react';
import { useEffect, useState } from 'react';
import CompetenceForm from './CompetenceForm';
import CompetenceList from './CompetenceList';
import HeaderPage from '@/components/HeaderPage';
import { useTranslation } from 'react-i18next';
import handleDownloadJSON from '@/common/download';

const CompetenciesPage: React.FC = () => {
const { t } = useTranslation();
Expand Down Expand Up @@ -56,15 +56,12 @@ const CompetenciesPage: React.FC = () => {
return (
<Box p={4} minH="100vh" flex={1}>
<HeaderPage
subtitle={t("Navbar.questionnaire")}
title={t("Navbar.teaching-practices")}
newButtonValue={t("competence.new-competence")}
subtitle={t('Navbar.questionnaire')}
title={t('Navbar.teaching-practices')}
newButtonValue={t('competence.new-competence')}
onClickNew={() => setNewCompetence(true)}
onClickDownload={() =>
handleDownloadJSON(
competencies,
t("Navbar.teaching-practices").toLowerCase().replaceAll(" ", "-")
)
handleDownloadJSON(competencies, t('Navbar.teaching-practices').toLowerCase().replace(' ', '-'))
}
/>

Expand All @@ -77,7 +74,7 @@ const CompetenciesPage: React.FC = () => {
/>

{isLoadingList ? (
<Center minW={"350px"} h={"200px"}>
<Center minW={'350px'} h={'200px'}>
<Loader />
</Center>
) : (
Expand Down
50 changes: 18 additions & 32 deletions src/pages/Schools/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Loader from "@/components/Base/Loader";
import SchoolService from "@/services/school";
import { ISchool } from "@/types";
import Loader from '@/components/Base/Loader';
import SchoolService from '@/services/school';
import { ISchool } from '@/types';
import {
Box,
Button,
Expand All @@ -12,13 +12,13 @@ import {
ModalFooter,
ModalHeader,
ModalOverlay,
} from "@chakra-ui/react";
import { useEffect, useState } from "react";
import SchoolList from "./SchoolList";
import HeaderPage from "@/components/HeaderPage";
import { useTranslation } from "react-i18next";
import SchoolForm from "./SchoolForm";
import handleDownloadJSON from "@/common/download";
} from '@chakra-ui/react';
import { useEffect, useState } from 'react';
import SchoolList from './SchoolList';
import HeaderPage from '@/components/HeaderPage';
import { useTranslation } from 'react-i18next';
import SchoolForm from './SchoolForm';
import handleDownloadJSON from '@/common/download';

const SchoolsPage: React.FC = () => {
const { t } = useTranslation();
Expand Down Expand Up @@ -60,8 +60,7 @@ const SchoolsPage: React.FC = () => {

const deleteSchool = async () => {
setIsLoadingDelete(true);
if (schoolToDelete)
await SchoolService.DeleteSchool(schoolToDelete?.id || "");
if (schoolToDelete) await SchoolService.DeleteSchool(schoolToDelete?.id || '');
setIsLoadingDelete(false);
onCloseDeleteModal();
loadSchools();
Expand All @@ -74,16 +73,11 @@ const SchoolsPage: React.FC = () => {
return (
<Box p={4} minH="100vh" flex={1}>
<HeaderPage
subtitle={t("Navbar.data")}
title={t("Navbar.schools")}
newButtonValue={t("school.new-school")}
subtitle={t('Navbar.data')}
title={t('Navbar.schools')}
newButtonValue={t('school.new-school')}
onClickNew={() => setNewSchool(true)}
onClickDownload={() =>
handleDownloadJSON(
schools,
t("Navbar.schools").toLowerCase().replaceAll(" ", "-")
)
}
onClickDownload={() => handleDownloadJSON(schools, t('Navbar.schools').toLowerCase().replace(' ', '-'))}
/>
<SchoolForm
onClose={closeForm}
Expand All @@ -92,15 +86,11 @@ const SchoolsPage: React.FC = () => {
isOpen={!!schoolToEdit || newSchool}
/>
{isLoadingList ? (
<Center minW={"350px"} h={"200px"}>
<Center minW={'350px'} h={'200px'}>
<Loader />
</Center>
) : (
<SchoolList
schools={schools}
handleEdit={setSchoolToEdit}
handleDelete={setSchoolToDelete}
/>
<SchoolList schools={schools} handleEdit={setSchoolToEdit} handleDelete={setSchoolToDelete} />
)}
<Modal isOpen={!!schoolToDelete} onClose={onCloseDeleteModal}>
<ModalOverlay />
Expand All @@ -112,11 +102,7 @@ const SchoolsPage: React.FC = () => {
<Button variant="ghost" mr={3} onClick={onCloseDeleteModal}>
Cancel
</Button>
<Button
colorScheme="red"
onClick={deleteSchool}
isLoading={isLoadingDelete}
>
<Button colorScheme="red" onClick={deleteSchool} isLoading={isLoadingDelete}>
Delete
</Button>
</ModalFooter>
Expand Down
31 changes: 13 additions & 18 deletions src/pages/Sync/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Loader from "@/components/Base/Loader";
import SyncService from "@/services/sync";
import { ISync } from "@/types";
import { Box, Center } from "@chakra-ui/react";
import { useEffect, useState } from "react";
import SyncList from "./SyncList";
import { useTranslation } from "react-i18next";
import HeaderPage from "@/components/HeaderPage";
import handleDownloadJSON from "@/common/download";
import Loader from '@/components/Base/Loader';
import SyncService from '@/services/sync';
import { ISync } from '@/types';
import { Box, Center } from '@chakra-ui/react';
import { useEffect, useState } from 'react';
import SyncList from './SyncList';
import { useTranslation } from 'react-i18next';
import HeaderPage from '@/components/HeaderPage';
import handleDownloadJSON from '@/common/download';

const SyncsPage: React.FC = () => {
const { t } = useTranslation();
Expand All @@ -27,17 +27,12 @@ const SyncsPage: React.FC = () => {
return (
<Box p={4} minH="100vh" flex={1}>
<HeaderPage
title={t("Navbar.syncs")}
subtitle={t("Navbar.data")}
onClickDownload={() =>
handleDownloadJSON(
syncs,
t("Navbar.syncs").toLowerCase().replaceAll(" ", "-")
)
}
title={t('Navbar.syncs')}
subtitle={t('Navbar.data')}
onClickDownload={() => handleDownloadJSON(syncs, t('Navbar.syncs').toLowerCase().replace(' ', '-'))}
/>
{isLoadingList ? (
<Center minW={"350px"} h={"200px"}>
<Center minW={'350px'} h={'200px'}>
<Loader />
</Center>
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Teacher/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const TeachersPage: React.FC = () => {
subtitle={t('Navbar.data')}
newButtonValue={t('teacher.new-teacher')}
onClickNew={() => setNewTeacher(true)}
onClickDownload={() => handleDownloadJSON(teachers, t('Navbar.teachers').toLowerCase().replaceAll(' ', '-'))}
onClickDownload={() => handleDownloadJSON(teachers, t('Navbar.teachers').toLowerCase().replace(' ', '-'))}
/>
<TeacherForm
onClose={closeForm}
Expand Down

0 comments on commit 88cb08c

Please sign in to comment.