Refactored card component on components and flows
This commit is contained in:
parent
b3327f5ed5
commit
0e9cf8e797
8 changed files with 9 additions and 36 deletions
|
|
@ -10,9 +10,7 @@ import {
|
||||||
} from "../ui/card";
|
} from "../ui/card";
|
||||||
|
|
||||||
export const CardComponent = ({
|
export const CardComponent = ({
|
||||||
isFlow,
|
|
||||||
data,
|
data,
|
||||||
id,
|
|
||||||
onDelete,
|
onDelete,
|
||||||
button,
|
button,
|
||||||
}: cardComponentPropsType): JSX.Element => {
|
}: cardComponentPropsType): JSX.Element => {
|
||||||
|
|
@ -44,11 +42,11 @@ export const CardComponent = ({
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
|
|
||||||
{isFlow && (
|
{button && (
|
||||||
<CardFooter>
|
<CardFooter>
|
||||||
<div className="card-component-footer-arrangement">
|
<div className="card-component-footer-arrangement">
|
||||||
<div className="card-component-footer"></div>
|
<div className="card-component-footer"></div>
|
||||||
{button && button}
|
{button}
|
||||||
</div>
|
</div>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
import { useContext } from "react";
|
import { useContext } from "react";
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
import { CardComponent } from "../../../../components/cardComponent";
|
import { CardComponent } from "../../../../components/cardComponent";
|
||||||
import CardsWrapComponent from "../../../../components/cardsWrapComponent";
|
import CardsWrapComponent from "../../../../components/cardsWrapComponent";
|
||||||
import IconComponent from "../../../../components/genericIconComponent";
|
|
||||||
import { Button } from "../../../../components/ui/button";
|
|
||||||
import { alertContext } from "../../../../contexts/alertContext";
|
import { alertContext } from "../../../../contexts/alertContext";
|
||||||
import { TabsContext } from "../../../../contexts/tabsContext";
|
import { TabsContext } from "../../../../contexts/tabsContext";
|
||||||
|
|
||||||
|
|
@ -37,22 +34,6 @@ export default function ComponentsComponent() {
|
||||||
<CardComponent
|
<CardComponent
|
||||||
key={idx}
|
key={idx}
|
||||||
data={flow}
|
data={flow}
|
||||||
id={flow.id}
|
|
||||||
button={
|
|
||||||
<Link to={"/flow/" + flow.id}>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
className="whitespace-nowrap "
|
|
||||||
>
|
|
||||||
<IconComponent
|
|
||||||
name="ExternalLink"
|
|
||||||
className="main-page-nav-button"
|
|
||||||
/>
|
|
||||||
Edit Flow
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
}
|
|
||||||
onDelete={() => {
|
onDelete={() => {
|
||||||
removeFlow(flow.id);
|
removeFlow(flow.id);
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,7 @@ export default function FlowsComponent() {
|
||||||
.map((flow, idx) => (
|
.map((flow, idx) => (
|
||||||
<CardComponent
|
<CardComponent
|
||||||
key={idx}
|
key={idx}
|
||||||
isFlow
|
|
||||||
data={flow}
|
data={flow}
|
||||||
id={flow.id}
|
|
||||||
button={
|
button={
|
||||||
<Link to={"/flow/" + flow.id}>
|
<Link to={"/flow/" + flow.id}>
|
||||||
<Button
|
<Button
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { getStoreComponents } from "../../../../controllers/API";
|
||||||
import { storeComponent } from "../../../../types/store";
|
import { storeComponent } from "../../../../types/store";
|
||||||
import { MarketCardComponent } from "../../../StorePage/components/market-card";
|
import { MarketCardComponent } from "../../../StorePage/components/market-card";
|
||||||
|
|
||||||
export default function AddedComponents(): JSX.Element {
|
export default function FromStore(): JSX.Element {
|
||||||
const [data, setData] = useState<storeComponent[]>([]);
|
const [data, setData] = useState<storeComponent[]>([]);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const { setErrorData } = useContext(alertContext);
|
const { setErrorData } = useContext(alertContext);
|
||||||
|
|
@ -35,8 +35,8 @@ export default function HomePage(): JSX.Element {
|
||||||
|
|
||||||
if (hasStore) {
|
if (hasStore) {
|
||||||
sidebarNavItems.push({
|
sidebarNavItems.push({
|
||||||
title: "Added Components",
|
title: "From Store",
|
||||||
href: "/added-components",
|
href: "/from-store",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,9 +89,7 @@ export const MarketCardComponent = ({
|
||||||
setSuccessData({ title: `${name} Installed` });
|
setSuccessData({ title: `${name} Installed` });
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
setInstalled(true);
|
setInstalled(true);
|
||||||
setTimeout(() => {
|
if (!data.is_component) navigate("/flow/" + id);
|
||||||
navigate("/flow/" + id);
|
|
||||||
}, 500);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ import ApiKeysPage from "./pages/ApiKeysPage";
|
||||||
import CommunityPage from "./pages/CommunityPage";
|
import CommunityPage from "./pages/CommunityPage";
|
||||||
import FlowPage from "./pages/FlowPage";
|
import FlowPage from "./pages/FlowPage";
|
||||||
import HomePage from "./pages/MainPage";
|
import HomePage from "./pages/MainPage";
|
||||||
import AddedComponents from "./pages/MainPage/components/added-components";
|
|
||||||
import ComponentsComponent from "./pages/MainPage/components/components";
|
import ComponentsComponent from "./pages/MainPage/components/components";
|
||||||
import FlowsComponent from "./pages/MainPage/components/flows";
|
import FlowsComponent from "./pages/MainPage/components/flows";
|
||||||
|
import FromStore from "./pages/MainPage/components/from-store";
|
||||||
import ProfileSettingsPage from "./pages/ProfileSettingsPage";
|
import ProfileSettingsPage from "./pages/ProfileSettingsPage";
|
||||||
import StorePage from "./pages/StorePage";
|
import StorePage from "./pages/StorePage";
|
||||||
import ViewPage from "./pages/ViewPage";
|
import ViewPage from "./pages/ViewPage";
|
||||||
|
|
@ -42,10 +42,10 @@ const Router = () => {
|
||||||
<Route path="flows" element={<FlowsComponent />} />
|
<Route path="flows" element={<FlowsComponent />} />
|
||||||
<Route path="components" element={<ComponentsComponent />} />
|
<Route path="components" element={<ComponentsComponent />} />
|
||||||
<Route
|
<Route
|
||||||
path="added-components"
|
path="from-store"
|
||||||
element={
|
element={
|
||||||
<StoreGuard>
|
<StoreGuard>
|
||||||
<AddedComponents />
|
<FromStore />
|
||||||
</StoreGuard>
|
</StoreGuard>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -552,9 +552,7 @@ export type groupDataType = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type cardComponentPropsType = {
|
export type cardComponentPropsType = {
|
||||||
isFlow?: boolean;
|
|
||||||
data: FlowType;
|
data: FlowType;
|
||||||
id: string;
|
|
||||||
onDelete?: () => void;
|
onDelete?: () => void;
|
||||||
button?: JSX.Element;
|
button?: JSX.Element;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue