mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-15 05:16:34 +00:00
Add introduction card
This commit is contained in:
parent
ee8492df46
commit
1c82a53631
47
src/cards/ha-introduction-card.html
Normal file
47
src/cards/ha-introduction-card.html
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<link rel='import' href='../../bower_components/polymer/polymer.html'>
|
||||||
|
|
||||||
|
<link rel='import' href='../components/ha-card.html'>
|
||||||
|
|
||||||
|
<dom-module id='ha-introduction-card'>
|
||||||
|
<style>
|
||||||
|
:host {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: var(--dark-primary-color);
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
margin: 8px;
|
||||||
|
padding-left: 16px;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
padding: 0 16px 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<ha-card header="Welcome to Home Assistant!">
|
||||||
|
<div class='content'>
|
||||||
|
Here are some resources to get started.
|
||||||
|
<ul>
|
||||||
|
<li><a href='https://home-assistant.io/getting-started/configuration.html' target='_blank'>
|
||||||
|
Configuring Home Assistant
|
||||||
|
</a></li>
|
||||||
|
<li><a href='https://home-assistant.io/components/' target='_blank'>
|
||||||
|
Available components
|
||||||
|
</a></li>
|
||||||
|
<li><a href='https://gitter.im/balloob/home-assistant' target='_blank'>
|
||||||
|
Chat room
|
||||||
|
</a></li>
|
||||||
|
</ul>
|
||||||
|
<template is='dom-if' if='[[showHideInstruction]]'>
|
||||||
|
To remove this card, edit your config in
|
||||||
|
<code>configuration.yaml</code> and disable the
|
||||||
|
<code>introduction</code> component.
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</ha-card>
|
||||||
|
</template>
|
||||||
|
</dom-module>
|
14
src/cards/ha-introduction-card.js
Normal file
14
src/cards/ha-introduction-card.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import Polymer from '../polymer';
|
||||||
|
|
||||||
|
require('../components/ha-card');
|
||||||
|
|
||||||
|
export default new Polymer({
|
||||||
|
is: 'ha-introduction-card',
|
||||||
|
|
||||||
|
properties: {
|
||||||
|
showHideInstruction: {
|
||||||
|
type: Boolean,
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<link rel="import" href="../cards/ha-badges-card.html">
|
<link rel="import" href="../cards/ha-badges-card.html">
|
||||||
<link rel="import" href="../cards/ha-domain-card.html">
|
<link rel="import" href="../cards/ha-domain-card.html">
|
||||||
|
<link rel="import" href="../cards/ha-introduction-card.html">
|
||||||
|
|
||||||
<dom-module id="ha-zone-cards">
|
<dom-module id="ha-zone-cards">
|
||||||
<style>
|
<style>
|
||||||
@ -10,6 +11,10 @@
|
|||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-badges {
|
||||||
|
height: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.badges {
|
.badges {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
@ -25,13 +30,21 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class='main'>
|
<div class='main'>
|
||||||
<template is='dom-if' if='domains.badges'>
|
<template is='dom-if' if='[[cards._badges]]'>
|
||||||
<div class='badges'>
|
<div class='badges'>
|
||||||
<ha-badges-card states='[[cards._badges]]'></ha-badges-card>
|
<ha-badges-card states='[[cards._badges]]'></ha-badges-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<template is='dom-if' if='[[!cards._badges]]'>
|
||||||
|
<div class='no-badges'> </div>
|
||||||
|
</template>
|
||||||
<div class='horizontal layout'>
|
<div class='horizontal layout'>
|
||||||
<div class='column flex-1'>
|
<div class='column flex-1'>
|
||||||
|
<template is='dom-if' if='[[showIntroduction]]'>
|
||||||
|
<div class='zone-card'>
|
||||||
|
<ha-introduction-card show-hide-instruction='[[computeShowHideInstruction(states)]]'></ha-introduction-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<template is='dom-repeat' items='[[cards._columns.0]]'>
|
<template is='dom-repeat' items='[[cards._columns.0]]'>
|
||||||
<div class='zone-card'>
|
<div class='zone-card'>
|
||||||
<ha-domain-card domain='[[item]]'
|
<ha-domain-card domain='[[item]]'
|
||||||
|
@ -3,6 +3,7 @@ import { util } from '../util/home-assistant-js-instance';
|
|||||||
|
|
||||||
require('../cards/ha-badges-card');
|
require('../cards/ha-badges-card');
|
||||||
require('../cards/ha-domain-card');
|
require('../cards/ha-domain-card');
|
||||||
|
require('../cards/ha-introduction-card');
|
||||||
|
|
||||||
const PRIORITY = {
|
const PRIORITY = {
|
||||||
a: -1,
|
a: -1,
|
||||||
@ -30,6 +31,11 @@ export default new Polymer({
|
|||||||
is: 'ha-zone-cards',
|
is: 'ha-zone-cards',
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
|
showIntroduction: {
|
||||||
|
type: Boolean,
|
||||||
|
value: false,
|
||||||
|
},
|
||||||
|
|
||||||
columns: {
|
columns: {
|
||||||
type: Number,
|
type: Number,
|
||||||
value: 2,
|
value: 2,
|
||||||
@ -94,6 +100,10 @@ export default new Polymer({
|
|||||||
return cards;
|
return cards;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computeShowHideInstruction(states) {
|
||||||
|
return states.size > 0 && !__DEMO__;
|
||||||
|
},
|
||||||
|
|
||||||
computeStatesOfCard(cards, card) {
|
computeStatesOfCard(cards, card) {
|
||||||
return cards[card];
|
return cards[card];
|
||||||
},
|
},
|
||||||
|
@ -51,7 +51,9 @@
|
|||||||
<ha-voice-command-progress></ha-voice-command-progress>
|
<ha-voice-command-progress></ha-voice-command-progress>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ha-zone-cards states='[[states]]' columns='[[columns]]'></ha-zone-cards>
|
<ha-zone-cards
|
||||||
|
show-introduction='[[computeShowIntroduction(introductionLoaded, states)]]'
|
||||||
|
states='[[states]]' columns='[[columns]]'></ha-zone-cards>
|
||||||
</div>
|
</div>
|
||||||
</paper-header-panel>
|
</paper-header-panel>
|
||||||
</template>
|
</template>
|
||||||
|
@ -59,6 +59,11 @@ export default new Polymer({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
introductionLoaded: {
|
||||||
|
type: Boolean,
|
||||||
|
bindNuclear: configGetters.isComponentLoaded('introduction'),
|
||||||
|
},
|
||||||
|
|
||||||
states: {
|
states: {
|
||||||
type: Object,
|
type: Object,
|
||||||
bindNuclear: entityGetters.visibleEntityMap,
|
bindNuclear: entityGetters.visibleEntityMap,
|
||||||
@ -124,6 +129,10 @@ export default new Polymer({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computeShowIntroduction(introductionLoaded, states) {
|
||||||
|
return introductionLoaded || states.size === 0;
|
||||||
|
},
|
||||||
|
|
||||||
toggleMenu() {
|
toggleMenu() {
|
||||||
this.fire('open-menu');
|
this.fire('open-menu');
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<dom-module id="more-info-sun">
|
<dom-module id="more-info-sun">
|
||||||
<template>
|
<template>
|
||||||
<template is='dom-repeat' items='[[computeOrder(risingDate, settingDate)]]'>
|
<template is='dom-repeat' items='[[computeOrder(risingDate, settingDate)]]'>
|
||||||
<div class='data-entry layout justified horizontal' id='rising'>
|
<div class='data-entry layout justified horizontal'>
|
||||||
<div class='key'>
|
<div class='key'>
|
||||||
<span>[[itemCaption(item)]]</span>
|
<span>[[itemCaption(item)]]</span>
|
||||||
<relative-ha-datetime datetime-obj="[[itemDate(item)]]"></relative-ha-datetime>
|
<relative-ha-datetime datetime-obj="[[itemDate(item)]]"></relative-ha-datetime>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user