ne minor, a ebat fix

This commit is contained in:
aurinex
2025-12-14 21:14:59 +05:00
parent de616ee8ac
commit ae4a67dcdf
20 changed files with 1818 additions and 652 deletions

View File

@ -0,0 +1,39 @@
import type { NotificationPosition } from '../components/Notifications/CustomNotification';
export function isNotificationsEnabled(): boolean {
try {
const s = JSON.parse(localStorage.getItem('launcher_settings') || '{}');
return s.notifications !== false; // по умолчанию true
} catch {
return true;
}
}
export function positionFromSettingValue(
v: string | undefined,
): NotificationPosition {
switch (v) {
case 'top-left':
return { vertical: 'top', horizontal: 'left' };
case 'top-center':
return { vertical: 'top', horizontal: 'center' };
case 'top-right':
return { vertical: 'top', horizontal: 'right' };
case 'bottom-left':
return { vertical: 'bottom', horizontal: 'left' };
case 'bottom-center':
return { vertical: 'bottom', horizontal: 'center' };
case 'bottom-right':
default:
return { vertical: 'bottom', horizontal: 'right' };
}
}
export function getNotifPositionFromSettings(): NotificationPosition {
try {
const s = JSON.parse(localStorage.getItem('launcher_settings') || '{}');
return positionFromSettingValue(s.notificationPosition);
} catch {
return { vertical: 'top', horizontal: 'right' };
}
}