Skip to content

Commit

Permalink
rename cards to hasl4-* to allow installation alongside older version…
Browse files Browse the repository at this point in the history
… (pre v4)
  • Loading branch information
NecroKote committed Mar 19, 2024
1 parent a203131 commit 3cbead8
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 29 deletions.
4 changes: 2 additions & 2 deletions dist/editor.c447c18a.js → dist/editor.7baf97f9.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/editor.7baf97f9.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/editor.c447c18a.js.map

This file was deleted.

24 changes: 12 additions & 12 deletions dist/hasl-departure-card.js → dist/hasl4-departure-card.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "HASL Departure Card",
"filename": "hasl-departure-card.js",
"filename": "hasl4-departure-card.js",
"render_readme": true,
"country": "SE" ,
"homeassistant": "2024.1.0"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"version": "2.6.2",
"description": "HASL Departure Lovelace Card",
"source": "src/index.ts",
"module": "dist/hasl-departure-card.js",
"module": "dist/hasl4-departure-card.js",
"targets": {
"module": {
"includeNodeModules": true
}
},
"scripts": {
"clean": "rm -rf dist/*",
"build": "NODE_ENV=production parcel build",
"watch": "parcel watch",
"serve": "NODE_ENV=production parcel serve",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Present departure times from HASL 4 Departure sensors

## Manual Installation

Copy [`hasl-departure-card.js`](./dist/hasl-departure-card.js) to `<config>/www/hasl-departure-card.js`
Copy [`hasl4-departure-card.js`](./dist/hasl4-departure-card.js) to `<config>/www/hasl4-departure-card.js`

Where `<config>` is your Home Assistant configuration directory.
Then use the following in your `ui-lovelace.yaml` file:

```yaml
resources:
- url: /local/hasl-departure-card.js
- url: /local/hasl4-departure-card.js
type: js
```
Expand Down
8 changes: 4 additions & 4 deletions src/DepartureCard/DepartureCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class HASLDepartureCard extends LitElement implements LovelaceCard {

// configuration card is loaded in async manner
static async getConfigElement () {
return await import('../DepartureCardEditor').then(() => document.createElement("hasl-departure-card-editor"))
return await import('../DepartureCardEditor').then(() => document.createElement("hasl4-departure-card-editor"))
}
static getStubConfig = () => ({...DEFAULT_CONFIG})

Expand Down Expand Up @@ -72,7 +72,7 @@ export class HASLDepartureCard extends LitElement implements LovelaceCard {

const maxDepartures = this.config?.max_departures || attrs.departures.length
const departures = attrs.departures.slice(0, maxDepartures)
return html`<hasl-departure-entity
return html`<hasl4-departure-entity
.config=${config}
.departures=${departures}
@click=${this.clickHandler(entity)}
Expand Down Expand Up @@ -151,8 +151,8 @@ function isDeviationsAttrs(item: { [key:string]: any }): item is DeviationsAttri

declare global {
interface HTMLElementTagNameMap {
"hasl-departure-card": HASLDepartureCard,
"hasl-departure-entity": HASLDepartureEntity,
"hasl4-departure-card": HASLDepartureCard,
"hasl4-departure-entity": HASLDepartureEntity,
}
interface Event {
detail?: object
Expand Down
2 changes: 1 addition & 1 deletion src/DepartureCardEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { customElement, property, state } from "lit/decorators"
import { DepartureCardConfig } from './DepartureCard/DepartureCard.config'
import { getLanguage, translateTo, languages } from "./translations"

@customElement('hasl-departure-card-editor')
@customElement('hasl4-departure-card-editor')
export class HASLDepartureCardEditor extends LitElement implements LovelaceCardEditor {
@property({ attribute: false })
public hass?: HomeAssistant;
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ declare global {
customCards: Array<Object>
}
}
customElements.define('hasl-departure-card', HASLDepartureCard)
customElements.define('hasl-departure-entity', HASLDepartureEntity)
customElements.define('hasl4-departure-card', HASLDepartureCard)
customElements.define('hasl4-departure-entity', HASLDepartureEntity)

window.customCards = window.customCards || []
window.customCards.push({
type: "hasl-departure-card",
name: "HASL Departure card",
type: "hasl4-departure-card",
name: "HASL4 Departure card",
description: "Show departure times for SL Trafik",
})

0 comments on commit 3cbead8

Please sign in to comment.