mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 04:46:34 +00:00
Align styling cast buttons (#3579)
* Align styling cast buttons * Split dev constants * Ignore dev_const * Update README.md
This commit is contained in:
parent
87b35010e0
commit
b37a0e2d43
3
.gitignore
vendored
3
.gitignore
vendored
@ -25,6 +25,9 @@ dist
|
|||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
|
||||||
|
# Cast dev settings
|
||||||
|
src/cast/dev_const.ts
|
||||||
|
|
||||||
# Secrets
|
# Secrets
|
||||||
.lokalise_token
|
.lokalise_token
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
|
@ -25,7 +25,7 @@ Home Assistant Cast is made up of two separate applications:
|
|||||||
|
|
||||||
### Setting dev variables
|
### Setting dev variables
|
||||||
|
|
||||||
Open `src/cast/const.ts` and change `CAST_DEV` to `true` and `CAST_DEV_APP_ID` to the ID of the app you just created.
|
Open `src/cast/dev_const.ts` and change `CAST_DEV_APP_ID` to the ID of the app you just created. And set the `CAST_DEV_HASS_URL` to the url of you development machine.
|
||||||
|
|
||||||
### Changing configuration
|
### Changing configuration
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { castApiAvailable } from "./cast_framework";
|
import { castApiAvailable } from "./cast_framework";
|
||||||
import { CAST_APP_ID, CAST_NS, CAST_DEV_HASS_URL, CAST_DEV } from "./const";
|
import { CAST_APP_ID, CAST_NS, CAST_DEV } from "./const";
|
||||||
|
import { CAST_DEV_HASS_URL } from "./dev_const";
|
||||||
import {
|
import {
|
||||||
castSendAuth,
|
castSendAuth,
|
||||||
HassMessage as ReceiverMessage,
|
HassMessage as ReceiverMessage,
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
|
import { CAST_DEV_APP_ID } from "./dev_const";
|
||||||
|
|
||||||
// Guard dev mode with `__dev__` so it can only ever be enabled in dev mode.
|
// Guard dev mode with `__dev__` so it can only ever be enabled in dev mode.
|
||||||
export const CAST_DEV = __DEV__ && true;
|
export const CAST_DEV = __DEV__ && true;
|
||||||
// Replace this with your own unpublished cast app that points at your local dev
|
|
||||||
const CAST_DEV_APP_ID = "5FE44367";
|
|
||||||
export const CAST_APP_ID = CAST_DEV ? CAST_DEV_APP_ID : "B12CE3CA";
|
export const CAST_APP_ID = CAST_DEV ? CAST_DEV_APP_ID : "B12CE3CA";
|
||||||
export const CAST_NS = "urn:x-cast:com.nabucasa.hast";
|
export const CAST_NS = "urn:x-cast:com.nabucasa.hast";
|
||||||
|
|
||||||
// Chromecast SDK will only load on localhost and HTTPS
|
|
||||||
// So during local development we have to send our dev IP address,
|
|
||||||
// but then run the UI on localhost.
|
|
||||||
export const CAST_DEV_HASS_URL = "http://192.168.1.234:8123";
|
|
||||||
|
7
src/cast/dev_const.ts
Normal file
7
src/cast/dev_const.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// Replace this with your own unpublished cast app that points at your local dev
|
||||||
|
export const CAST_DEV_APP_ID = "5FE44367";
|
||||||
|
|
||||||
|
// Chromecast SDK will only load on localhost and HTTPS
|
||||||
|
// So during local development we have to send our dev IP address,
|
||||||
|
// but then run the UI on localhost.
|
||||||
|
export const CAST_DEV_HASS_URL = "http://192.168.1.234:8123";
|
@ -4,7 +4,8 @@ import { Auth } from "home-assistant-js-websocket";
|
|||||||
import { CastManager } from "./cast_manager";
|
import { CastManager } from "./cast_manager";
|
||||||
|
|
||||||
import { BaseCastMessage } from "./types";
|
import { BaseCastMessage } from "./types";
|
||||||
import { CAST_DEV_HASS_URL, CAST_DEV } from "./const";
|
import { CAST_DEV } from "./const";
|
||||||
|
import { CAST_DEV_HASS_URL } from "./dev_const";
|
||||||
|
|
||||||
export interface GetStatusMessage extends BaseCastMessage {
|
export interface GetStatusMessage extends BaseCastMessage {
|
||||||
type: "get_status";
|
type: "get_status";
|
||||||
|
@ -7,6 +7,7 @@ import {
|
|||||||
css,
|
css,
|
||||||
CSSResult,
|
CSSResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
|
import { classMap } from "lit-html/directives/class-map";
|
||||||
|
|
||||||
import { EntityRow, CastConfig } from "../entity-rows/types";
|
import { EntityRow, CastConfig } from "../entity-rows/types";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
@ -45,6 +46,11 @@ class HuiCastRow extends LitElement implements EntityRow {
|
|||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const active =
|
||||||
|
this._castManager &&
|
||||||
|
this._castManager.status &&
|
||||||
|
this._config.view === this._castManager.status.lovelacePath;
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-icon .icon="${this._config.icon}"></ha-icon>
|
<ha-icon .icon="${this._config.icon}"></ha-icon>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
@ -68,8 +74,8 @@ class HuiCastRow extends LitElement implements EntityRow {
|
|||||||
<google-cast-launcher></google-cast-launcher>
|
<google-cast-launcher></google-cast-launcher>
|
||||||
<mwc-button
|
<mwc-button
|
||||||
@click=${this._sendLovelace}
|
@click=${this._sendLovelace}
|
||||||
.unelevated=${this._castManager.status &&
|
class=${classMap({ inactive: !Boolean(active) })}
|
||||||
this._config.view === this._castManager.status.lovelacePath}
|
.unelevated=${active}
|
||||||
.disabled=${!this._castManager.status}
|
.disabled=${!this._castManager.status}
|
||||||
>
|
>
|
||||||
SHOW
|
SHOW
|
||||||
@ -124,7 +130,6 @@ class HuiCastRow extends LitElement implements EntityRow {
|
|||||||
:host {
|
:host {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
overflow: visible;
|
|
||||||
}
|
}
|
||||||
ha-icon {
|
ha-icon {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
@ -143,7 +148,6 @@ class HuiCastRow extends LitElement implements EntityRow {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
.controls {
|
.controls {
|
||||||
margin-right: -0.57em;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@ -154,6 +158,9 @@ class HuiCastRow extends LitElement implements EntityRow {
|
|||||||
height: 24px;
|
height: 24px;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
}
|
}
|
||||||
|
.inactive {
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user