diff --git a/client/app/factory/list/components/AddBotCard.tsx b/client/app/factory/list/components/AddBotCard.tsx deleted file mode 100644 index 09cb1bc8..00000000 --- a/client/app/factory/list/components/AddBotCard.tsx +++ /dev/null @@ -1,23 +0,0 @@ -'use client'; -import React from 'react'; -import { Card, CardBody } from '@nextui-org/react'; -import { useRouter } from 'next/navigation'; -import { AddBotIcon } from '@/public/icons/AddBotIcon'; - -const BotCard = () => { - const router = useRouter(); - - return ( - router.push(`/factory/edit/new`)} - > - - - - - ); -}; - -export default BotCard; diff --git a/client/app/factory/list/components/BotCard.tsx b/client/app/factory/list/components/BotCard.tsx index 9b66d00a..5c7cd481 100644 --- a/client/app/factory/list/components/BotCard.tsx +++ b/client/app/factory/list/components/BotCard.tsx @@ -142,7 +142,7 @@ const BotCard = (props: { bot: Bot }) => { - +
{bot.name} diff --git a/client/app/factory/list/page.tsx b/client/app/factory/list/page.tsx index 207fd29f..87f2fc33 100644 --- a/client/app/factory/list/page.tsx +++ b/client/app/factory/list/page.tsx @@ -3,19 +3,20 @@ import { Tables } from '@/types/database.types'; import React from 'react'; import { isEmpty, map } from 'lodash'; import BotCard from './components/BotCard'; -import AddBotCard from './components/AddBotCard'; import { useBotList } from '@/app/hooks/useBot'; import FullPageSkeleton from '@/components/FullPageSkeleton'; import { useSearch } from '@/app/contexts/SearchContext'; +import AddBotCard from '@/components/AddBotCard'; +import { useRouter } from 'next/navigation'; declare type Bot = Tables<'bots'>; export default function List() { const { search } = useSearch(); let { data: bots, isLoading, error } = useBotList(true, search); - + const router = useRouter(); if (isLoading) { return ; } @@ -25,7 +26,11 @@ export default function List() { return (
- + { + router.push(`/factory/edit/new`); + }} + /> {!isEmpty(bots) && map(bots, (bot: Bot) => )}
diff --git a/client/app/page.tsx b/client/app/page.tsx index 25c50f1f..da9ea429 100644 --- a/client/app/page.tsx +++ b/client/app/page.tsx @@ -5,10 +5,10 @@ import { isEmpty, map } from 'lodash'; import BotCard from '@/components/BotCard'; import { useBotList } from '@/app/hooks/useBot'; import FullPageSkeleton from '@/components/FullPageSkeleton'; -import BotList from '@/components/BotList'; import { useSearch } from '@/app/contexts/SearchContext'; import { Assistant } from 'petercat-lui'; import { useFingerprint } from './hooks/useFingerprint'; +import PublishBotEntity from '@/components/PublishBotEntity'; declare type Bot = Tables<'bots'>; @@ -66,7 +66,7 @@ export default function Home() { return (
- + {!isEmpty(bots) && map(bots, (bot: Bot) => ( diff --git a/client/components/AddBotCard.tsx b/client/components/AddBotCard.tsx index 8c1654a7..d3e5455d 100644 --- a/client/components/AddBotCard.tsx +++ b/client/components/AddBotCard.tsx @@ -1,13 +1,12 @@ 'use client'; import React from 'react'; -import { Card, CardBody } from '@nextui-org/react'; +import { CardBody } from '@nextui-org/react'; import { AddBotIcon } from '@/public/icons/AddBotIcon'; -const BotCard = (props: { onPress: Function }) => { +import BaseBotCard from './BaseBotCard'; + +const AddBotCard = (props: { onPress: Function }) => { return ( - { props.onPress(); }} @@ -15,8 +14,8 @@ const BotCard = (props: { onPress: Function }) => { - + ); }; -export default BotCard; +export default AddBotCard; diff --git a/client/components/BaseBotCard.tsx b/client/components/BaseBotCard.tsx new file mode 100644 index 00000000..64f702e2 --- /dev/null +++ b/client/components/BaseBotCard.tsx @@ -0,0 +1,23 @@ +'use client'; +import React from 'react'; +import { Card, CardBody } from '@nextui-org/react'; + +const BaseBotCard = (props: { + onPress: Function; + children: React.ReactNode; +}) => { + return ( + { + props.onPress(); + }} + > + {props.children} + + ); +}; + +export default BaseBotCard; diff --git a/client/components/BotCard.tsx b/client/components/BotCard.tsx index 28d154d5..2e72dc60 100644 --- a/client/components/BotCard.tsx +++ b/client/components/BotCard.tsx @@ -44,7 +44,7 @@ const BotCard = (props: {
- +
{bot.name} diff --git a/client/components/Navbar.tsx b/client/components/Navbar.tsx index 08f7b35e..c1597b8d 100644 --- a/client/components/Navbar.tsx +++ b/client/components/Navbar.tsx @@ -8,7 +8,7 @@ import { ShopIcon } from '@/public/icons/ShopIcon'; import { SpaceIcon } from '@/public/icons/SpaceIcon'; import { SearchIcon } from '@/public/icons/SearchIcon'; import { AddIcon } from '@/public/icons/AddIcon'; -import BotList from './BotList'; +import PublishBotEntity from './PublishBotEntity'; import { useSearch } from '@/app/contexts/SearchContext'; export function Navbar() { @@ -113,7 +113,7 @@ export function Navbar() { />
- {!pathname.includes('/factory/list') && } + {!pathname.includes('/factory/list') && } {pathname.includes('/factory/list') && (