feat: implement API photo packs with migration and settings management

This commit is contained in:
alexsparkes
2026-02-02 19:51:51 +00:00
parent 987f6756a0
commit 7641762557
2 changed files with 17 additions and 8 deletions

View File

@@ -133,7 +133,9 @@ const PhotoPackSettings = ({ pack }) => {
const renderField = (field, index) => {
const value =
field.secure && settings[field.key] ? atob(settings[field.key]) : settings[field.key] || field.default;
field.secure && settings[field.key]
? atob(settings[field.key])
: settings[field.key] || field.default;
switch (field.type) {
case 'dropdown':

View File

@@ -18,16 +18,21 @@ const SourceSection = ({
onToggle,
}) => {
const showInstalledPhotoPacks =
backgroundType === 'photo_pack' &&
marketplaceEnabled &&
installedPhotoPacks.length > 0;
backgroundType === 'photo_pack' && marketplaceEnabled && installedPhotoPacks.length > 0;
return (
<>
<Row final={!showInstalledPhotoPacks && (backgroundType === 'random_colour' || backgroundType === 'random_gradient')}>
<Row
final={
!showInstalledPhotoPacks &&
(backgroundType === 'random_colour' || backgroundType === 'random_gradient')
}
>
<Content
title={variables.getMessage('modals.main.settings.sections.background.source.title')}
subtitle={variables.getMessage('modals.main.settings.sections.background.source.subtitle')}
subtitle={variables.getMessage(
'modals.main.settings.sections.background.source.subtitle',
)}
/>
<Action>
<Dropdown
@@ -44,7 +49,9 @@ const SourceSection = ({
<>
<Row final={true}>
<Content
title={variables.getMessage('modals.main.settings.sections.background.installed_packs_title')}
title={variables.getMessage(
'modals.main.settings.sections.background.installed_packs_title',
)}
subtitle={`${installedPhotoPacks.length} ${installedPhotoPacks.length === 1 ? 'pack' : 'packs'}${totalPhotoCount} ${totalPhotoCount === 1 ? 'photo' : 'photos'}`}
/>
<Action>
@@ -60,7 +67,7 @@ const SourceSection = ({
onUninstall={onPhotoPackUninstall}
viewType="grid"
/>
{/* Settings for API packs */}
{installedPhotoPacks.map((pack) =>
pack.api_enabled ? <PhotoPackSettings key={pack.id} pack={pack} /> : null,