mirror of
https://github.com/immich-app/immich.git
synced 2026-05-23 16:12:30 -04:00
a16d233a0c
* feat: sort imports * fix: something?
21 lines
719 B
TypeScript
21 lines
719 B
TypeScript
import { updateMyPreferences } from '@immich/sdk';
|
|
import { DateTime } from 'luxon';
|
|
import { authManager } from '$lib/managers/auth-manager.svelte';
|
|
|
|
export const getButtonVisibility = (): boolean => {
|
|
if (!authManager.authenticated) {
|
|
return true;
|
|
}
|
|
|
|
const now = DateTime.now();
|
|
const hideUntilDate = DateTime.fromISO(authManager.preferences.purchase.hideBuyButtonUntil);
|
|
const dayLeft = Number(now.diff(hideUntilDate, 'days').days.toFixed(0));
|
|
|
|
return dayLeft > 0;
|
|
};
|
|
|
|
export const setSupportBadgeVisibility = async (value: boolean) => {
|
|
const response = await updateMyPreferences({ userPreferencesUpdateDto: { purchase: { showSupportBadge: value } } });
|
|
authManager.setPreferences(response);
|
|
};
|