From 705d061b3514312fc095269c58eda6dc2bd198cc Mon Sep 17 00:00:00 2001 From: nipunnadeen Date: Sat, 24 Aug 2019 12:24:18 +0530 Subject: [PATCH] Fix the responsive issues of the APPM UI --- .../react-app/src/App.css | 58 ++++++- .../apps/detailed-rating/DetailedRating.css | 12 ++ .../AppDetailsDrawer/AppDetailsDrawer.css | 10 +- .../AppDetailsDrawer/AppDetailsDrawer.js | 96 ++++++----- .../src/components/apps/list-apps/ListApps.js | 4 +- .../apps/list-apps/appsTable/AppsTable.css | 11 +- .../apps/list-apps/appsTable/AppsTable.js | 5 +- .../src/pages/dashboard/Dashboard.js | 129 ++++++++++++--- .../react-app/src/App.css | 56 ++++++- .../src/pages/dashboard/Dashboard.js | 151 +++++++++++++----- 10 files changed, 419 insertions(+), 113 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.css index d393e9ad68..ca73e58738 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.css +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.css @@ -40,7 +40,6 @@ } .logo-image { - /*width: 120px;*/ height: 31px; margin: 0 5px 16px 24px; float: left; @@ -60,8 +59,65 @@ margin-right: 2%; } +.mobile-layout{ + visibility: hidden; + position: absolute; +} + +.mobile-menu-button{ + margin-left: 4%; + position: fixed; +} + +.nav-icon{ + margin-top: 10%; + font-size: 27px; +} + @media only screen and (min-width: 768px) { + .main-container{ padding: 24px; } + +} + +@media screen and (max-width: 768px) { + + .web-layout{ + visibility: hidden; + } + + .mobile-layout{ + visibility: visible; + z-index: 1; + } + + .mobile-menu-button{ + margin-top: 4%; + } + + Header{ + position: fixed; + z-index: 1; + width: 100%; + } + + .dashboard-body{ + margin-top: 14%; + } + + .logo-image { + margin-left: 20%; + } + +} + +@media screen and (max-height: 500px) { + .mobile-menu-button{ + margin-top: 2%; + } + .dashboard-body{ + margin-top: 9%; + } } \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.css index 28a761eb7b..34c484c34f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.css +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.css @@ -33,6 +33,18 @@ width: 70%; } +@media screen and (max-width: 768px) { + + .d-rating .bar-containers{ + width: 100%; + } + + .d-rating .numeric-data{ + width: 50%; + } + +} + .d-rating .bar-containers .bar-container{ color: #737373; font-weight: 400; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.css index 940144cc0f..b85db7892f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.css +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.css @@ -22,4 +22,12 @@ .release-card:hover { background-color: rgba(15, 188, 249,0.1); -} \ No newline at end of file +} + +@media screen and (max-width: 700px) { + + .release-card{ + width: 210%; + } + +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js index 1aa6b0bb91..5110428da5 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js @@ -32,13 +32,11 @@ import { Icon, Card } from 'antd'; - -import "../../../../App.css"; import DetailedRating from "../../detailed-rating/DetailedRating"; import {Link} from "react-router-dom"; import axios from "axios"; import ReactQuill from "react-quill"; -import ReactHtmlParser, {processNodes, convertNodeToElement, htmlparser2} from 'react-html-parser'; +import ReactHtmlParser from 'react-html-parser'; import "./AppDetailsDrawer.css"; import pSBC from "shade-blend-color"; import {withConfigContext} from "../../../../context/ConfigContext"; @@ -71,6 +69,8 @@ const formats = [ class AppDetailsDrawer extends React.Component { constructor(props) { super(props); + const drawerWidth = window.innerWidth<=768 ? '80%' : '40%'; + this.state = { loading: false, name: "", @@ -85,6 +85,8 @@ class AppDetailsDrawer extends React.Component { isDescriptionEditEnabled: false, isCategoriesEditEnabled: false, isTagsEditEnabled: false, + drawer: null, + drawerWidth }; } @@ -188,7 +190,6 @@ class AppDetailsDrawer extends React.Component { }); }; - // change the app name handleNameSave = name => { const config = this.props.context; @@ -412,7 +413,6 @@ class AppDetailsDrawer extends React.Component { } }; - render() { const config = this.props.context; const {app, visible, onClose} = this.props; @@ -458,11 +458,12 @@ class AppDetailsDrawer extends React.Component {
+
{avatar} @@ -473,39 +474,46 @@ class AppDetailsDrawer extends React.Component { Releases {/*display add new release only if app type is enterprise*/} - {(app.type === "ENTERPRISE") && ( - )} - ( - - - - - } - title={release.version} - description={ -
- - - - - -
- } - /> -
- -
- )} - /> + +
+ + {(app.type === "ENTERPRISE") && ( + )} + ( + + + + + } + title={release.version} + description={ +
+ + + + + +
+ } + /> +
+ +
+ )} + /> + +
+ Description @@ -546,6 +554,7 @@ class AppDetailsDrawer extends React.Component { )} + Categories {!isCategoriesEditEnabled && ( )} - + Tags {!isTagsEditEnabled && ( - {app.applicationReleases.length > 0 && ( - )} + +
+ {app.applicationReleases.length > 0 && ( + )} +
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js index 22fccaa94d..309863a976 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js @@ -25,7 +25,6 @@ import AppDetailsDrawer from "./AppDetailsDrawer/AppDetailsDrawer"; const {Title} = Typography; const Search = Input.Search; - class ListApps extends React.Component { constructor(props) { super(props); @@ -67,7 +66,6 @@ class ListApps extends React.Component { this.setState({ filters }); - console.log(filters); }; render() { @@ -88,7 +86,7 @@ class ListApps extends React.Component { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.css index 3c9b8c4b9e..bd48256ff6 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.css +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.css @@ -18,4 +18,13 @@ .app-row{ cursor: pointer; -} \ No newline at end of file +} + +Table{ + width: 100%; +} + +.apps-table{ + display: block; + overflow: auto; +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.js index 93d85babae..fd3055b85f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.js @@ -132,7 +132,7 @@ class AppsTable extends React.Component { componentDidUpdate(prevProps, prevState, snapshot) { const {filters} = this.props; if (prevProps.filters !== this.props.filters) { - console.log("d", this.props.filters); + // console.log("d", this.props.filters); this.setState({ filters }); @@ -212,7 +212,7 @@ class AppsTable extends React.Component { render() { return ( - +
record.id} dataSource={this.state.apps} @@ -228,6 +228,7 @@ class AppsTable extends React.Component { }; }} /> + ); } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js index 3639c4e4f7..807aec1273 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js @@ -17,7 +17,7 @@ */ import React from "react"; -import {Layout, Menu, Icon} from 'antd'; +import {Layout, Menu, Icon, Drawer, Button} from 'antd'; import {Switch, Link} from "react-router-dom"; import RouteWithSubRoutes from "../../components/RouteWithSubRoutes" import {Redirect} from 'react-router' @@ -38,27 +38,107 @@ class Dashboard extends React.Component { this.Logo = config.theme.logo; } + //functions for show the drawer + state = { + visible: false, + collapsed: false + }; + + showDrawer = () => { + this.setState({ + visible: true, + collapsed: !this.state.collapsed + }); + }; + + onClose = () => { + this.setState({ + visible: false, + }); + }; + render() { return (
- -
+ +
- logo + logo
+ +
+ + + Apps + + + Add New App + + } + > + Public + APP + Enterprise + APP + Web + Clip + + Manage + + + + Profile + + } + > + + + +
+
+
+ + +
+ +
+ logo} + placement="left" + closable={false} + onClose={this.onClose} + visible={this.state.visible} + getContainer={false} + style={{position: 'absolute'}} + > - Apps + Apps Add New App - + } > Public @@ -70,23 +150,26 @@ class Dashboard extends React.Component { Manage - - + + + + - Profile - } - > - - - - - -
+ } + > + + +
- + + @@ -95,7 +178,7 @@ class Dashboard extends React.Component { ))} -
+
©2019 entgra.io
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/App.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/App.css index d393e9ad68..629d511560 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/App.css +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/App.css @@ -40,7 +40,6 @@ } .logo-image { - /*width: 120px;*/ height: 31px; margin: 0 5px 16px 24px; float: left; @@ -60,8 +59,63 @@ margin-right: 2%; } +.mobile-layout{ + visibility: hidden; + position: absolute; +} + +.mobile-menu-button{ + margin-left: 4%; + position: fixed; +} + +.nav-icon{ + margin-top: 10%; + font-size: 27px; +} + @media only screen and (min-width: 768px) { .main-container{ padding: 24px; } +} + +@media screen and (max-width: 700px) { + + .web-layout{ + visibility: hidden; + } + + .mobile-layout{ + visibility: visible; + z-index: 1; + } + + .mobile-menu-button { + margin-top: 4%; + } + + Header{ + position: fixed; + z-index: 1; + width: 100%; + } + + .dashboard-body{ + margin-top: 15%; + } + + .logo-image { + margin-left: 20%; + } + +} + +@media only screen and (max-height: 500px) { + .mobile-menu-button{ + margin-top: 2%; + } + .dashboard-body{ + margin-top: 10%; + } } \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js index c7b8c47575..fe9bb9c73d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js @@ -17,8 +17,7 @@ */ import React from "react"; -import {Layout, Menu, Icon} from 'antd'; - +import {Layout, Menu, Icon, Drawer, Button} from 'antd'; const {Header, Content, Footer} = Layout; import {Link} from "react-router-dom"; import RouteWithSubRoutes from "../../components/RouteWithSubRoutes"; @@ -81,60 +80,134 @@ class Dashboard extends React.Component { }) }; + //functions for show the drawer + state = { + visible: false, + collapsed: false + }; + + showDrawer = () => { + this.setState({ + visible: true, + collapsed: !this.state.collapsed, + }); + }; + + onClose = () => { + this.setState({ + visible: false, + }); + }; + render() { const config = this.props.context; const {selectedKeys, deviceTypes} = this.state; + const DeviceTypesData = deviceTypes.map((deviceType) => { + const platform = deviceType.name; + const defaultPlatformIcons = config.defaultPlatformIcons; + let icon = defaultPlatformIcons.default.icon; + let theme = defaultPlatformIcons.default.theme; + if (defaultPlatformIcons.hasOwnProperty(platform)) { + icon = defaultPlatformIcons[platform].icon; + theme = defaultPlatformIcons[platform].theme; + } + return ( + + + + {platform} + + + ); + }); + return (
- -
+ +
- logo + logo +
+ +
+ + + {DeviceTypesData} + + Web + Clips + + + + Profile + + } + > + + +
+
+
+ + + +
+ +
+ + logo + } + placement="left" + closable={false} + onClose={this.onClose} + visible={this.state.visible} + getContainer={false} + style={{position: 'absolute'}} + > - { - deviceTypes.map((deviceType) => { - const platform = deviceType.name; - const defaultPlatformIcons = config.defaultPlatformIcons; - let icon = defaultPlatformIcons.default.icon; - let theme = defaultPlatformIcons.default.theme; - if (defaultPlatformIcons.hasOwnProperty(platform)) { - icon = defaultPlatformIcons[platform].icon; - theme = defaultPlatformIcons[platform].theme; - } - return ( - - - - {platform} - - - ); - }) - } + + {DeviceTypesData} + Web Clips - + + + + - Profile - } - > - - - -
+ } + > + + +
- + + {this.state.routes.map((route) => ( @@ -145,7 +218,7 @@ class Dashboard extends React.Component { -
+
©2019 entgra.io