mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +00:00
Do not show tips for shortcuts on a client with a touch screen (#25020)
* check isTouch * check isTouch * check isTouch * restored lost line * isTouch -> isMobileClient * isTouch -> isMobileClient * isTouch -> isMobileClient * Create is_mobile.ts
This commit is contained in:
parent
43bb9d3401
commit
98ae0295b4
@ -43,6 +43,7 @@ import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
|
||||
import { haStyle } from "../../../resources/styles";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import { documentationUrl } from "../../../util/documentation-url";
|
||||
import { isMobileClient } from "../../../util/is_mobile";
|
||||
import "../ha-config-section";
|
||||
import { configSections } from "../ha-panel-config";
|
||||
import "../repairs/ha-config-repairs";
|
||||
@ -105,7 +106,7 @@ const randomTip = (openFn: any, hass: HomeAssistant, narrow: boolean) => {
|
||||
},
|
||||
];
|
||||
|
||||
if (hass?.enableShortcuts) {
|
||||
if (hass?.enableShortcuts && !isMobileClient) {
|
||||
const localizeParam = {
|
||||
keyboard_shortcut: html`<a href="#" @click=${openFn}
|
||||
>${hass.localize("ui.tips.keyboard_shortcut")}</a
|
||||
|
@ -19,6 +19,7 @@ import { storage } from "../../../common/decorators/storage";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import { escapeRegExp } from "../../../common/string/escape_regexp";
|
||||
import { copyToClipboard } from "../../../common/util/copy-clipboard";
|
||||
import { isMobileClient } from "../../../util/is_mobile";
|
||||
import "../../../components/entity/ha-entity-picker";
|
||||
import "../../../components/ha-alert";
|
||||
import "../../../components/ha-button";
|
||||
@ -129,7 +130,7 @@ class HaPanelDevState extends LitElement {
|
||||
allow-custom-entity
|
||||
item-label-path="entity_id"
|
||||
></ha-entity-picker>
|
||||
${this.hass.enableShortcuts
|
||||
${this.hass.enableShortcuts && !isMobileClient
|
||||
? html`<ha-tip .hass=${this.hass}
|
||||
>${this.hass.localize("ui.tips.key_e_tip", {
|
||||
keyboard_shortcut: html`<a
|
||||
|
@ -11,6 +11,7 @@ import { isExternal } from "../../data/external";
|
||||
import type { CoreFrontendUserData } from "../../data/frontend";
|
||||
import { getOptimisticFrontendUserDataCollection } from "../../data/frontend";
|
||||
import { showConfirmationDialog } from "../../dialogs/generic/show-dialog-box";
|
||||
import { isMobileClient } from "../../util/is_mobile";
|
||||
import { haStyle } from "../../resources/styles";
|
||||
import type { HomeAssistant, Route } from "../../types";
|
||||
import "./ha-advanced-mode-row";
|
||||
@ -219,11 +220,15 @@ class HaProfileSectionGeneral extends LitElement {
|
||||
.narrow=${this.narrow}
|
||||
.hass=${this.hass}
|
||||
></ha-set-suspend-row>
|
||||
<ha-enable-shortcuts-row
|
||||
id="shortcuts"
|
||||
.narrow=${this.narrow}
|
||||
.hass=${this.hass}
|
||||
></ha-enable-shortcuts-row>
|
||||
${!isMobileClient
|
||||
? html`
|
||||
<ha-enable-shortcuts-row
|
||||
id="shortcuts"
|
||||
.narrow=${this.narrow}
|
||||
.hass=${this.hass}
|
||||
></ha-enable-shortcuts-row>
|
||||
`
|
||||
: ""}
|
||||
</ha-card>
|
||||
</div>
|
||||
</hass-tabs-subpage>
|
||||
|
3
src/util/is_mobile.ts
Normal file
3
src/util/is_mobile.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export const isMobileClient = /(?:iphone|android|ipad)/i.test(
|
||||
navigator.userAgent
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user