Skip to content

Commit fd9a41b

Browse files
finnar-binagalin920shrunyan
authored
Feature: Content app sidebar redesign (#2197)
* task: changed global menu style * task: adjust instance menu style * task: remove white bg * task: convert usage of theme to getTheme * task: created reusable appsidebar component * task: added subheader components * task: fixed hover color * task: fixed list item height * task: change spacing * task: wire button click routing * task: only allow scrolling for children * task: updated scrollbar color and only scroll children * task: nav tree * task: convert nav to tsx * task: added todo * task: added other navs * task: create new nav tree component based off of mui treeview * task: update styling for nav tree item * task: fixed tree actions icon colors * task: icon button bgcolor * task: add module augmentation for new icon button size * task: item select style * task: css nesting * task: create nav tree item type * task: fix layout when screen is small * task: styling update * task: change from getTheme to light or dark theme imports * task: replace treeview arrow icons * task: change nav tree item selected width * task: added rtk query and logic to get nav items * task: map chilren to parents * task: split nav items * task: cleanup * task: dynamic width calculate * task: revert to using theme instead of lightTheme import * task: added hidden items accordion * task: wire nav item click * task: wire collapse tree * task: wire search filter * task: auto scroll down when hidden items are collapsed * task: change to scopedcssbaseline * chore: local material-ui * task: add new content modal * task: sort models * Add Resizable container component * remove log * add comment * task: invalidate content nav data on item create, delete and edit * task: update create content item style * task: set selected nav item even for nested urls * task: fixed nested item depth * task: add type limiter to create item dialog * task: wire per item create * task: fixed highlighting of nested items inside dataset and templateset * task: add reorder modal * task: invalidate nav items on content reorder * task: refresh nav data on link edit/delete * task: create hide/unhide item modal * task: wire hide/unhide * task: skip nav fetch when user role fails * task: prevent page from loading when nav data is fails to fetch * task: error handling * task: remove tooltip * task: added releases as subpage * task: fixed active highlighting for releases subpage * task: revert removal * task: update build tree logic * task: delete old nav tree * task: use new nav tree * fix: fixed reorder bug * task: added tooltips * task: integrate resizable component to app sidebar * task: added nav error state * task: layout fixes * task: prevent text selection when dragging * task: delete old content nav * chore: cleanup * fix: fixed undefined url * task: version bump * task: added id * task: moved naverror outside * task: removed unneccessary prop * task: removed usememo * ResizeableContainer updates * remove user select * task: comment fixes * task: change nav item + button flow * task: hide subroutes when user filters items * task: limit height and create on click * task: icon change * task: changed to regular button * task: vqa fixes * task: moved pages header * task: overflow fix * task: moved back header comp * task: cypress tests * resize updates * task: update tooltip delay * task: hide releases * task: refresh nav content data on model create/delete * task: expand all navs by default * task: use custom icon button that can look like a contained button * fix: items not collapsing at times * task: added debounce on item filtering * fix: uncollapsable datasets in page category * task: moved header inside app bar * fix: memoize tree item * task: missing pb * task: added separate memoized value for filtered content, moved where actions is being placed * task: version bump material-ui * task: refetch nav data on mount --------- Co-authored-by: Andres <[email protected]> Co-authored-by: Stuart Runyan <[email protected]>
1 parent cc42b26 commit fd9a41b

File tree

45 files changed

+1706
-752
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1706
-752
lines changed

cypress/e2e/content/navigation.spec.js

+20-17
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,35 @@ describe("Navigation through content editor", () => {
66
});
77

88
it("Opens homepage item", () => {
9-
cy.get("#MainNavigation li a").contains("Homepage").click();
9+
cy.getBySelector("pages_nav")
10+
.find("li p[aria-label='Homepage']")
11+
.should("exist")
12+
.click();
1013
cy.get("#12-0c3934-8dz720").should("exist");
1114
});
1215

1316
it("Opens the reorder nav modal", () => {
14-
cy.get("#ReorderNavButton").click();
17+
cy.getBySelector("reorder_nav").should("exist").click();
1518
cy.get(".ModalAligner--ptdt- article main ul.sort--taGo4").should("exist");
1619
cy.get(".ModalAligner--ptdt-.Open--M5j6S button.Close--kVpCO").click();
1720
});
1821

1922
it("Creates a new item from the menu", () => {
20-
cy.get("#MainNavigation").then((content) => {
21-
if (!content.is(":visible")) {
22-
cy.get("[data-cy=contentNavButton]").click();
23-
cy.get(".CreateItemDropdown").find(".MuiSelect-select").click();
24-
cy.get("[role=presentation]").find('[data-value="link"]').click();
25-
cy.get("#CreateLinkButton").should("exist");
26-
} else {
27-
cy.get(".CreateItemDropdown").find(".MuiSelect-select").click();
28-
cy.get("[role=presentation]").find('[data-value="link"]').click();
29-
cy.get('[data-value="link"]').click();
30-
cy.get("#CreateLinkButton").should("exist");
31-
}
32-
});
23+
cy.getBySelector("create_new_content_item").should("exist").click();
24+
cy.getBySelector("create_new_content_item_dialog").should("exist");
25+
cy.getBySelector("create_new_content_item_input")
26+
.find("input")
27+
.type("cypress");
28+
cy.get(".MuiAutocomplete-listbox .MuiAutocomplete-option")
29+
.first()
30+
.should("exist")
31+
.click();
32+
cy.getBySelector("create_new_content_item_btn").click();
33+
cy.location("pathname").should("eq", "/content/6-0c960c-d1n0kx/new");
3334
});
3435

35-
it("Check Content Nav Collapsed functionality", () => {
36+
// To be re-added on another release
37+
it.skip("Check Content Nav Collapsed functionality", () => {
3638
cy.get("[data-cy=contentNavButton]")
3739
.siblings("div")
3840
.then((btn) => {
@@ -48,7 +50,8 @@ describe("Navigation through content editor", () => {
4850
});
4951
});
5052

51-
it("Check Content Nav Collapse persist when clicking on other Applications ", () => {
53+
// To be re-added on another release
54+
it.skip("Check Content Nav Collapse persist when clicking on other Applications ", () => {
5255
cy.get("[data-cy=contentNavButton]")
5356
.siblings("div")
5457
.then((btn) => {

package-lock.json

+7-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@tinymce/tinymce-react": "^3.12.6",
5858
"@welldone-software/why-did-you-render": "^6.1.1",
5959
"@zesty-io/core": "1.9.1",
60-
"@zesty-io/material": "^0.7.0",
60+
"@zesty-io/material": "^0.9.0",
6161
"chart.js": "^3.8.0",
6262
"chartjs-adapter-moment": "^1.0.1",
6363
"chartjs-plugin-datalabels": "^2.0.0",

public/images/notFoundTransparent.png

38.8 KB
Loading

src/apps/content-editor/src/app/ContentEditor.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,23 @@ import { fetchNav } from "../store/navContent";
1212

1313
import { AppLink } from "@zesty-io/core/AppLink";
1414
import { WithLoader } from "@zesty-io/core/WithLoader";
15-
import { ContentNav } from "./components/Nav";
15+
import { ContentNav } from "./components/ContentNav";
1616

17-
import { Dashboard } from "./views/Dashboard";
1817
import { ItemList } from "./views/ItemList";
1918
import { ItemEdit } from "./views/ItemEdit";
2019
import { ItemCreate } from "./views/ItemCreate";
2120
import { LinkCreate } from "./views/LinkCreate";
2221
import { LinkEdit } from "./views/LinkEdit";
2322
import { NotFound } from "./views/NotFound";
2423
import { CSVImport } from "./views/CSVImport";
24+
import ReleaseApp from "../../../release/src";
2525

2626
// Vendor styles for codemirror, prosemirror and flatpickr
2727
import "@zesty-io/core/vendor.css";
2828

2929
import styles from "./ContentEditor.less";
3030
import Analytics from "./views/Analytics";
31+
import { ResizableContainer } from "../../../../shell/components/ResizeableContainer";
3132

3233
// Makes sure that other apps using legacy theme does not get affected with the palette
3334
let customTheme = createTheme(legacyTheme, {
@@ -95,7 +96,6 @@ let customTheme = createTheme(legacyTheme, {
9596
});
9697

9798
export default function ContentEditor() {
98-
const contentModels = useSelector((state) => state.models);
9999
const navContent = useSelector((state) => state.navContent);
100100
const ui = useSelector((state) => state.ui);
101101
const dispatch = useDispatch();
@@ -139,13 +139,14 @@ export default function ContentEditor() {
139139
: ""
140140
)}
141141
>
142-
<ContentNav
143-
data-cy="contentNav"
144-
dispatch={dispatch}
145-
models={contentModels}
146-
nav={navContent}
147-
/>
148-
142+
<ResizableContainer
143+
id="contentNav"
144+
defaultWidth={300}
145+
minWidth={220}
146+
maxWidth={360}
147+
>
148+
<ContentNav />
149+
</ResizableContainer>
149150
<div
150151
className={cx(
151152
styles.Content,
@@ -154,6 +155,7 @@ export default function ContentEditor() {
154155
>
155156
<div className={styles.ContentWrap}>
156157
<Switch>
158+
{/* <Route path="/content/releases" component={ReleaseApp} /> */}
157159
<Route exact path="/content" component={Analytics} />
158160
<Route
159161
exact

src/apps/content-editor/src/app/ContentEditor.less

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@
1313
}
1414

1515
.ContentEditor {
16-
height: calc(100vh - 40px);
17-
display: grid;
16+
// height: calc(100vh - 40px);
17+
height: 100%;
18+
display: flex;
1819
grid-template-columns: 60px 1fr;
1920
position: relative;
2021

2122
.Content {
2223
overflow: hidden;
2324
border-left: 1px solid #f2f4f7;
2425
z-index: 1;
26+
width: 100%;
2527

2628
.ContentWrap {
2729
display: flex;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { FC } from "react";
2+
import { Box, Typography } from "@mui/material";
3+
4+
import notFound from "../../../../../../../public/images/notFoundTransparent.png";
5+
6+
interface Props {
7+
navName: string;
8+
}
9+
export const NavError: FC<Props> = ({ navName }) => {
10+
return (
11+
<Box p={1.5} textAlign="center">
12+
<img src={notFound} alt="Not Found" style={{ width: 112, height: 110 }} />
13+
<Typography variant="body2" color="text.secondary" sx={{ mt: 1 }}>
14+
We're sorry we are unable to load your {navName}. Please refresh your
15+
page and try again.
16+
</Typography>
17+
</Box>
18+
);
19+
};

0 commit comments

Comments
 (0)