Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: user's features preferences #12099

Merged
merged 19 commits into from
Aug 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feature settings on web
alextran1502 committed Aug 28, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 7d5f3932930d85877c32aa7314e8eb3f2f268f89
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { slide } from 'svelte/transition';
import { fade } from 'svelte/transition';
import { getAccordionState } from './setting-accordion-state.svelte';
import { onDestroy } from 'svelte';

@@ -9,6 +9,7 @@
export let subtitle = '';
export let key: string;
export let isOpen = $accordionState.has(key);
export let autoScrollTo = false;

let accordionElement: HTMLDivElement;

@@ -18,12 +19,14 @@
if (isOpen) {
$accordionState = $accordionState.add(key);

setTimeout(() => {
accordionElement.scrollIntoView({
behavior: 'smooth',
block: 'start',
});
}, 200);
if (autoScrollTo) {
setTimeout(() => {
accordionElement.scrollIntoView({
behavior: 'smooth',
block: 'start',
});
}, 200);
}
} else {
$accordionState.delete(key);
$accordionState = $accordionState;
@@ -72,7 +75,7 @@
</button>

{#if isOpen}
<ul transition:slide={{ duration: 250 }} class="mb-2 ml-4">
<ul in:fade={{ duration: 150 }} class="mb-2 ml-4">
<slot />
</ul>
{/if}
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
import { preferences } from '$lib/stores/user.store';
import Button from '../elements/buttons/button.svelte';
import { t } from 'svelte-i18n';
import SettingAccordion from '$lib/components/shared-components/settings/setting-accordion.svelte';

let memoriesEnabled = $preferences?.memories?.enabled ?? true;
let folderEnabled = $preferences?.folders?.enabled ?? false;
@@ -47,37 +48,43 @@
<div in:fade={{ duration: 500 }}>
<form autocomplete="off" on:submit|preventDefault>
<div class="ml-4 mt-4 flex flex-col gap-4">
<div class="ml-4">
<SettingSwitch
title={$t('folders')}
subtitle={$t('folders_sidebar_description')}
bind:checked={folderEnabled}
/>
</div>
<SettingAccordion key="folders" title={$t('folders')} subtitle={$t('folders_feature_description')}>
<div class="ml-4 mt-6">
<SettingSwitch title={$t('enable')} bind:checked={folderEnabled} />
</div>
<div class="ml-4 mt-6">
<SettingSwitch
title={$t('folders')}
subtitle={$t('folders_sidebar_description')}
bind:checked={folderEnabled}
/>
</div>
</SettingAccordion>

<div class="ml-4 mt-4">
<SettingSwitch
title={$t('time_based_memories')}
subtitle={$t('photos_from_previous_years')}
bind:checked={memoriesEnabled}
/>
</div>
<SettingAccordion key="memories" title={$t('time_based_memories')} subtitle={$t('photos_from_previous_years')}>
<div class="ml-4 mt-6">
<SettingSwitch title={$t('enable')} bind:checked={memoriesEnabled} />
</div>
</SettingAccordion>

<div class="ml-4 mt-4">
<SettingSwitch
title={$t('people')}
subtitle={$t('people_sidebar_description')}
bind:checked={peopleEnabled}
/>
</div>
<SettingAccordion key="people" title={$t('people')} subtitle={$t('people_feature_description')}>
<div class="ml-4 mt-6">
<SettingSwitch title={$t('enable')} bind:checked={peopleEnabled} />
</div>
</SettingAccordion>

<div class="ml-4 mt-4">
<SettingSwitch title={$t('rating')} subtitle={$t('rating_description')} bind:checked={ratingEnabled} />
</div>
<SettingAccordion key="rating" title={$t('rating')} subtitle={$t('people_feature_description')}>
<div class="ml-4 mt-6">
<SettingSwitch title={$t('enable')} bind:checked={ratingEnabled} />
</div>
</SettingAccordion>

<SettingAccordion key="tags" title={$t('tags')} subtitle={$t('people_feature_description')}>
<div class="ml-4 mt-6">
<SettingSwitch title={$t('enable')} bind:checked={tagEnabled} />
</div>
</SettingAccordion>

<div class="ml-4 mt-4">
<SettingSwitch title={$t('tags')} subtitle={$t('tag_view_description')} bind:checked={tagEnabled} />
</div>
<div class="flex justify-end">
<Button type="submit" size="sm" on:click={() => handleSave()}>{$t('save')}</Button>
</div>
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
import { t } from 'svelte-i18n';
import DownloadSettings from '$lib/components/user-settings-page/download-settings.svelte';
import UserPurchaseSettings from '$lib/components/user-settings-page/user-purchase-settings.svelte';
import MetadataSettings from '$lib/components/user-settings-page/metadata-settings.svelte';
import FeatureSettings from '$lib/components/user-settings-page/feature-settings.svelte';

export let keys: ApiKeyResponseDto[] = [];
export let sessions: SessionResponseDto[] = [];
@@ -53,8 +53,8 @@
<DownloadSettings />
</SettingAccordion>

<SettingAccordion key="metadata" title={$t('metadata')} subtitle={$t('metadata_setting_description')}>
<MetadataSettings />
<SettingAccordion key="feature" title={$t('features')} subtitle={$t('features_setting_description')}>
<FeatureSettings />
</SettingAccordion>

<SettingAccordion key="notifications" title={$t('notifications')} subtitle={$t('notifications_setting_description')}>
@@ -84,6 +84,7 @@
key="user-purchase-settings"
title={$t('user_purchase_settings')}
subtitle={$t('user_purchase_settings_description')}
autoScrollTo={true}
>
<UserPurchaseSettings />
</SettingAccordion>
10 changes: 7 additions & 3 deletions web/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
@@ -554,6 +554,7 @@
"error": "Error",
"error_loading_image": "Error loading image",
"error_title": "Error - Something went wrong",

"errors": {
"cannot_navigate_next_asset": "Cannot navigate to the next asset",
"cannot_navigate_previous_asset": "Cannot navigate to previous asset",
@@ -695,6 +696,8 @@
"favorite_or_unfavorite_photo": "Favorite or unfavorite photo",
"favorites": "Favorites",
"feature_photo_updated": "Feature photo updated",
"features": "Features",
"features_setting_description": "Manage the app features",
"file_name": "File name",
"file_name_or_extension": "File name or extension",
"filename": "Filename",
@@ -703,6 +706,8 @@
"find_them_fast": "Find them fast by name with search",
"fix_incorrect_match": "Fix incorrect match",
"folders": "Folders",
"folders_feature_description": "Enable browsing the folder view for the photos and videos on the file system",

"folders_sidebar_description": "Display a link to folder view in the sidebar",
"force_re-scan_library_files": "Force Re-scan All Library Files",
"forward": "Forward",
@@ -815,8 +820,6 @@
"merge_people_prompt": "Do you want to merge these people? This action is irreversible.",
"merge_people_successfully": "Merge people successfully",
"merged_people_count": "Merged {count, plural, one {# person} other {# people}}",
"metadata": "Metadata",
"metadata_setting_description": "Manage the app metadata preference",
"minimize": "Minimize",
"minute": "Minute",
"missing": "Missing",
@@ -909,6 +912,7 @@
"pending": "Pending",
"people": "People",
"people_edits_count": "Edited {count, plural, one {# person} other {# people}}",
"people_feature_description": "Browsing photos and videos grouped by people",
"people_sidebar_description": "Display a link to People in the sidebar",
"permanent_deletion_warning": "Permanent deletion warning",
"permanent_deletion_warning_setting_description": "Show a warning when permanently deleting assets",
@@ -978,7 +982,7 @@
"rating": "Star rating",
"rating_clear": "Clear rating",
"rating_count": "{count, plural, one {# star} other {# stars}}",
"rating_description": "Display the exif rating in the info panel",
"rating_description": "Display the EXIF rating in the info panel",
"reaction_options": "Reaction options",
"read_changelog": "Read Changelog",
"reassign": "Reassign",

Unchanged files with check annotations Beta

const module: { default?: unknown } = await item.loader();
const translations = JSON.stringify(module.default, null, 2).trim();
const content = readFileSync(`src/lib/i18n/${filename}`).toString().trim();
expect(translations === content, `${item.name} did not load ${filename}`).toEqual(true);

Check failure on line 52 in web/src/lib/i18n.spec.ts

GitHub Actions / Web

src/lib/i18n.spec.ts > i18n > loaders > en.json should have a loader

AssertionError: English did not load en.json: expected false to deeply equal true - Expected + Received - true + false ❯ src/lib/i18n.spec.ts:52:83
});
}
});