From 791acdda6ccdddfa81946f2ba4264d8d0b02b7f8 Mon Sep 17 00:00:00 2001 From: skywalker Date: Sun, 25 Aug 2024 12:30:46 +0300 Subject: [PATCH] chore(ci): run locally --- .../ui/EditInstrument.page.tsx | 10 +++++++-- .../src/pages/favorite/ui/Favorite.page.tsx | 11 +++++----- client/src/pages/instrument/api/loader.ts | 16 +++++++------- client/src/pages/instrument/index.ts | 4 ++-- .../pages/instrument/ui/Instrument.page.tsx | 7 ++++-- .../ui/styles/Instrument.page.module.css | 2 +- .../ui/RemoveInstrument.button.tsx | 4 ++-- .../ui/ShowInstrument.button.tsx | 7 ++++-- .../instrument-card/ui/InstrumentActions.tsx | 22 ++++++++++--------- 9 files changed, 48 insertions(+), 35 deletions(-) diff --git a/client/src/pages/edit-instrument/ui/EditInstrument.page.tsx b/client/src/pages/edit-instrument/ui/EditInstrument.page.tsx index 4d0ad3a6..bfbffe33 100644 --- a/client/src/pages/edit-instrument/ui/EditInstrument.page.tsx +++ b/client/src/pages/edit-instrument/ui/EditInstrument.page.tsx @@ -17,7 +17,9 @@ export const EditInstrumentPage = () => { return ( <> -

{loader.instrumentForEdit.instrument_name.instrument_name}

+

+ {loader.instrumentForEdit.instrument_name.instrument_name} +

{ />
- + {actionData !== undefined && diff --git a/client/src/pages/favorite/ui/Favorite.page.tsx b/client/src/pages/favorite/ui/Favorite.page.tsx index 5103fdff..19943293 100644 --- a/client/src/pages/favorite/ui/Favorite.page.tsx +++ b/client/src/pages/favorite/ui/Favorite.page.tsx @@ -22,13 +22,12 @@ export const FavoritePage = () => {
{loader.instrumentDetails.map((instrument) => ( - + ))} -
diff --git a/client/src/pages/instrument/api/loader.ts b/client/src/pages/instrument/api/loader.ts index 74fb50a4..8df6e208 100644 --- a/client/src/pages/instrument/api/loader.ts +++ b/client/src/pages/instrument/api/loader.ts @@ -12,26 +12,26 @@ const getInstrumentById = new GetInstrumentByIdApi(); const listFavorite = new ListFavoriteApi(); export const loader: LoaderFunction = async ({ - params + params, }): Promise => { -const instrumentRequest = await getInstrumentById.getInstrumentById( - parseInt(params.instrumentId as string) + const instrumentRequest = await getInstrumentById.getInstrumentById( + parseInt(params.instrumentId as string), ); const listFavoriteRequest = await listFavorite.listFavorite({ - withCredentials: true + withCredentials: true, }); if (instrumentRequest.status !== 200) { throw new Error( - `Failed to extract instrument ID: '${params.instrumentId}'` + `Failed to extract instrument ID: '${params.instrumentId}'`, ); } const instrument = instrumentRequest.data; - const favoriteIds = listFavoriteRequest.data.content - .map(instrument_detail => instrument_detail.instrument_id.instrument_id); - + const favoriteIds = listFavoriteRequest.data.content.map( + (instrument_detail) => instrument_detail.instrument_id.instrument_id, + ); return { instrument: instrument, diff --git a/client/src/pages/instrument/index.ts b/client/src/pages/instrument/index.ts index 6bb1adb5..9bd2d6dc 100644 --- a/client/src/pages/instrument/index.ts +++ b/client/src/pages/instrument/index.ts @@ -1,5 +1,5 @@ import { InstrumentPage } from "./ui/Instrument.page"; -import type { InstrumentLoader } from "./api/loader" +import type { InstrumentLoader } from "./api/loader"; import { loader } from "./api/loader"; -export { InstrumentPage, loader, InstrumentLoader}; +export { InstrumentPage, loader, InstrumentLoader }; diff --git a/client/src/pages/instrument/ui/Instrument.page.tsx b/client/src/pages/instrument/ui/Instrument.page.tsx index 24e03466..169ad7ff 100644 --- a/client/src/pages/instrument/ui/Instrument.page.tsx +++ b/client/src/pages/instrument/ui/Instrument.page.tsx @@ -3,7 +3,11 @@ import styles from "./styles/Instrument.page.module.css"; import { FooterWidget } from "widgets/footer"; import { HeaderWidget } from "widgets/header"; import { useLoaderData } from "react-router-dom"; -import { InstrumentActions, InstrumentCard, InstrumentDescription, InstrumentPhoto } from "shared/instrument-card"; +import { + InstrumentActions, + InstrumentDescription, + InstrumentPhoto, +} from "shared/instrument-card"; import { InstrumentLoader } from "pages/instrument"; export function InstrumentPage() { @@ -32,7 +36,6 @@ export function InstrumentPage() { showButton={false} /> - diff --git a/client/src/pages/instrument/ui/styles/Instrument.page.module.css b/client/src/pages/instrument/ui/styles/Instrument.page.module.css index e9f5bde9..448e26ee 100644 --- a/client/src/pages/instrument/ui/styles/Instrument.page.module.css +++ b/client/src/pages/instrument/ui/styles/Instrument.page.module.css @@ -14,4 +14,4 @@ .instrument__description__wrapper { flex: 1; -} \ No newline at end of file +} diff --git a/client/src/shared/instrument-card-actions/ui/RemoveInstrument.button.tsx b/client/src/shared/instrument-card-actions/ui/RemoveInstrument.button.tsx index 0956a76c..5054eeb2 100644 --- a/client/src/shared/instrument-card-actions/ui/RemoveInstrument.button.tsx +++ b/client/src/shared/instrument-card-actions/ui/RemoveInstrument.button.tsx @@ -18,8 +18,8 @@ export const RemoveInstrumentButton = (props: Props) => { const response = await removeFavoriteApi.removeFavorite( props.instrument.instrument_id, { - withCredentials: true - } + withCredentials: true, + }, ); if (response.status === 200) { diff --git a/client/src/shared/instrument-card-actions/ui/ShowInstrument.button.tsx b/client/src/shared/instrument-card-actions/ui/ShowInstrument.button.tsx index ac8eabc5..57ed60c7 100644 --- a/client/src/shared/instrument-card-actions/ui/ShowInstrument.button.tsx +++ b/client/src/shared/instrument-card-actions/ui/ShowInstrument.button.tsx @@ -18,10 +18,13 @@ export const ShowInstrumentButton = (props: Props) => { }; return ( - ); diff --git a/client/src/shared/instrument-card/ui/InstrumentActions.tsx b/client/src/shared/instrument-card/ui/InstrumentActions.tsx index 69897098..96c00c8e 100644 --- a/client/src/shared/instrument-card/ui/InstrumentActions.tsx +++ b/client/src/shared/instrument-card/ui/InstrumentActions.tsx @@ -29,18 +29,21 @@ export const InstrumentActions = (props: Props) => { return (
- {props.removeButton && jwt.current !== undefined && + {props.removeButton && + jwt.current !== undefined && Jwt.from(jwt.current).toRole() === Role.Editor && ( - + )} - {props.editButton && jwt.current !== undefined && Jwt.from(jwt.current).toRole() === Role.Editor && ( - - )} + {props.editButton && + jwt.current !== undefined && + Jwt.from(jwt.current).toRole() === Role.Editor && ( + + )} {props.favoriteButton && ( { )} - {