feat: cards, attributes and modules
This commit is contained in:
1
src/pages/CardPage/index.ts
Normal file
1
src/pages/CardPage/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { CardPage } from "./ui/CardPage.tsx";
|
||||
38
src/pages/CardPage/ui/CardPage.tsx
Normal file
38
src/pages/CardPage/ui/CardPage.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import { useParams } from "@tanstack/react-router";
|
||||
import { CardPageContextProvider, useCardPageContext } from "../../CardsPage/contexts/CardPageContext.tsx";
|
||||
import ProductAndServiceTab from "../../CardsPage/tabs/ProductAndServiceTab/ProductAndServiceTab.tsx";
|
||||
import React, { FC, useEffect } from "react";
|
||||
import { CardService } from "../../../client";
|
||||
|
||||
export type Props = {
|
||||
cardId: number;
|
||||
};
|
||||
const CardPageContent: FC<Props> = ({ cardId }) => {
|
||||
const { setSelectedCard } = useCardPageContext();
|
||||
useEffect(() => {
|
||||
CardService.getCardById({ cardId }).then(card => {
|
||||
setSelectedCard(card);
|
||||
});
|
||||
}, []);
|
||||
return <ProductAndServiceTab />;
|
||||
};
|
||||
|
||||
const CardPageWrapper: FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
return (
|
||||
<CardPageContextProvider
|
||||
refetchCards={async () => {
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</CardPageContextProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export const CardPage = () => {
|
||||
const { dealId } = useParams({ strict: false });
|
||||
return (
|
||||
<CardPageWrapper>
|
||||
<CardPageContent cardId={parseInt(dealId || "-1")} />
|
||||
</CardPageWrapper>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user