Skip to content

Commit

Permalink
fix: active/inactive
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Sep 4, 2024
1 parent 1447196 commit d6d940b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/uicons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ describe('spawnpoint', () => {
})

describe('stations', () => {
test('0.ext', () => {
test('active', () => {
expect(icons.station(true)).toBe(`${BASE_ICON_URL}/station/1.webp`)
})
test('inactive', () => {
expect(icons.station()).toBe(`${BASE_ICON_URL}/station/0.webp`)
})
})
Expand Down
7 changes: 5 additions & 2 deletions src/uicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,15 @@ export class UICONS<Index extends UiconsIndex = UiconsIndex> {
}

/**
* @param active if the station is active or not
* @returns the src of the station icon
*/
station(): string {
station(active = false): string {
if (!this.#isReady('station')) return ''

return `${this.#path}/station/0.${this.#extensionMap.station}`
return `${this.#path}/station/${active ? 1 : 0}.${
this.#extensionMap.station
}`
}

/**
Expand Down

0 comments on commit d6d940b

Please sign in to comment.