Skip to content

Commit dba2191

Browse files
bugtypenatanrolnik
authored andcommitted
add background color in AppCard (#838)
* add background color in AppCard * Add background color in AppCard (#681) * Add background color in AppCard * add line to changelog * Add primaryBackgroundColor and secondaryBackgroundColor color in AppCard (#838) * Add primaryBackgroundColor and secondaryBackgroundColor color color in AppCard * add line to changelog * Fix defaults for App card.
1 parent bcf8c41 commit dba2191

File tree

9 files changed

+53
-8
lines changed

9 files changed

+53
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
* Fix: Filtering with a 1-digit number (#831), thanks to [Pascal Giguère](https://github.com/pgiguere1)
77
* Fix: Databrowser shows correct count of filtered objects, thanks to [Tom Engelbrecht](https://github.com/engel)
88

9+
### 1.1.3
10+
* Feature: Add primaryBackgroundColor and secondaryBackgroundColor in AppCard, thanks to [AreyouHappy](https://github.com/AreyouHappy)
11+
912
### 1.1.2
1013

1114
* Fix: An issue introduced when using readOnlyMasterKey would make all users readOnly after one has logged in.

Parse-Dashboard/parse-dashboard-config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"appId": "",
55
"masterKey": "",
66
"appName": "",
7-
"iconName": ""
7+
"iconName": "",
8+
"primaryBackgroundColor": "",
9+
"secondaryBackgroundColor": ""
810
}],
911
"iconsFolder": "icons"
1012
}

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Parse Dashboard is a standalone dashboard for managing your Parse apps. You can
1616
* [Single app](#single-app)
1717
* [Managing Multiple Apps](#managing-multiple-apps)
1818
* [App Icon Configuration](#app-icon-configuration)
19+
* [App Background Color Configuration](#app-background-color-configuration)
1920
* [Other Configuration Options](#other-configuration-options)
2021
* [Running as Express Middleware](#running-as-express-middleware)
2122
* [Deploying Parse Dashboard](#deploying-parse-dashboard)
@@ -153,6 +154,33 @@ Parse Dashboard supports adding an optional icon for each app, so you can identi
153154
}
154155
```
155156

157+
## App Background Color Configuration
158+
159+
Parse Dashboard supports adding an optional background color for each app, so you can identify them easier in the list. To do so, you *must* use the configuration file, define an `primaryBackgroundColor` and `secondaryBackgroundColor` in it, parameter for each app. It is `CSS style`. To visualize what it means, in the following example `backgroundColor` is a configuration file:
160+
161+
```json
162+
{
163+
"apps": [
164+
{
165+
"serverURL": "http://localhost:1337/parse",
166+
"appId": "myAppId",
167+
"masterKey": "myMasterKey",
168+
"appName": "My Parse Server App",
169+
"primaryBackgroundColor": "#FFA500", // Orange
170+
"secondaryBackgroundColor": "#FF4500" // OrangeRed
171+
},
172+
{
173+
"serverURL": "http://localhost:1337/parse",
174+
"appId": "myAppId",
175+
"masterKey": "myMasterKey",
176+
"appName": "My Parse Server App [2]",
177+
"primaryBackgroundColor": "rgb(255, 0, 0)", // Red
178+
"secondaryBackgroundColor": "rgb(204, 0, 0)" // DarkRed
179+
}
180+
]
181+
}
182+
```
183+
156184
## Other Configuration Options
157185

158186
You can set `appNameForURL` in the config file for each app to control the url of your app within the dashboard. This can make it easier to use bookmarks or share links on your dashboard.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
],
2121
"homepage": "https://github.com/ParsePlatform/parse-dashboard",
2222
"bugs": "https://github.com/ParsePlatform/parse-dashboard/issues",
23-
"version": "1.1.2",
23+
"version": "1.1.3",
2424
"repository": {
2525
"type": "git",
2626
"url": "https://github.com/ParsePlatform/parse-dashboard"

src/components/Sidebar/Sidebar.react.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ const Sidebar = ({
2323
sections,
2424
section,
2525
appSelector,
26+
primaryBackgroundColor,
27+
secondaryBackgroundColor
2628
}) => {
2729
const _subMenu = subsections => {
2830
if (!subsections) {
@@ -70,7 +72,10 @@ const Sidebar = ({
7072
icon={icon}
7173
style={style}
7274
link={prefix + link}
73-
active={active}>
75+
active={active}
76+
primaryBackgroundColor={primaryBackgroundColor}
77+
secondaryBackgroundColor={secondaryBackgroundColor}
78+
>
7479
{active ? _subMenu(subsections) : null}
7580
</SidebarSection>
7681
);

src/components/Sidebar/SidebarSection.react.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Link } from 'react-router';
1010
import React from 'react';
1111
import styles from 'components/Sidebar/Sidebar.scss';
1212

13-
let SidebarSection = ({ active, children, name, link, icon, style }) => {
13+
let SidebarSection = ({ active, children, name, link, icon, style, primaryBackgroundColor, secondaryBackgroundColor }) => {
1414
let classes = [styles.section];
1515
if (active) {
1616
classes.push(styles.active);
@@ -22,10 +22,10 @@ let SidebarSection = ({ active, children, name, link, icon, style }) => {
2222
return (
2323
<div className={classes.join(' ')}>
2424
{active ?
25-
<div style={style} className={styles.section_header}>{iconContent}<span>{name}</span></div> :
25+
<div style={style} className={styles.section_header} style={{ background: primaryBackgroundColor }}>{iconContent}<span>{name}</span></div> :
2626
<Link style={style} className={styles.section_header} to={{ pathname: link || '' }}>{iconContent}<span>{name}</span></Link>}
2727

28-
{children ? <div className={styles.section_contents}>{children}</div> : null}
28+
{children ? <div className={styles.section_contents} style={{ background: secondaryBackgroundColor }}>{children}</div> : null}
2929
</div>
3030
);
3131
};

src/dashboard/Apps/AppsIndex.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ let AppCard = ({
7272
Server version: <span className={styles.ago}>{app.serverInfo.parseServerVersion || 'unknown'}</span>
7373
</div>;
7474

75-
return <li onClick={canBrowse}>
75+
return <li onClick={canBrowse} style={{ background: app.primaryBackgroundColor }}>
7676
<a className={styles.icon}>
7777
{icon ? <img src={'appicons/' + icon} width={56} height={56}/> : <Icon width={56} height={56} name='blank-app-outline' fill='#1E384D' />}
7878
</a>

src/dashboard/DashboardView.react.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ export default class DashboardView extends React.Component {
240240
section={this.section}
241241
subsection={this.subsection}
242242
prefix={'/apps/' + appSlug}
243-
action={this.action}>
243+
action={this.action}
244+
primaryBackgroundColor={this.context.currentApp.primaryBackgroundColor}
245+
secondaryBackgroundColor={this.context.currentApp.secondaryBackgroundColor}
246+
>
244247
{sidebarChildren}
245248
</Sidebar>);
246249

src/lib/ParseApp.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export default class ParseApp {
3939
serverInfo,
4040
production,
4141
iconName,
42+
primaryBackgroundColor,
43+
secondaryBackgroundColor,
4244
supportedPushLocales,
4345
}) {
4446
this.name = appName;
@@ -60,6 +62,8 @@ export default class ParseApp {
6062
this.serverURL = serverURL;
6163
this.serverInfo = serverInfo;
6264
this.icon = iconName;
65+
this.primaryBackgroundColor=primaryBackgroundColor;
66+
this.secondaryBackgroundColor=secondaryBackgroundColor;
6367
this.supportedPushLocales = supportedPushLocales ? supportedPushLocales : [];
6468

6569
if(!supportedPushLocales) {

0 commit comments

Comments
 (0)