Skip to content

Commit f820d9a

Browse files
committed
refactor services structure
1 parent 7878c8b commit f820d9a

File tree

12 files changed

+791
-790
lines changed

12 files changed

+791
-790
lines changed

.cursor/rules/codebase-index.mdc

Lines changed: 775 additions & 770 deletions
Large diffs are not rendered by default.

apps/web/src/components/editor/panels/assets/views/captions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {
1717
TranscriptionLanguage,
1818
TranscriptionProgress,
1919
} from "@/types/transcription";
20-
import { transcriptionService } from "@/services/transcription";
20+
import { transcriptionService } from "@/services/transcription/service";
2121
import { decodeAudioToFloat32 } from "@/lib/media/audio";
2222
import { buildCaptionChunks } from "@/lib/transcription/caption";
2323
import { Spinner } from "@/components/ui/spinner";

apps/web/src/components/storage-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { createContext, useContext, useEffect, useRef, useState } from "react";
44
import { toast } from "sonner";
55
import { useEditor } from "@/hooks/use-editor";
6-
import { storageService } from "@/services/storage/storage-service";
6+
import { storageService } from "@/services/storage/service";
77

88
interface StorageContextType {
99
isInitialized: boolean;

apps/web/src/core/managers/media-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { EditorCore } from "@/core";
22
import type { MediaAsset } from "@/types/assets";
3-
import { storageService } from "@/services/storage/storage-service";
3+
import { storageService } from "@/services/storage/service";
44
import { generateUUID } from "@/utils/id";
5-
import { videoCache } from "@/services/media/video-cache";
5+
import { videoCache } from "@/services/video-cache/service";
66
import { hasMediaId } from "@/lib/timeline/element-utils";
77

88
export class MediaManager {

apps/web/src/core/managers/project-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
TTimelineViewState,
99
} from "@/types/project";
1010
import type { ExportOptions, ExportResult } from "@/types/export";
11-
import { storageService } from "@/services/storage/storage-service";
11+
import { storageService } from "@/services/storage/service";
1212
import { toast } from "sonner";
1313
import { generateUUID } from "@/utils/id";
1414
import { UpdateProjectSettingsCommand } from "@/lib/commands/project";

apps/web/src/core/managers/scenes-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { EditorCore } from "@/core";
22
import type { TimelineTrack, TScene } from "@/types/timeline";
3-
import { storageService } from "@/services/storage/storage-service";
3+
import { storageService } from "@/services/storage/service";
44
import {
55
getMainScene,
66
ensureMainScene,

apps/web/src/lib/commands/media/add-media-asset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Command } from "@/lib/commands/base-command";
22
import { EditorCore } from "@/core";
33
import type { MediaAsset } from "@/types/assets";
44
import { generateUUID } from "@/utils/id";
5-
import { storageService } from "@/services/storage/storage-service";
5+
import { storageService } from "@/services/storage/service";
66

77
export class AddMediaAssetCommand extends Command {
88
private assetId: string;

apps/web/src/lib/commands/media/remove-media-asset.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Command } from "@/lib/commands/base-command";
22
import { EditorCore } from "@/core";
33
import type { MediaAsset } from "@/types/assets";
4-
import { storageService } from "@/services/storage/storage-service";
5-
import { videoCache } from "@/services/media/video-cache";
4+
import { storageService } from "@/services/storage/service";
5+
import { videoCache } from "@/services/video-cache/service";
66
import { hasMediaId } from "@/lib/timeline/element-utils";
77
import type { TimelineTrack } from "@/types/timeline";
88

apps/web/src/services/storage/storage-service.ts renamed to apps/web/src/services/storage/service.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,9 @@ class StorageService {
333333
]);
334334
}
335335

336-
// Utility methods
337336
async clearAllData(): Promise<void> {
338-
// Clear all projects
339337
await this.projectsAdapter.clear();
340-
341-
// Note: Project-specific media and timelines will be cleaned up when projects are deleted
338+
// project-specific media and timelines cleaned up when projects are deleted
342339
}
343340

344341
async getStorageInfo(): Promise<{
@@ -392,7 +389,6 @@ class StorageService {
392389
try {
393390
const currentData = await this.loadSavedSounds();
394391

395-
// Check if sound is already saved
396392
if (currentData.sounds.some((sound) => sound.id === soundEffect.id)) {
397393
return; // Already saved
398394
}
@@ -456,7 +452,6 @@ class StorageService {
456452
}
457453
}
458454

459-
// Check browser support
460455
isOPFSSupported(): boolean {
461456
return OPFSAdapter.isSupported();
462457
}
@@ -470,6 +465,5 @@ class StorageService {
470465
}
471466
}
472467

473-
// Export singleton instance
474468
export const storageService = new StorageService();
475469
export { StorageService };

apps/web/src/services/transcription/index.ts renamed to apps/web/src/services/transcription/service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type {
2+
TranscriptionLanguage,
23
TranscriptionResult,
34
TranscriptionProgress,
45
TranscriptionModelId,
@@ -8,7 +9,6 @@ import {
89
TRANSCRIPTION_MODELS,
910
} from "@/constants/transcription-constants";
1011
import type { WorkerMessage, WorkerResponse } from "./worker";
11-
import type { LanguageCode } from "@/types/language";
1212

1313
type ProgressCallback = (progress: TranscriptionProgress) => void;
1414

@@ -20,12 +20,12 @@ class TranscriptionService {
2020

2121
async transcribe({
2222
audioData,
23-
language,
23+
language = "auto",
2424
modelId = DEFAULT_TRANSCRIPTION_MODEL,
2525
onProgress,
2626
}: {
2727
audioData: Float32Array;
28-
language?: LanguageCode;
28+
language?: TranscriptionLanguage;
2929
modelId?: TranscriptionModelId;
3030
onProgress?: ProgressCallback;
3131
}): Promise<TranscriptionResult> {

0 commit comments

Comments
 (0)