Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 43eb5b7

Browse files
Added back button in your apps.
1 parent 0311357 commit 43eb5b7

File tree

6 files changed

+79
-25
lines changed

6 files changed

+79
-25
lines changed

‎client/packages/lowcoder/src/components/TypographyText.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ const StyledTypographyText = styled(AntdTypographyText)`
4040
`;
4141

4242
export const TypographyText = (props: {
43-
value: string;
44-
editing: boolean;
45-
onChange: (value: string) => void;
43+
value?: string;
44+
editing?: boolean;
45+
onChange?: (value: string) => void;
4646
}) => (
4747
<StyledTypographyText
4848
title={props.value}

‎client/packages/lowcoder/src/pages/ApplicationV2/HomeCardView.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from "styled-components";
22
import { HomeRes } from "./HomeLayout";
3-
import { HomeResCard} from "./HomeResCard";
4-
import { MarketplaceResCard} from "./MarketplaceResCard";
3+
import {Back, HomeResCard} from "./HomeResCard";
4+
import { MarketplaceResCard} from "./MarketplaceResCard";
55
import React, { useState } from "react";
66
import { MoveToFolderModal } from "./MoveToFolderModal";
77

@@ -19,12 +19,13 @@ const ApplicationCardsWrapper = styled.div`
1919
}
2020
`;
2121

22-
export function HomeCardView(props: { resources: HomeRes[], setModify?: any, modify?: boolean }) {
23-
const {setModify, modify} = props;
22+
export function HomeCardView(props: { resources: HomeRes[], setModify?: any, modify?: boolean,mode?: string }) {
23+
const {setModify, modify,mode} = props;
2424
const [needMoveRes, setNeedMoveRes] = useState<HomeRes | undefined>(undefined);
2525

2626
return (
2727
<ApplicationCardsWrapper>
28+
<Back mode={mode!}/>
2829
{props.resources.map((res) => (
2930
res.isMarketplace ?
3031
<MarketplaceResCard key={res.id} res={res} /> :

‎client/packages/lowcoder/src/pages/ApplicationV2/HomeLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,9 @@ export function HomeLayout(props: HomeLayoutProps) {
635635
{mode !== "marketplace" && (
636636
<>
637637
{layout === "list" ? (
638-
<HomeTableView resources={resList} setModify={setModify} modify={modify!}/>
638+
<HomeTableView resources={resList} setModify={setModify} modify={modify!}mode={mode}/>
639639
) : (
640-
<HomeCardView resources={resList} setModify={setModify} modify={modify!} />
640+
<HomeCardView resources={resList} setModify={setModify} modify={modify!} mode={mode}/>
641641
)}
642642
</>
643643
)}

‎client/packages/lowcoder/src/pages/ApplicationV2/HomeResCard.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { HomeRes } from "./HomeLayout";
88
import { HomeResTypeEnum } from "../../types/homeRes";
99
import { updateFolder } from "../../redux/reduxActions/folderActions";
1010
import {
11+
backFolderViewClick,
1112
handleAppEditClick,
1213
handleAppViewClick,
1314
handleFolderViewClick,
@@ -23,6 +24,7 @@ import { TypographyText } from "../../components/TypographyText";
2324
import { useParams } from "react-router-dom";
2425
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances";
2526
import { colorPickerEvent } from "@lowcoder-ee/comps/comps/mediaComp/colorPickerComp";
27+
import {FolderIcon} from "icons";
2628

2729
const EditButton = styled(TacoButton)`
2830
width: 52px;
@@ -259,3 +261,29 @@ export function HomeResCard(props: { res: HomeRes; onMove: (res: HomeRes) => voi
259261
</Wrapper>
260262
);
261263
}
264+
265+
export function Back(props: { mode: string }) {
266+
const { mode } = props;
267+
return mode === "folder" ?
268+
<Wrapper style={{cursor: "pointer"}}>
269+
<Card>
270+
<FolderIcon width={"42px"} height={"42px"} style={
271+
{
272+
marginRight: "10px",
273+
flexShrink: 0
274+
}
275+
} />
276+
<CardInfo
277+
onClick={(e) => {
278+
backFolderViewClick();
279+
}}
280+
>
281+
<TypographyText
282+
/>
283+
<h1 style={{fontSize:"x-large"}}>...</h1>
284+
<AppTimeOwnerInfoLabel title={""}></AppTimeOwnerInfoLabel>
285+
</CardInfo>
286+
</Card>
287+
</Wrapper>
288+
: <></>;
289+
}

‎client/packages/lowcoder/src/pages/ApplicationV2/HomeTableView.tsx

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TacoButton } from "lowcoder-design/src/components/button"
44
import styled from "styled-components";
55
import { useDispatch } from "react-redux";
66
import {
7+
backFolderViewClick,
78
handleAppEditClick,
89
handleAppViewClick,
910
handleFolderViewClick,
@@ -51,8 +52,8 @@ const TypographyText = styled(AntdTypographyText)`
5152
width: 100%;
5253
`;
5354

54-
export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, modify?: boolean }) => {
55-
const {setModify, modify, resources} = props
55+
export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, modify?: boolean,mode?: string }) => {
56+
const {setModify, modify, resources, mode} = props
5657
const dispatch = useDispatch();
5758

5859
const { folderId } = useParams<{ folderId: string }>();
@@ -61,6 +62,20 @@ export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, mo
6162
const [needDuplicateRes, setNeedDuplicateRes] = useState<HomeRes | undefined>(undefined);
6263
const [needMoveRes, setNeedMoveRes] = useState<HomeRes | undefined>(undefined);
6364

65+
const back: HomeRes = {
66+
key: "",
67+
id: "",
68+
name: ". . .",
69+
type: 4,
70+
creator: "",
71+
lastModifyTime: 0,
72+
isManageable: false,
73+
isDeletable: false
74+
}
75+
if (mode === "folder"){
76+
resources.unshift(back)
77+
}
78+
6479
return (
6580
<>
6681
<Table
@@ -70,17 +85,20 @@ export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, mo
7085
pagination={false}
7186
onRow={(record) => ({
7287
onClick: (e) => {
73-
// console.log(e.target);
74-
const item = record as HomeRes;
75-
if (needRenameRes?.id === item.id || needDuplicateRes?.id === item.id) {
76-
return;
77-
}
78-
if (item.type === HomeResTypeEnum.Folder) {
79-
handleFolderViewClick(item.id);
80-
} else if(item.isMarketplace) {
81-
handleMarketplaceAppViewClick(item.id);
82-
} else {
83-
item.isEditable ? handleAppEditClick(e, item.id) : handleAppViewClick(item.id);
88+
if (mode === "folder" && record.type === 4){
89+
backFolderViewClick()
90+
} else{
91+
const item = record as HomeRes;
92+
if (needRenameRes?.id === item.id || needDuplicateRes?.id === item.id) {
93+
return;
94+
}
95+
if (item.type === HomeResTypeEnum.Folder) {
96+
handleFolderViewClick(item.id);
97+
} else if(item.isMarketplace) {
98+
handleMarketplaceAppViewClick(item.id);
99+
} else {
100+
item.isEditable ? handleAppEditClick(e, item.id) : handleAppViewClick(item.id);
101+
}
84102
}
85103
},
86104
})}
@@ -161,7 +179,7 @@ export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, mo
161179
},
162180
render: (_, record) => (
163181
<SubColumnCell>
164-
{HomeResInfo[(record as any).type as HomeResTypeEnum].name}
182+
{mode==="folder"&&record.type===4 ? "" : HomeResInfo[(record as any).type as HomeResTypeEnum].name}
165183
</SubColumnCell>
166184
),
167185
},
@@ -223,7 +241,7 @@ export const HomeTableView = (props: { resources: HomeRes[], setModify?: any, mo
223241
? handleMarketplaceAppViewClick(item.id)
224242
: handleAppViewClick(item.id);
225243
}}
226-
style={{ marginRight: "52px" }}
244+
style={{ marginRight: "52px",display: mode==="folder"&&record.type===4 ? "none" : "block" }}
227245
>
228246
{trans("view")}
229247
</EditBtn>

‎client/packages/lowcoder/src/util/homeResUtils.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import {
77
NavDocIcon,
88
} from "lowcoder-design";
99
import { HomeResTypeEnum } from "../types/homeRes";
10-
import { APPLICATION_VIEW_URL, APPLICATION_MARKETPLACE_VIEW_URL, buildFolderUrl } from "../constants/routesURL";
10+
import {
11+
APPLICATION_VIEW_URL,
12+
APPLICATION_MARKETPLACE_VIEW_URL,
13+
buildFolderUrl,
14+
ALL_APPLICATIONS_URL
15+
} from "../constants/routesURL";
1116
import history from "./history";
1217
import { trans } from "../i18n";
1318
import { FunctionComponent } from "react";
@@ -62,3 +67,5 @@ export const handleAppViewClick = (id: string) => window.open(APPLICATION_VIEW_U
6267
export const handleMarketplaceAppViewClick = (id: string, isLocalMarketplace?: boolean) => isLocalMarketplace == true ? window.open(APPLICATION_VIEW_URL(id, "view_marketplace"), '_blank') : window.open(APPLICATION_MARKETPLACE_VIEW_URL(id, "view_marketplace"), '_blank');
6368

6469
export const handleFolderViewClick = (id: string) => history.push(buildFolderUrl(id));
70+
71+
export const backFolderViewClick = () => history.push(ALL_APPLICATIONS_URL);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /