diff --git a/components/cards/AgentCard.tsx b/components/cards/AgentCard.tsx index 252ff43..ee30b96 100644 --- a/components/cards/AgentCard.tsx +++ b/components/cards/AgentCard.tsx @@ -20,7 +20,8 @@ export const AgentCard = ({ community, author, project, - members, + onAddToHome, + isOnHome, tags, shortIntro }: any) => { @@ -43,6 +44,19 @@ export const AgentCard = ({ } + const ActionsSection = () => { + return
+ +
+ } + + + const CardAuthor = () => { if (!author) { if (community) { @@ -74,6 +88,7 @@ export const AgentCard = ({
{ title } +
diff --git a/components/cards/HomeItemCard.tsx b/components/cards/HomeItemCard.tsx index 08c14e9..39f1e5b 100644 --- a/components/cards/HomeItemCard.tsx +++ b/components/cards/HomeItemCard.tsx @@ -1,7 +1,7 @@ import { ProfileHeaderPlaceholder } from '~/components/placeholders/ProfileHeader' import { readexPro } from '~/elements/fonts' import { BannerImage, CompositeImage, Engagements, DynamicIcon, SimpleAvatar, Community, Animation, Author, People, Tags, LargeAvatar } from '~/elements'; -import { getImageUrl } from '~/utils/main'; +import { getImageUrl, getCompositeImageUrl } from '~/utils/main'; import Image from 'next/image'; const MAX_TITLE = 80 @@ -11,6 +11,7 @@ export const HomeItemCard = ({ onPress, isLoading, title, + team, banner, avatar, username, @@ -82,7 +83,7 @@ export const HomeItemCard = ({ } return
- +
{ title }
diff --git a/next.config.mjs b/next.config.mjs index 4fff9a0..c9a0ceb 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -16,6 +16,18 @@ const nextConfig = { { source: "/app/:id([a-z0-9_-]+)/:path*", destination: "https://carmel-app-:id.vercel.app/app/:id/:path*" + }, + { + source: "/agent/:id([a-z0-9_-]+)/", + destination: "https://carmel-agent-main.vercel.app/agent/main/:id/" + }, + { + source: "/agent/:id([a-z0-9_-]+)", + destination: "https://carmel-agent-main.vercel.app/agent/main/:id" + }, + { + source: "/agent/:id([a-z0-9_-]+)/:path*", + destination: "https://carmel-agent-main.vercel.app/agent/main/:id/:path*" } ] }, diff --git a/screens/AgentScreen.tsx b/screens/AgentScreen.tsx index 23a3285..df721e8 100644 --- a/screens/AgentScreen.tsx +++ b/screens/AgentScreen.tsx @@ -33,40 +33,40 @@ export const AgentScreen = ({ auth }: any) => { setOutput({ url }) }, []) - const handleSubmit = async (e: any) => { - e.preventDefault(); + // const handleSubmit = async (e: any) => { + // e.preventDefault(); - const formData = new FormData(e.target) - const params = Object.fromEntries(formData.entries()) - const agent = getAgent() + // const formData = new FormData(e.target) + // const params = Object.fromEntries(formData.entries()) + // const agent = getAgent() - if (!agent) { - return - } + // if (!agent) { + // return + // } - const { result } = await auth.agentAction("run", { params, name: agent.name.toLowerCase() }) + // const { result } = await auth.agentAction("run", { params, name: agent.name.toLowerCase() }) - if (result.error) { - return - } + // if (result.error) { + // return + // } - if (!result.id) { - return - } + // if (!result.id) { + // return + // } - setSessionId(result.id) - setOutput({ url: `${process.env.NEXT_PUBLIC_GATEWAY_URL}/carmel/genres/${result.privId}/output.md` }) - setPrivId(result.privId) - setStarted(true) - } + // setSessionId(result.id) + // setOutput({ url: `${process.env.NEXT_PUBLIC_GATEWAY_URL}/carmel/genres/${result.privId}/output.md` }) + // setPrivId(result.privId) + // setStarted(true) + // } - const progress = () => { - if (!sessionId || !carmel.data.agentsessions) { - return - } + // const progress = () => { + // if (!sessionId || !carmel.data.agentsessions) { + // return + // } - return carmel.data.agentsessions.find((sess: any) => sess.id === sessionId) - } + // return carmel.data.agentsessions.find((sess: any) => sess.id === sessionId) + // } const getAgent = () => { if (carmel.isLoading || !carmel.data || !carmel.data.agents) return @@ -75,136 +75,170 @@ export const AgentScreen = ({ auth }: any) => { return item } - const AgentField = (field: any) => { - return
-
- { field.title }: -
-
- -
-
- } - - const AgentFields = () => { - const agent = getAgent() + // const AgentField = (field: any) => { + // return
+ //
+ // { field.title }: + //
+ //
+ // + //
+ //
+ // } + + // const AgentFields = () => { + // const agent = getAgent() - if (!agent) { - return
- } + // if (!agent) { + // return
+ // } - return agent.params.map((field: any, i: number) => ) - } + // return agent.params.map((field: any, i: number) => ) + // } + + // const StartForm = ({ agent }: any) => { + // return
+ //
+ //
+ // { agent.headline } + //
+ // + //
+ // + //
+ //
+ // requires 5 credits + //
+ //
+ //
+ // } + + // const ProgressStatus = ({ agent }: any) => { + // const updatedProgress = progress() + + // if (!updatedProgress) { + // return
+ // } + + // const { steps, stepId, duration, complete } = updatedProgress.progress + + // if (complete) { + // return
+ //
+ // Complete + //
+ //
+ // + //
+ //
+ // } + + // const step = steps[stepId] + + // return
+ //
+ // Step {stepId + 1} of { steps.length } + //
+ //
+ // { step.message } + //
+ //
+ // } + + // const onCopyLink = () => { + // showSuccessToast("Copied to clipboard") + // } + + // const Results = () => { + // const agent = getAgent() + + // return
+ //
+ // + //
+ // + // + // + //
+ // } + + // const ProgressPanel = ({ agent }: any) => { + // if (isComplete) { + // return + // } + + // const updatedProgress = progress() + + // if (!updatedProgress) { + // return
+ // } + + // const { complete } = updatedProgress.progress + + // if (complete) { + // return + // } + + // return
+ //
+ // + // + //
+ //
+ // } + + const isOnHome = () => { + const agent = getAgent() - const StartForm = ({ agent }: any) => { - return
-
-
- { agent.headline } -
- -
- -
-
- requires 5 credits -
-
-
+ return (auth.isLoggedIn && + auth.profile.home && + auth.profile.home[agent.username]) } - const ProgressStatus = ({ agent }: any) => { - const updatedProgress = progress() - - if (!updatedProgress) { - return
+ const onAddToHome = async () => { + if (!auth.isLoggedIn()) { + router.push("/register") + return } - const { steps, stepId, duration, complete } = updatedProgress.progress + const agent = getAgent() - if (complete) { - return
-
- Complete -
-
- -
-
+ if (isOnHome()) { + router.push(`/agent/${agent.username}`) + return } - const step = steps[stepId] + const result = await auth.accountAction("addtohome", { + details: { + ...agent, + type: "agent" + } + }) - return
-
- Step {stepId + 1} of { steps.length } -
-
- { step.message } -
-
- } - - const onCopyLink = () => { - showSuccessToast("Copied to clipboard") - } + await auth.getFreshProfile() - const Results = () => { - const agent = getAgent() - - return
-
- -
- - - -
+ router.push('/') } - const ProgressPanel = ({ agent }: any) => { - if (isComplete) { - return - } - - const updatedProgress = progress() - - if (!updatedProgress) { - return
- } - - const { complete } = updatedProgress.progress - - if (complete) { - return - } - - return
-
- - -
-
- } const AgentOutput = () => { const agent = getAgent() @@ -221,7 +255,7 @@ export const AgentScreen = ({ auth }: any) => {
{ agent.summary }
- { started ? : } + {/* { started ? : } */}
} @@ -237,7 +271,7 @@ export const AgentScreen = ({ auth }: any) => { return
- +
diff --git a/screens/home/MainHomeScreen.tsx b/screens/home/MainHomeScreen.tsx index cacc979..47d3934 100644 --- a/screens/home/MainHomeScreen.tsx +++ b/screens/home/MainHomeScreen.tsx @@ -12,6 +12,24 @@ import { ListScreen } from '../ListScreen' import { Title, DynamicIcon, InfiniteScrollComponent, readexPro } from '~/elements'; import { useRouter } from 'next/router' +const Header = () => { + return
+ + + { 'Home' } + + +
+ + + +
+
+ } + export const Container = ({ children }: any) => { return (
@@ -19,11 +37,14 @@ export const Container = ({ children }: any) => { wire1 wire2 -
-
- { children } +
+
+
+
+ { children }
+
) } @@ -48,24 +69,28 @@ const EmptyHome = () => { } const onItemPress = (element: any, router: any) => { - router.push(`/app/${element.username}`) + router.push(`/${element.type === "agent" ? 'agent/main' : 'app'}/${element.username}`) } const HomeList = ({ home }: any) => { const items = Object.values(home) const router = useRouter() - return
- onItemPress(element, router) } - />)} - elementsNumber={3} - loader={} - /> -
+ return +
+
+ onItemPress(element, router) } + />)} + elementsNumber={3} + loader={} + /> +
+
+
} export const MainHomeScreen = (props: any) => {