Skip to content

Commit

Permalink
Merge pull request #3595 from illacloud/Release/4.1.3
Browse files Browse the repository at this point in the history
Release/4.1.3
  • Loading branch information
Wangtaofeng authored Dec 21, 2023
2 parents 94ea449 + 69021e7 commit 897c218
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 18 deletions.
2 changes: 1 addition & 1 deletion apps/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"author": "ILLA Cloud <[email protected]>",
"license": "Apache-2.0",
"version": "4.1.2",
"version": "4.1.3",
"scripts": {
"dev": "vite --strictPort --force",
"build-cloud": "NODE_OPTIONS=--max-old-space-size=12288 vite build --mode cloud",
Expand Down
1 change: 1 addition & 0 deletions apps/cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@illa-public/user-data": "workspace:*",
"@illa-public/user-role-utils": "workspace:*",
"@illa-public/utils": "workspace:*",
"@illa-public/illa-markdown": "workspace:*",
"@reduxjs/toolkit": "^2.0.1",
"axios": "^1.6.2",
"dayjs": "^1.11.10",
Expand Down
9 changes: 9 additions & 0 deletions apps/cloud/src/assets/page/workspace/change-log-bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const CHANGE_LOG_NUM = 5
94 changes: 94 additions & 0 deletions apps/cloud/src/page/workspace/components/ChangeLogModal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { ILLAMarkdown } from "@illa-public/illa-markdown"
import { FC } from "react"
import { useTranslation } from "react-i18next"
import {
Button,
CloseIcon,
Link,
Modal,
Timeline,
TimelineItem,
getColor,
} from "@illa-design/react"
import ChangeLogIcon from "@/assets/page/workspace/change-log-bg.svg?react"
import { CHANGE_LOG_NUM } from "./constants"
import { ChangeLogModalProps } from "./interface"
import {
changeBgStyle,
changeLogContainerStyle,
closeIconStyle,
contentStyle,
headerStyle,
itemContainerStyle,
itemTitleStyle,
lineContainerStyle,
linkStyle,
modalMaskStyle,
modalStyle,
} from "./style"

const ChangeLogModal: FC<ChangeLogModalProps> = ({ onClose }) => {
const { t } = useTranslation()

const CHANGE_LOGS = Array.from(new Array(CHANGE_LOG_NUM)).map((_, index) => ({
content: t(`page.left.menu.changeLogs.${index + 1}.content`),
title: t(`page.left.menu.changeLogs.${index + 1}.title`),
changeLogLink: t(`page.left.menu.changeLogs.${index + 1}.changeLogLink`),
}))

return (
<Modal
visible
maskClosable={false}
footer={false}
css={modalStyle}
maskStyle={modalMaskStyle}
withoutPadding
>
<div css={changeLogContainerStyle}>
<div css={headerStyle}>
<span css={closeIconStyle} onClick={onClose}>
<CloseIcon size="12px" />
</span>
<span css={changeBgStyle}>
<ChangeLogIcon width="100%" height="100%" />
</span>
</div>
<div css={contentStyle}>
<Timeline>
{Array.isArray(CHANGE_LOGS) &&
CHANGE_LOGS?.map(({ content, changeLogLink, title }, i) => (
<TimelineItem
key={title}
index={i}
css={lineContainerStyle}
dotColor={getColor("techPurple", "01")}
>
<div css={itemContainerStyle}>
<span css={itemTitleStyle}>{title}</span>
<ILLAMarkdown
textString={content}
textColor={getColor("grayBlue", "02")}
urlColor={getColor("grayBlue", "02")}
/>
<Link
href={changeLogLink ?? ""}
css={linkStyle}
colorScheme="white"
target="_blank"
>
<Button colorScheme={getColor("grayBlue", "02")}>
{t("page.left.menu.changeLogs.read_more")}
</Button>
</Link>
</div>
</TimelineItem>
))}
</Timeline>
</div>
</div>
</Modal>
)
}

export default ChangeLogModal
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface ChangeLog {
content: string
title: string
changeLogLink: string
}

export interface ChangeLogModalProps {
onClose: () => void
}
83 changes: 83 additions & 0 deletions apps/cloud/src/page/workspace/components/ChangeLogModal/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { css } from "@emotion/react"
import { applyMobileStyle } from "@illa-public/utils"
import { getColor } from "@illa-design/react"

export const modalStyle = css`
min-width: auto;
width: auto;
${applyMobileStyle(css`
width: 716rem;
min-width: 716rem;
`)}
`
export const modalMaskStyle = css`
background-color: ${getColor("white", "05")};
backdrop-filter: blur(5px);
`

export const changeLogContainerStyle = css`
overflow: hidden;
`

export const headerStyle = css`
position: relative;
`

export const closeIconStyle = css`
position: absolute;
width: 24px;
height: 24px;
line-height: 10px;
text-align: center;
top: 16px;
right: 16px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: ${getColor("grayBlue", "02")};
`
export const contentStyle = css`
overflow-y: auto;
padding: 32px;
max-height: 480px;
width: 488px;
${applyMobileStyle(css`
width: 100%;
`)}
`
export const lineContainerStyle = css`
padding: 0;
margin-bottom: 32px;
&:last-of-type {
margin-bottom: 0;
}
`

export const itemContainerStyle = css`
display: flex;
flex-direction: column;
gap: 8px;
ul,
ol {
padding-left: 16px;
}
`

export const itemTitleStyle = css`
color: ${getColor("grayBlue", "02")};
font-size: 16px;
font-style: normal;
font-weight: 600;
line-height: 24px;
`

export const linkStyle = css`
display: flex;
padding: 0;
`

export const changeBgStyle = css`
display: flex;
width: 100%;
`
26 changes: 21 additions & 5 deletions apps/cloud/src/page/workspace/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
import { LayoutAutoChange } from "@illa-public/layout-auto-change"
import { FC } from "react"
import { FC, useState } from "react"
import ChangeLogModal from "./components/ChangeLogModal"
import { MobileDashBoardLayout } from "./layout/mobile"
import { PCDashBoardLayout } from "./layout/pc/"

const Workspace: FC = () => {
const [changeLogVisible, setChangeLogVisible] = useState<boolean>(false)

const onOpenChangeLogModal = () => {
setChangeLogVisible(true)
}

return (
<LayoutAutoChange
desktopPage={<PCDashBoardLayout />}
mobilePage={<MobileDashBoardLayout />}
/>
<>
<LayoutAutoChange
desktopPage={
<PCDashBoardLayout onOpenChangeLogModal={onOpenChangeLogModal} />
}
mobilePage={
<MobileDashBoardLayout onOpenChangeLogModal={onOpenChangeLogModal} />
}
/>
{changeLogVisible && (
<ChangeLogModal onClose={() => setChangeLogVisible(false)} />
)}
</>
)
}

Expand Down
5 changes: 1 addition & 4 deletions apps/cloud/src/page/workspace/layout/interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { ReactNode } from "react"

export interface WorkspaceLayoutProps {
children: ReactNode
onAddTeam?: () => void
onOpenChangeLogModal: () => void
}
18 changes: 12 additions & 6 deletions apps/cloud/src/page/workspace/layout/mobile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@ import { FC, useState } from "react"
import { useSelector } from "react-redux"
import { Outlet } from "react-router-dom"
import { DashBoardDynamicMenu } from "@/page/workspace/components/DynamicMenu"
import { WorkspaceLayoutProps } from "../interface"

export const MobileDashBoardLayout: FC = () => {
export const MobileDashBoardLayout: FC<WorkspaceLayoutProps> = ({
onOpenChangeLogModal,
}) => {
const isLogin = useSelector(getCurrentUserID)
const [drawerVisible, setDrawerVisible] = useState(false)

const handleClickMenuItem = (key: string) => {
setDrawerVisible(false)
if (key === "change-log") {
onOpenChangeLogModal()
}
}

return (
<MobileCloudDashboardLayout
setDrawerVisible={setDrawerVisible}
drawerVisible={drawerVisible}
bottomComponent={
<BottomList
onClickMenuItemCallback={() => {
setDrawerVisible(false)
}}
/>
<BottomList onClickMenuItemCallback={handleClickMenuItem} />
}
dynamicMenu={
<div>
Expand Down
15 changes: 13 additions & 2 deletions apps/cloud/src/page/workspace/layout/pc/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ import { useModal } from "@illa-design/react"
import { FullSectionLoading } from "@/components/FullSectionLoading"
import { DashBoardDynamicMenu } from "@/page/workspace/components/DynamicMenu"
import { updateTutorialViewed } from "@/services/user"
import { WorkspaceLayoutProps } from "../interface"

export const PCDashBoardLayout: FC = () => {
export const PCDashBoardLayout: FC<WorkspaceLayoutProps> = ({
onOpenChangeLogModal,
}) => {
const currentTeamInfo = useSelector(getCurrentTeamInfo)
const isLogin = useSelector(getCurrentUserID)
const currentUserRole = currentTeamInfo?.myRole ?? USER_ROLE.VIEWER
Expand All @@ -42,6 +45,12 @@ export const PCDashBoardLayout: FC = () => {
ACTION_MANAGE.EDIT_APP,
)

const handleClickMenuItem = (key: string) => {
if (key === "change-log") {
onOpenChangeLogModal()
}
}

useEffect(() => {
if (
!isTutorialViewed &&
Expand Down Expand Up @@ -82,7 +91,9 @@ export const PCDashBoardLayout: FC = () => {
<DashBoardDynamicMenu />
</div>
}
bottomComponent={<BottomList />}
bottomComponent={
<BottomList onClickMenuItemCallback={handleClickMenuItem} />
}
>
{isLogin && (
<Suspense fallback={<FullSectionLoading />}>
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 897c218

Please sign in to comment.