Skip to content

Commit

Permalink
chore(ci): run locally
Browse files Browse the repository at this point in the history
  • Loading branch information
bas-kirill committed Aug 25, 2024
1 parent 8234ed2 commit 791acdd
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 35 deletions.
10 changes: 8 additions & 2 deletions client/src/pages/edit-instrument/ui/EditInstrument.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const EditInstrumentPage = () => {
return (
<>
<HeaderWidget />
<h1 className={styles.h1}>{loader.instrumentForEdit.instrument_name.instrument_name}</h1>
<h1 className={styles.h1}>
{loader.instrumentForEdit.instrument_name.instrument_name}
</h1>

<div className={styles.edit_instrument__wrapper}>
<img
Expand Down Expand Up @@ -195,7 +197,11 @@ export const EditInstrumentPage = () => {
/>
</div>

<input type="submit" value="Edit" className={styles.edit_instrument__button} />
<input
type="submit"
value="Edit"
className={styles.edit_instrument__button}
/>
</Form>
</div>
{actionData !== undefined &&
Expand Down
11 changes: 5 additions & 6 deletions client/src/pages/favorite/ui/Favorite.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ export const FavoritePage = () => {

<div className={styles.instruments__wrapper}>
{loader.instrumentDetails.map((instrument) => (
<InstrumentCard
key={instrument.instrument_id.instrument_id}
instrument={instrument}
favorite={true}
/>
<InstrumentCard
key={instrument.instrument_id.instrument_id}
instrument={instrument}
favorite={true}
/>
))}

</div>

<FooterWidget />
Expand Down
16 changes: 8 additions & 8 deletions client/src/pages/instrument/api/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ const getInstrumentById = new GetInstrumentByIdApi();
const listFavorite = new ListFavoriteApi();

export const loader: LoaderFunction = async ({
params
params,
}): Promise<InstrumentLoader> => {
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,
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/instrument/index.ts
Original file line number Diff line number Diff line change
@@ -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 };
7 changes: 5 additions & 2 deletions client/src/pages/instrument/ui/Instrument.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -32,7 +36,6 @@ export function InstrumentPage() {
showButton={false}
/>
</div>

</div>
<FooterWidget />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

.instrument__description__wrapper {
flex: 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ export const ShowInstrumentButton = (props: Props) => {
};

return (
<button className={`
<button
className={`
${actionBtnStyle.action__button}
${styles.show_instrument__button}
`} onClick={handleOnClick}>
`}
onClick={handleOnClick}
>
Show
</button>
);
Expand Down
22 changes: 12 additions & 10 deletions client/src/shared/instrument-card/ui/InstrumentActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@ export const InstrumentActions = (props: Props) => {

return (
<div className={styles.actions__wrapper}>
{props.removeButton && jwt.current !== undefined &&
{props.removeButton &&
jwt.current !== undefined &&
Jwt.from(jwt.current).toRole() === Role.Editor && (
<RemoveInstrumentButton
instrument={props.instrument}
setErrorModal={setErrorModal}
setSuccessModal={setSuccessModal}
/>
<RemoveInstrumentButton
instrument={props.instrument}
setErrorModal={setErrorModal}
setSuccessModal={setSuccessModal}
/>
)}

{props.editButton && jwt.current !== undefined && Jwt.from(jwt.current).toRole() === Role.Editor && (
<EditInstrumentButton instrument={props.instrument} />
)}
{props.editButton &&
jwt.current !== undefined &&
Jwt.from(jwt.current).toRole() === Role.Editor && (
<EditInstrumentButton instrument={props.instrument} />
)}

{props.favoriteButton && (
<FavoriteButton
Expand All @@ -53,7 +56,6 @@ export const InstrumentActions = (props: Props) => {
<ShowInstrumentButton instrument={props.instrument} />
)}


<ModalWidget
opened={errorModal}
closeModal={() => {
Expand Down

0 comments on commit 791acdd

Please sign in to comment.