Skip to content

Commit c01beab

Browse files
committed
Custom branding with custom icon, title and color
1 parent 1c06a99 commit c01beab

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

Parse-Dashboard/app.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,27 @@ module.exports = function(config, options) {
171171
if (!users || (req.user && req.user.isAuthenticated)) {
172172
return res.redirect(`${mountPath}apps`);
173173
}
174-
175174
let errors = req.flash('error');
176175
if (errors && errors.length) {
177176
errors = `<div id="login_errors" style="display: none;">
178177
${errors.join(' ')}
179178
</div>`
180179
}
180+
const customBrandIcon = config.customBrandIcon;
181+
const customBrandColorPrimary = config.customBrandColorPrimary;
181182
res.send(`<!DOCTYPE html>
182183
<head>
183184
<link rel="shortcut icon" type="image/x-icon" href="${mountPath}favicon.ico" />
184185
<base href="${mountPath}"/>
185186
<script>
186187
PARSE_DASHBOARD_PATH = "${mountPath}";
188+
${customBrandIcon && 'CUSTOM_BRAND_ICON = "' + customBrandIcon + '";'}
187189
</script>
190+
<style>
191+
body {
192+
${customBrandColorPrimary && `background-color: ${customBrandColorPrimary} !important;`}
193+
}
194+
</style>
188195
</head>
189196
<html>
190197
<title>Parse Dashboard</title>
@@ -206,12 +213,16 @@ module.exports = function(config, options) {
206213
if (users && req.user && req.user.matchingUsername ) {
207214
res.append('username', req.user.matchingUsername);
208215
}
216+
const customBrandIcon = config.customBrandIcon;
217+
const customBrandTitle = config.customBrandTitle;
209218
res.send(`<!DOCTYPE html>
210219
<head>
211220
<link rel="shortcut icon" type="image/x-icon" href="${mountPath}favicon.ico" />
212221
<base href="${mountPath}"/>
213222
<script>
214223
PARSE_DASHBOARD_PATH = "${mountPath}";
224+
${customBrandIcon && 'CUSTOM_BRAND_ICON = "' + customBrandIcon + '";'}
225+
${customBrandTitle && 'CUSTOM_BRAND_TITLE = "' + customBrandTitle + '";'}
215226
</script>
216227
</head>
217228
<html>

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ Parse Dashboard supports adding an optional background color for each app, so yo
235235
}
236236
```
237237

238+
## Custom branding
239+
240+
- You can set `customBrandIcon` with relative path from `iconsFolder`. This could be your custom logo which will appear on login screen and on the top of sidebar. Icon should be square (same height and width), SVG or PNG with transparent background.
241+
- You can set `customBrandTitle` which will be visible on top of sidebar instead of `Parse Dashboard`.
242+
- You can set `customBrandColorPrimary` which will be background color at login screen.
243+
238244
## Other Configuration Options
239245

240246
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.

src/components/LoginForm/LoginForm.react.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ import { verticalCenter } from 'stylesheets/base.scss';
1414
// Class-style component, because we need refs
1515
export default class LoginForm extends React.Component {
1616
render() {
17+
const customBrandIcon = window.CUSTOM_BRAND_ICON;
1718
return (
1819
<div className={styles.login} style={{ marginTop: this.props.marginTop || '-220px' }}>
19-
<Icon width={80} height={80} name='infinity' fill='#093A59' />
20+
{!customBrandIcon && <Icon width={80} height={80} name='infinity' fill='#093A59' />}
21+
{customBrandIcon && <img src={'appicons/' + customBrandIcon} width={80} height={80} alt="Custom BRAND icon"/>}
2022
<form method='post' ref='form' action={this.props.endpoint} className={styles.form}>
2123
<CSRFInput />
2224
<div className={styles.header}>{this.props.header}</div>

src/components/Sidebar/SidebarHeader.react.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@ export default class SidebarHeader extends React.Component {
2424
});
2525
}
2626
render() {
27+
const customBrandIcon = window.CUSTOM_BRAND_ICON;
28+
const customBrandTitle = window.CUSTOM_BRAND_TITLE;
2729
return (
2830
<div className={styles.header}>
2931
<Link className={styles.logo} to={{ pathname: '/apps' }}>
30-
<Icon width={28} height={28} name='infinity' fill={'#ffffff'} />
32+
{!customBrandIcon && <Icon width={28} height={28} name='infinity' fill={'#ffffff'} />}
33+
{customBrandIcon && <img src={'appicons/' + customBrandIcon} width={28} height={28} alt="Custom BRAND icon"/>}
3134
</Link>
3235
<Link to='/apps'>
3336
<div className={styles.version}>
3437
<div>
35-
Parse Dashboard {version}
38+
{customBrandTitle || 'Parse Dashboard'} {version}
3639
<div>
3740
{this.state.dashboardUser}
3841
</div>

0 commit comments

Comments
 (0)