Skip to content

Commit 0302413

Browse files
committed
chore(husky): add pre-commit hooks and fix TypeScript errors
1 parent 2ef92f6 commit 0302413

7 files changed

Lines changed: 23 additions & 21 deletions

File tree

.githooks/pre-commit

Lines changed: 0 additions & 7 deletions
This file was deleted.

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm check && pnpm check:stories && pnpm typecheck && pnpm test

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"test:coverage": "vitest --config vitest.unit.config.ts --project unit --coverage",
2323
"test:storybook": "vitest --project \"storybook:$PWD/.storybook\"",
2424
"typecheck": "tsc --noEmit",
25-
"setup:hooks": "node scripts/setup-hooks.mjs"
25+
"setup:hooks": "node scripts/setup-hooks.mjs",
26+
"prepare": "husky"
2627
},
2728
"dependencies": {
2829
"@dnd-kit/core": "^6.3.1",
@@ -67,6 +68,7 @@
6768
"@vitejs/plugin-react": "6.0.1",
6869
"@vitest/browser-playwright": "^4.1.3",
6970
"@vitest/coverage-v8": "^4.1.3",
71+
"husky": "^9.1.7",
7072
"jsdom": "^29.0.2",
7173
"playwright": "^1.59.1",
7274
"storybook": "^10.3.5",

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/features/lighting/components/light-card/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { memo, useCallback, useEffect, useRef, useState } from 'react';
22
import { useShallow } from 'zustand/react/shallow';
33
import { type CardSize, isCompactCardSize } from '@/app/components/shared/card-size-selector';
4+
import { getCardShellSurfaceTokens } from '@/app/components/shared/theme/card-shell-surface-tokens';
45
import { useTheme } from '@/app/hooks';
56
import { useSettingsStore } from '@/app/stores';
67
import { resolveEffectsQuality } from '@/app/utils/effects-quality';
@@ -65,6 +66,7 @@ export const LightCard = memo(function LightCard({
6566
size,
6667
isEditMode,
6768
});
69+
const cardShell = getCardShellSurfaceTokens(theme);
6870
const resolvedEffectsQuality = resolveEffectsQuality(effectsQuality, lowPowerMode);
6971
const showAmbientLightBleed = ambientLightBleed && resolvedEffectsQuality === 'high';
7072
const surfaceTokens = getLightCardSurfaceTokens({

src/app/features/media/components/media-card/get-media-entity-type-key.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ export function getMediaEntityTypeKey(
4141
deviceClass?: string
4242
): MediaEntityTypeKey {
4343
const normalizedDeviceClass = normalizeMediaEntityType(deviceClass);
44-
if (normalizedDeviceClass in MEDIA_ENTITY_TYPE_KEY_BY_NORMALIZED_VALUE) {
45-
return MEDIA_ENTITY_TYPE_KEY_BY_NORMALIZED_VALUE[normalizedDeviceClass]!;
44+
const deviceClassKey = MEDIA_ENTITY_TYPE_KEY_BY_NORMALIZED_VALUE[normalizedDeviceClass];
45+
if (deviceClassKey) {
46+
return deviceClassKey;
4647
}
4748

4849
const normalizedEntityType = normalizeMediaEntityType(entityType);
49-
if (normalizedEntityType in MEDIA_ENTITY_TYPE_KEY_BY_NORMALIZED_VALUE) {
50-
return MEDIA_ENTITY_TYPE_KEY_BY_NORMALIZED_VALUE[normalizedEntityType]!;
50+
const entityTypeKey = MEDIA_ENTITY_TYPE_KEY_BY_NORMALIZED_VALUE[normalizedEntityType];
51+
if (entityTypeKey) {
52+
return entityTypeKey;
5153
}
5254

5355
return 'media.type.player';

src/app/features/media/components/media-card/index.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ interface MediaCardProps {
4949
export const MediaCard = memo(function MediaCard({
5050
id,
5151
name,
52-
room,
52+
room: _room,
5353
title,
5454
artist,
5555
entityType,
@@ -242,15 +242,12 @@ export const MediaCard = memo(function MediaCard({
242242
onArtworkError={handleArtworkError}
243243
entityName={name}
244244
entityTypeKey={mediaEntityTypeKey}
245-
room={room}
246245
title={displayTitle}
247246
artist={displayArtist}
248247
isActive={!isOff}
249248
isPlaying={isPlaying}
250249
volume={volume}
251250
isMuted={isMuted}
252-
elapsedSeconds={elapsedSeconds}
253-
durationSeconds={durationSeconds}
254251
theme={theme}
255252
onToggleMute={toggleMute}
256253
onPrevious={handlePrevious}
@@ -268,7 +265,6 @@ export const MediaCard = memo(function MediaCard({
268265
onArtworkError={handleArtworkError}
269266
entityName={name}
270267
entityTypeKey={mediaEntityTypeKey}
271-
room={room}
272268
title={displayTitle}
273269
artist={displayArtist}
274270
isActive={!isOff}
@@ -294,15 +290,12 @@ export const MediaCard = memo(function MediaCard({
294290
onArtworkError={handleArtworkError}
295291
entityName={name}
296292
entityTypeKey={mediaEntityTypeKey}
297-
room={room}
298293
title={displayTitle}
299294
artist={displayArtist}
300295
isActive={!isOff}
301296
isPlaying={isPlaying}
302297
volume={volume}
303298
isMuted={isMuted}
304-
elapsedSeconds={elapsedSeconds}
305-
durationSeconds={durationSeconds}
306299
theme={theme}
307300
onOpenDialog={openDialog}
308301
onToggleMute={toggleMute}
@@ -322,7 +315,6 @@ export const MediaCard = memo(function MediaCard({
322315
artist={displayArtist}
323316
entityName={name}
324317
entityTypeKey={mediaEntityTypeKey}
325-
room={room}
326318
isActive={!isOff}
327319
isPlaying={isPlaying}
328320
volume={volume}

0 commit comments

Comments
 (0)