Skip to content

Commit

Permalink
Add Status Update Icon (#417)
Browse files Browse the repository at this point in the history
* Add Status Update Icon

* Review comments

* Refactor + animations

* Remove timeout

* Margin right spacing

* Refactor app store icon

* Settings Page

* Remove app header icon changes

* Fix Settings Title

* Line break

* Refactor AppName

* Update icons

* Apply suggestions from code review

Co-authored-by: Jacob Keeler <[email protected]>

* Update cart icon

* Update if/else priority for name props.value

* Apply suggestions from code review

Co-authored-by: Jacob Keeler <[email protected]>

* Add svg-stroke class to icon

* Apply suggestions from code review

Co-authored-by: Jacob Keeler <[email protected]>

Co-authored-by: Jacob Keeler <[email protected]>
  • Loading branch information
Jack-Byrne and jacobkeeler authored Aug 27, 2021
1 parent 257cd1e commit 960ba0c
Show file tree
Hide file tree
Showing 20 changed files with 246 additions and 53 deletions.
3 changes: 2 additions & 1 deletion public/Flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ window.flags = {
CoreHost: '127.0.0.1',
CorePort: 8087,
CoreWebEngineAppPort: 2020,
AppStoreDirectoryUrl: 'https://sdl-webengine-app-store-example.s3.amazonaws.com/app-directory.json'
AppStoreDirectoryUrl: 'https://sdl-webengine-app-store-example.s3.amazonaws.com/app-directory.json',
StatusUpdateIcon: true
};
9 changes: 5 additions & 4 deletions src/css/components/_app-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@

div {
@include flex(1);
&:nth-of-type(2) {
text-align: center;
}

&:nth-of-type(3) {
text-align: right;
}
Expand All @@ -37,6 +33,11 @@
text-transform: uppercase;
}

.settings-menu svg{
@include size(40px);
margin-left: 0px;
}

.svg-wrap-secondary{
width: 30px;
svg{
Expand Down
1 change: 1 addition & 0 deletions src/css/components/_h-scroll-menu-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
color: color(white);
border: 2px solid;
position: relative;
cursor: pointer;

&__image {
display: flex;
Expand Down
14 changes: 8 additions & 6 deletions src/img/icons/icon-cart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/img/icons/up_to_date.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/img/icons/updating.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import AppStoreMenu from './js/AppStoreMenu';
import WebEngineAppContainer from './js/WebEngineAppContainer';
import AppPermissions from './js/AppPermissions';
import PermissionAppList from './js/PermissionAppList';
import Settings from './js/Settings';
import Keyboard from './js/Keyboard';
import React from 'react';
import ReactDOM from 'react-dom';
Expand Down Expand Up @@ -351,6 +352,7 @@ ReactDOM.render((
<Route path="/keyboard" component={Keyboard} />
<Route path="/permissionapplist" component={PermissionAppList} />
<Route path="/apppermissions" component={AppPermissions} />
<Route path="/settings" component={Settings} />
</HashRouter>
</HMIApp>
</Provider>
Expand Down
39 changes: 11 additions & 28 deletions src/js/AppHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,15 @@ import uiController from './Controllers/UIController'
import ScrollableMessage from './ScrollableMessage';

import {ReactComponent as IconMenu} from '../img/icons/icon-menu.svg'
import {ReactComponent as IconCart} from '../img/icons/icon-cart.svg'
import {ReactComponent as PermissionsIcon} from '../img/static/0x49.svg'
import {ReactComponent as IconSettings} from '../img/static/0x49.svg'

class AppStoreIcon extends React.Component {
class MainMenuSettings extends React.Component {
render() {
return (<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
<Link to="/permissionapplist" style={{ marginRight: 10, marginLeft: 'auto' }}>
<div className="app-icon">
<div className="static-icon">
<div className="svg-wrap">
<PermissionsIcon/>
</div>
</div>
</div>
</Link>
<Link to="/appstore" style={{ marginRight: 0 }}>
<div className="app-icon">
<div className="static-icon">
<div className="svg-wrap">
<IconCart/>
</div>
</div>
</div>
return (<div>
<Link to="/settings">
<span className="settings-menu">
<IconSettings/>
</span>
</Link>
</div>);
}
Expand Down Expand Up @@ -118,12 +104,9 @@ class AppHeader extends React.Component {
activeSubMenu={this.props.activeSubMenu ? true : false} /> ;

if (this.props.icon === 'store') {
if (this.props.isAppStoreConnected) {
icon = this.props.location.pathname === '/appstore' ? (<AppStoreMenuIcon />) : (<AppStoreIcon />);
}
else{
icon = (<div />)
}
icon = this.props.location.pathname === '/appstore' ? (<AppStoreMenuIcon />) : (
<MainMenuSettings/>
);
} else if (this.props.icon === 'custom') {
icon = this.props.jsxIcon;
}
Expand All @@ -146,7 +129,7 @@ class AppHeader extends React.Component {
return (
<div className="app__header" style={colorScheme}>
<MenuLink menuName={this.props.menuName} backLink={backLink} parentID={this.props.parentID}/>
<Name />
<Name value={this.props.title}/>
{ icon }
<Modal
isOpen={this.props.showAlert}
Expand Down
3 changes: 1 addition & 2 deletions src/js/AppName.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export default class AppName extends React.Component {
subTitle = (isShowingSubMenu) ? this.props.subMenuName : subTitle
subTitle = (isPerformingInteraction) ? this.props.interactionText : subTitle

let name = this.props.location.pathname ==='/appstore' ? 'App Store' : this.props.location.pathname ==='/appstoremenu' ? 'Installed Apps' : this.props.name;
let appName_html = <span className="t-small t-medium th-f-color">{name}</span>
let appName_html = <span className="t-small t-medium th-f-color">{this.props.name}</span>
let separator_html = (subTitle) ? <span className="svg-wrap-secondary"><TitleSeparator/></span> : null
let subTitle_html = (subTitle) ? <span className="t-small t-light th-f-color-secondary">{subTitle}</span> : null

Expand Down
2 changes: 1 addition & 1 deletion src/js/AppStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class AppStore extends React.Component {
description={pendingInstallApp.description} iconUrl={pendingInstallApp.iconUrl}
leftText="Cancel" leftCallback={() => this.cancelInstall()} rightText="Download" rightCallback={() => this.confirmInstall()} />
</Modal>
<AppHeader icon='store' backLink="/" menuName="APPS"/>
<AppHeader icon='store' backLink="/settings" menuName="Back" title="App Store"/>
{<HScrollMenu data={menuData}
theme={this.props.theme}
onSelection={this.onSelection}
Expand Down
2 changes: 1 addition & 1 deletion src/js/AppStoreMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class AppStoreMenu extends React.Component {
description={this.state.appDescription} iconUrl={this.state.appIcon}
leftText="Cancel" leftCallback={() => this.cancelUninstall()} rightText="Uninstall" rightCallback={() => this.confirmUninstall()} />
</Modal>
<AppHeader icon='false' backLink="/appstore" menuName="STORE"/>
<AppHeader icon='false' backLink="/appstore" menuName="STORE" title="Installed Apps"/>
<div className="appstore-menu">
{this.props.apps.map((app) => {

Expand Down
7 changes: 7 additions & 0 deletions src/js/Controllers/RpcFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,13 @@ class RpcFactory {
"method": "TTS.Stopped",
})
}
static UpdateSDL() {
return ({
"jsonrpc": "2.0",
"id": rpcFactory_msgId++,
"method": "SDL.UpdateSDL"
})
}
}

export default RpcFactory
11 changes: 9 additions & 2 deletions src/js/Controllers/SDLController.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import RpcFactory from './RpcFactory'
import store from '../store'
import { activateApp, setURLS, setPTUWithModem, clearPendingAppLaunch, openPermissionsView } from '../actions'
import { activateApp, setURLS, setPTUWithModem, clearPendingAppLaunch, openPermissionsView, onStatusUpdate } from '../actions'
import bcController from './BCController'
import externalPolicies from './ExternalPoliciesController'
import FileSystemController from './FileSystemController'
Expand Down Expand Up @@ -62,7 +62,11 @@ class SDLController {
});
} else {
if (this.statusMessages[status].ttsString) { ttsController.queueTTS(this.statusMessages[status].ttsString); }
toast((_toast) => (<PermissionsPopup _toast={_toast} header={this.statusMessages[status].line1}/>), { duration: 2000 });
if (window.flags.StatusUpdateIcon) {
store.dispatch(onStatusUpdate(status, this.statusMessages[status].line1));
} else {
toast((_toast) => (<PermissionsPopup _toast={_toast} header={this.statusMessages[status].line1}/>), { duration: 2000 });
}
}
}
handleRPC(rpc) {
Expand Down Expand Up @@ -335,6 +339,9 @@ class SDLController {
}
this.listener.send(gufm);
}
updateSDL() {
this.listener.send(RpcFactory.UpdateSDL());
}
}

let controller = new SDLController()
Expand Down
2 changes: 1 addition & 1 deletion src/js/Controllers/UIController.js
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ class UIController {
const state = store.getState()
var activeApp = state.activeApp
var app = state.ui[activeApp]
var interactionId = app.interactionId
var interactionId = app?.interactionId
for (var msgID in this.timers) {
clearTimeout(this.timers[msgID])
delete this.timers[msgID]
Expand Down
2 changes: 1 addition & 1 deletion src/js/PermissionAppList.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Permissions extends React.Component {

return (
<div>
<AppHeader backLink={'/'} menuName="Exit" icon="false" />
<AppHeader backLink={'/settings'} menuName="Exit" icon="false" />
<div className="vscrollmenu">
{ options }
</div>
Expand Down
Loading

0 comments on commit 960ba0c

Please sign in to comment.