20 lines
614 B
TypeScript
20 lines
614 B
TypeScript
import { PRO_LOCKED_SOUND_IDS } from '@/entities/plan';
|
|
import type { SoundPreset } from '@/entities/session';
|
|
|
|
const QUICK_SOUND_FALLBACK_IDS = ['rain-focus', 'deep-white', 'silent'] as const;
|
|
|
|
const isQuickAvailablePreset = (preset: SoundPreset | undefined): preset is SoundPreset => {
|
|
if (!preset) {
|
|
return false;
|
|
}
|
|
|
|
return !PRO_LOCKED_SOUND_IDS.includes(preset.id);
|
|
};
|
|
|
|
export const getQuickSoundPresets = (presets: SoundPreset[]) => {
|
|
return QUICK_SOUND_FALLBACK_IDS
|
|
.map((presetId) => presets.find((preset) => preset.id === presetId))
|
|
.filter(isQuickAvailablePreset)
|
|
.slice(0, 3);
|
|
};
|