feat: persistent memories (#15953)

feat: memories

refactor

chore: use heart as favorite icon

fix: linting
This commit is contained in:
Jason Rasmussen
2025-02-21 13:31:37 -05:00
committed by GitHub
parent 502f6e020d
commit d350022dec
29 changed files with 585 additions and 70 deletions

View File

@@ -6,6 +6,7 @@ import {
AssetJobName,
AssetMediaSize,
JobName,
MemoryType,
finishOAuth,
getAssetOriginalPath,
getAssetPlaybackPath,
@@ -16,6 +17,7 @@ import {
linkOAuthAccount,
startOAuth,
unlinkOAuthAccount,
type MemoryResponseDto,
type PersonResponseDto,
type SharedLinkResponseDto,
type UserResponseDto,
@@ -320,7 +322,14 @@ export const handlePromiseError = <T>(promise: Promise<T>): void => {
};
export const memoryLaneTitle = derived(t, ($t) => {
return (yearsAgo: number) => $t('years_ago', { values: { years: yearsAgo } });
return (memory: MemoryResponseDto) => {
const now = new Date();
if (memory.type === MemoryType.OnThisDay) {
return $t('years_ago', { values: { years: now.getFullYear() - memory.data.year } });
}
return $t('unknown');
};
});
export const withError = async <T>(fn: () => Promise<T>): Promise<[undefined, T] | [unknown, undefined]> => {