Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
Merge branch 'fix/contribute' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Wangtaofeng committed May 6, 2024
2 parents 5684641 + 1a395e3 commit 10c5f2e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { App, Button, Input, Modal } from "antd"
import { FC } from "react"
import { useTranslation } from "react-i18next"
import { CopyIcon } from "@illa-public/icon"
import { ShareBlockPC } from "@illa-public/market-share"
import { LayoutAutoChange } from "@illa-public/layout-auto-change"
import { ShareBlockMobile, ShareBlockPC } from "@illa-public/market-share"
import {
COPY_STATUS,
copyToClipboard,
Expand Down Expand Up @@ -97,9 +98,19 @@ const ShareContentModal: FC<IShareContentProps> = ({
</Button>
</div>
</div>
<ShareBlockPC
title={shareTitle}
shareUrl={getAgentPublicLink(tipiID)}
<LayoutAutoChange
desktopPage={
<ShareBlockPC
title={shareTitle}
shareUrl={getAgentPublicLink(tipiID)}
/>
}
mobilePage={
<ShareBlockMobile
title={shareTitle}
shareUrl={getAgentPublicLink(tipiID)}
/>
}
/>
</div>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
import { FC, useContext, useState } from "react"
import { useFormContext, useWatch } from "react-hook-form"
import { useTranslation } from "react-i18next"
import { showShareAgentModal } from "@illa-public/user-role-utils"
import EditPanelLayout from "@/Layout/EditPanelLayout"
import MobileFirstPageLayout from "@/Layout/Workspace/mobile/module/FistPageLayout"
import MobileSecondPageLayout from "@/Layout/Workspace/mobile/module/SecondPageLayout"
import { useGetCurrentTeamInfo } from "@/utils/team"
import { AgentWSContext } from "../../../../context/AgentWSContext"
import ContributeButton from "../../../components/ContributeButton"
import { IAgentForm } from "../../../interface"
import { EditPanelContent } from "../../../modules/EditPanel/content"
import PreviewChatHistory from "../../../modules/PreviewChatHistory"
import ActionGroup from "../ActionGroup"
import { MOBILE_EDIT_PAGE_STEP } from "./interface"
import { mobileEditPanelContainerStyle } from "./style"
import { mobileEditPanelContainerStyle, placeholderDivStyle } from "./style"

const MobileEditPanel: FC = () => {
const { control } = useFormContext<IAgentForm>()
const currentTeamInfo = useGetCurrentTeamInfo()

const { t } = useTranslation()
const [aiAgentID, agentName] = useWatch({
const [aiAgentID, agentName, publishedToMarketplace] = useWatch({
control,
name: ["aiAgentID", "name"],
name: ["aiAgentID", "name", "publishedToMarketplace"],
})

const { leaveRoom } = useContext(AgentWSContext)

const showContributeDialog =
currentTeamInfo &&
showShareAgentModal(
currentTeamInfo,
currentTeamInfo.myRole,
publishedToMarketplace,
)

const [currentStep, setCurrentStep] = useState<MOBILE_EDIT_PAGE_STEP>(
MOBILE_EDIT_PAGE_STEP.BASIC,
)
Expand All @@ -42,7 +53,13 @@ const MobileEditPanel: FC = () => {
{currentStep === MOBILE_EDIT_PAGE_STEP.BASIC && (
<MobileFirstPageLayout
title={aiAgentID ? agentName : t("dashboard.button.blank-agent")}
headerExtra={<ContributeButton isMobile />}
headerExtra={
!!aiAgentID && showContributeDialog ? (
<ContributeButton isMobile />
) : (
<div css={placeholderDivStyle} />
)
}
>
<EditPanelLayout
customWidth="100%"
Expand All @@ -62,7 +79,13 @@ const MobileEditPanel: FC = () => {
<MobileSecondPageLayout
title={t("homepage.edit_tipi.mobile_preview.preview")}
onClickClose={onClickClosePreviewPage}
headerExtra={<ContributeButton isMobile />}
headerExtra={
!!aiAgentID && showContributeDialog ? (
<ContributeButton isMobile />
) : (
<div css={placeholderDivStyle} />
)
}
>
<PreviewChatHistory />
</MobileSecondPageLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ export const mobileEditPanelContainerStyle = css`
width: 100%;
padding: 20px;
`

export const placeholderDivStyle = css`
width: 40px;
flex: none;
`

0 comments on commit 10c5f2e

Please sign in to comment.