new function settings
This commit is contained in:
@ -1,34 +0,0 @@
|
||||
import type { NotificationPosition } from '../components/Notifications/CustomNotification';
|
||||
|
||||
export type LauncherSettings = {
|
||||
notificationPosition?: 'top-right' | 'top-center' | 'top-left' | 'bottom-right' | 'bottom-center' | 'bottom-left';
|
||||
};
|
||||
|
||||
export function getLauncherSettings(): LauncherSettings {
|
||||
try {
|
||||
return JSON.parse(localStorage.getItem('launcher_settings') || '{}');
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
export function getNotificationPosition(): NotificationPosition {
|
||||
const { notificationPosition } = getLauncherSettings();
|
||||
|
||||
switch (notificationPosition) {
|
||||
case 'top-right':
|
||||
return { vertical: 'top', horizontal: 'right' };
|
||||
case 'top-center':
|
||||
return { vertical: 'top', horizontal: 'center' };
|
||||
case 'top-left':
|
||||
return { vertical: 'top', horizontal: 'left' };
|
||||
case 'bottom-right':
|
||||
return { vertical: 'bottom', horizontal: 'right' };
|
||||
case 'bottom-center':
|
||||
return { vertical: 'bottom', horizontal: 'center' };
|
||||
case 'bottom-left':
|
||||
return { vertical: 'bottom', horizontal: 'left' };
|
||||
default:
|
||||
return { vertical: 'bottom', horizontal: 'center' };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user