Skip to content

Commit

Permalink
Merge pull request #3005 from illacloud/merge/hash-tag
Browse files Browse the repository at this point in the history
Merge/hash tag
  • Loading branch information
Wangtaofeng authored Oct 19, 2023
2 parents ec74e59 + 06f9c7e commit 730938e
Show file tree
Hide file tree
Showing 22 changed files with 315 additions and 397 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const appInfoAsync = (
case "updateAppContributeReducer":
case "updateAppPublicReducer":
case "updateAppDeployedReducer":
case "updateAppNameReducer":
case "updateAppInfoReducer": {
Connection.getTextRoom("app", currentAppID)?.send(
getTextMessagePayload(
Expand Down
24 changes: 24 additions & 0 deletions apps/builder/src/page/AI/AIAgent/aiagent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import {
import { RecordEditor } from "@illa-public/record-editor"
import { useUpgradeModal } from "@illa-public/upgrade-modal"
import {
MemberInfo,
USER_ROLE,
USER_STATUS,
getCurrentTeamInfo,
getCurrentUser,
getPlanUtils,
Expand Down Expand Up @@ -1138,6 +1140,28 @@ export const AIAgent: FC = () => {
>
{(shareDialogVisible || contributedDialogVisible) && (
<ShareAgentPC
itemID={idField.value}
onInvitedChange={(userList) => {
const memberListInfo: MemberInfo[] = userList.map(
(user) => {
return {
...user,
userID: "",
nickname: "",
avatar: "",
userStatus: USER_STATUS.PENDING,
permission: {},
createdAt: "",
updatedAt: "",
}
},
)
dispatch(
teamActions.updateInvitedUserReducer(
memberListInfo,
),
)
}}
canUseBillingFeature={canUseUpgradeFeature(
currentTeamInfo.myRole,
getPlanUtils(currentTeamInfo),
Expand Down
68 changes: 38 additions & 30 deletions apps/builder/src/page/AI/AIAgentRun/AIAgentRunMobile/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Avatar } from "@illa-public/avatar"
import { CodeEditor } from "@illa-public/code-editor"
import { ShareAgentMobile, ShareAgentTab } from "@illa-public/invite-modal"
import { ShareAgentMobile } from "@illa-public/invite-modal"
import {
AI_AGENT_TYPE,
Agent,
Expand All @@ -17,7 +17,9 @@ import {
import { RecordEditor } from "@illa-public/record-editor"
import { useUpgradeModal } from "@illa-public/upgrade-modal"
import {
MemberInfo,
USER_ROLE,
USER_STATUS,
getCurrentTeamInfo,
getCurrentUser,
getPlanUtils,
Expand All @@ -30,7 +32,6 @@ import {
canManageInvite,
canUseUpgradeFeature,
openShareAgentModal,
showShareAgentModal,
} from "@illa-public/user-role-utils"
import {
formatNumForAgent,
Expand Down Expand Up @@ -158,7 +159,6 @@ export const AIAgentRunMobile: FC = () => {
currentTeamInfo?.totalTeamLicense?.teamLicenseAllPaid,
)

const teamInfo = useSelector(getCurrentTeamInfo)!!
const dispatch = useDispatch()

const { sendMessage, generationMessage, chatMessages, reconnect, connect } =
Expand Down Expand Up @@ -215,12 +215,8 @@ export const AIAgentRunMobile: FC = () => {
>
{shareDialogVisible && (
<ShareAgentMobile
canUseBillingFeature={canUseUpgradeFeature(
teamInfo.myRole,
getPlanUtils(teamInfo),
teamInfo.totalTeamLicense.teamLicensePurchased,
teamInfo.totalTeamLicense.teamLicenseAllPaid,
)}
canUseBillingFeature={canUseBillingFeature}
itemID={agent.aiAgentID}
title={t(
"user_management.modal.social_media.default_text.agent",
{
Expand All @@ -234,22 +230,23 @@ export const AIAgentRunMobile: FC = () => {
setShareDialogVisible(false)
}}
canInvite={canManageInvite(
teamInfo.myRole,
teamInfo.permission.allowEditorManageTeamMember,
teamInfo.permission.allowViewerManageTeamMember,
currentTeamInfo.myRole,
currentTeamInfo.permission.allowEditorManageTeamMember,
currentTeamInfo.permission.allowViewerManageTeamMember,
)}
defaultTab={ShareAgentTab.SHARE_WITH_TEAM}
defaultInviteUserRole={USER_ROLE.VIEWER}
teamID={teamInfo.id}
currentUserRole={teamInfo.myRole}
defaultBalance={teamInfo.currentTeamLicense.balance}
defaultAllowInviteLink={teamInfo.permission.inviteLinkEnabled}
teamID={currentTeamInfo.id}
currentUserRole={currentTeamInfo.myRole}
defaultBalance={currentTeamInfo.currentTeamLicense.balance}
defaultAllowInviteLink={
currentTeamInfo.permission.inviteLinkEnabled
}
onInviteLinkStateChange={(enableInviteLink) => {
dispatch(
teamActions.updateTeamMemberPermissionReducer({
teamID: teamInfo.id,
teamID: currentTeamInfo.id,
newPermission: {
...teamInfo.permission,
...currentTeamInfo.permission,
inviteLinkEnabled: enableInviteLink,
},
}),
Expand All @@ -266,6 +263,8 @@ export const AIAgentRunMobile: FC = () => {
)
newUrl.searchParams.set("token", getAuthToken())
window.open(newUrl, "_blank")
} else {
setCurrentMarketplaceInfo(undefined)
}
field.onChange(isAgentContributed)
}}
Expand All @@ -281,7 +280,7 @@ export const AIAgentRunMobile: FC = () => {
copyToClipboard(
t("user_management.modal.custom_copy_text_agent_invite", {
userName: currentUserInfo.nickname,
teamName: teamInfo.name,
teamName: currentTeamInfo.name,
inviteLink: link,
}),
)
Expand Down Expand Up @@ -311,9 +310,9 @@ export const AIAgentRunMobile: FC = () => {
onBalanceChange={(balance) => {
dispatch(
teamActions.updateTeamMemberSubscribeReducer({
teamID: teamInfo.id,
teamID: currentTeamInfo.id,
subscribeInfo: {
...teamInfo.currentTeamLicense,
...currentTeamInfo.currentTeamLicense,
balance: balance,
},
}),
Expand All @@ -330,6 +329,21 @@ export const AIAgentRunMobile: FC = () => {
},
)
}}
onInvitedChange={(userList) => {
const memberListInfo: MemberInfo[] = userList.map((user) => {
return {
...user,
userID: "",
nickname: "",
avatar: "",
userStatus: USER_STATUS.PENDING,
permission: {},
createdAt: "",
updatedAt: "",
}
})
dispatch(teamActions.updateInvitedUserReducer(memberListInfo))
}}
teamPlan={getPlanUtils(currentTeamInfo)}
/>
)}
Expand Down Expand Up @@ -691,13 +705,7 @@ export const AIAgentRunMobile: FC = () => {
)}
</div>
)}
{showShareAgentModal(
teamInfo,
agent.teamID === teamInfo.id
? teamInfo.myRole
: USER_ROLE.GUEST,
field.value,
) && (
{(canUseBillingFeature || field.value) && (
<div
css={shareContainerStyle}
onClick={() => {
Expand All @@ -711,7 +719,7 @@ export const AIAgentRunMobile: FC = () => {
)
if (
!openShareAgentModal(
teamInfo,
currentTeamInfo,
currentTeamInfo.id === agent.teamID
? currentTeamInfo.myRole
: USER_ROLE.GUEST,
Expand Down
76 changes: 50 additions & 26 deletions apps/builder/src/page/AI/AIAgentRun/AIAgentRunPC/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import {
import { RecordEditor } from "@illa-public/record-editor"
import { useUpgradeModal } from "@illa-public/upgrade-modal"
import {
MemberInfo,
USER_ROLE,
USER_STATUS,
getCurrentTeamInfo,
getCurrentUser,
getPlanUtils,
Expand Down Expand Up @@ -150,8 +152,6 @@ export const AIAgentRunPC: FC = () => {
currentTeamInfo?.totalTeamLicense?.teamLicenseAllPaid,
)

const teamInfo = useSelector(getCurrentTeamInfo)!!

const { t } = useTranslation()

const dispatch = useDispatch()
Expand All @@ -167,11 +167,27 @@ export const AIAgentRunPC: FC = () => {
>
{shareDialogVisible && (
<ShareAgentPC
itemID={agent.aiAgentID}
onInvitedChange={(userList) => {
const memberListInfo: MemberInfo[] = userList.map((user) => {
return {
...user,
userID: "",
nickname: "",
avatar: "",
userStatus: USER_STATUS.PENDING,
permission: {},
createdAt: "",
updatedAt: "",
}
})
dispatch(teamActions.updateInvitedUserReducer(memberListInfo))
}}
canUseBillingFeature={canUseUpgradeFeature(
teamInfo.myRole,
getPlanUtils(teamInfo),
teamInfo.totalTeamLicense.teamLicensePurchased,
teamInfo.totalTeamLicense.teamLicenseAllPaid,
currentTeamInfo.myRole,
getPlanUtils(currentTeamInfo),
currentTeamInfo.totalTeamLicense.teamLicensePurchased,
currentTeamInfo.totalTeamLicense.teamLicenseAllPaid,
)}
title={t(
"user_management.modal.social_media.default_text.agent",
Expand All @@ -186,21 +202,23 @@ export const AIAgentRunPC: FC = () => {
setShareDialogVisible(false)
}}
canInvite={canManageInvite(
teamInfo.myRole,
teamInfo.permission.allowEditorManageTeamMember,
teamInfo.permission.allowViewerManageTeamMember,
currentTeamInfo.myRole,
currentTeamInfo.permission.allowEditorManageTeamMember,
currentTeamInfo.permission.allowViewerManageTeamMember,
)}
defaultInviteUserRole={USER_ROLE.VIEWER}
teamID={teamInfo.id}
currentUserRole={teamInfo.myRole}
defaultBalance={teamInfo.currentTeamLicense.balance}
defaultAllowInviteLink={teamInfo.permission.inviteLinkEnabled}
teamID={currentTeamInfo.id}
currentUserRole={currentTeamInfo.myRole}
defaultBalance={currentTeamInfo.currentTeamLicense.balance}
defaultAllowInviteLink={
currentTeamInfo.permission.inviteLinkEnabled
}
onInviteLinkStateChange={(enableInviteLink) => {
dispatch(
teamActions.updateTeamMemberPermissionReducer({
teamID: teamInfo.id,
teamID: currentTeamInfo.id,
newPermission: {
...teamInfo.permission,
...currentTeamInfo.permission,
inviteLinkEnabled: enableInviteLink,
},
}),
Expand All @@ -217,6 +235,8 @@ export const AIAgentRunPC: FC = () => {
)
newUrl.searchParams.set("token", getAuthToken())
window.open(newUrl, "_blank")
} else {
setCurrentMarketplaceInfo(undefined)
}
field.onChange(isAgentContributed)
}}
Expand All @@ -232,7 +252,7 @@ export const AIAgentRunPC: FC = () => {
copyToClipboard(
t("user_management.modal.custom_copy_text_agent_invite", {
userName: currentUserInfo.nickname,
teamName: teamInfo.name,
teamName: currentTeamInfo.name,
inviteLink: link,
}),
)
Expand Down Expand Up @@ -262,9 +282,9 @@ export const AIAgentRunPC: FC = () => {
onBalanceChange={(balance) => {
dispatch(
teamActions.updateTeamMemberSubscribeReducer({
teamID: teamInfo.id,
teamID: currentTeamInfo.id,
subscribeInfo: {
...teamInfo.currentTeamLicense,
...currentTeamInfo.currentTeamLicense,
balance: balance,
},
}),
Expand Down Expand Up @@ -339,8 +359,10 @@ export const AIAgentRunPC: FC = () => {
render={({ field }) => (
<div css={agentMenuContainerStyle}>
{showShareAgentModal(
teamInfo,
agent.teamID === teamInfo.id ? teamInfo.myRole : USER_ROLE.GUEST,
currentTeamInfo,
agent.teamID === currentTeamInfo.id
? currentTeamInfo.myRole
: USER_ROLE.GUEST,
field.value,
) && (
<Button
Expand All @@ -357,7 +379,7 @@ export const AIAgentRunPC: FC = () => {
)
if (
!openShareAgentModal(
teamInfo,
currentTeamInfo,
currentTeamInfo.id === agent.teamID
? currentTeamInfo.myRole
: USER_ROLE.GUEST,
Expand Down Expand Up @@ -450,7 +472,7 @@ export const AIAgentRunPC: FC = () => {
try {
const newAgent = await forkAIAgentToTeam(agent.aiAgentID)
navigate(
`/${teamInfo.identifier}/ai-agent/${newAgent.data.aiAgentID}`,
`/${currentTeamInfo.identifier}/ai-agent/${newAgent.data.aiAgentID}`,
)
} catch (e) {
message.error({
Expand Down Expand Up @@ -733,11 +755,13 @@ export const AIAgentRunPC: FC = () => {
render={({ field: contributedField }) => (
<div css={rightPanelContainerStyle}>
<PreviewChat
showShareDialog={showShareAgentModalOnlyForShare(teamInfo)}
showShareDialog={showShareAgentModalOnlyForShare(
currentTeamInfo,
)}
showContributeDialog={showShareAgentModal(
teamInfo,
agent.teamID === teamInfo.id
? teamInfo.myRole
currentTeamInfo,
agent.teamID === currentTeamInfo.id
? currentTeamInfo.myRole
: USER_ROLE.GUEST,
contributedField.value,
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { ILLA_MIXPANEL_EVENT_TYPE } from "@illa-public/mixpanel-utils"
import { FC, useState } from "react"
import { PenIcon } from "@illa-design/react"
import { AppSettingModal } from "@/page/App/components/PageNavBar/AppSettingModal"
import { AppNameProps } from "@/page/App/components/PageNavBar/interface"
import { trackInEditor } from "@/utils/mixpanelHelper"
import { AppNameProps } from "./interface"
import { nameContainerStyle, nameStyle } from "./style"

export const AppName: FC<AppNameProps> = (props) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { DashboardApp } from "@/redux/currentApp/appInfo/appInfoState"

export interface AppNameProps {
appInfo: DashboardApp
}
Loading

0 comments on commit 730938e

Please sign in to comment.