Skip to content

Commit

Permalink
fix: hide on archived and trashed assets
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasm91 committed Aug 29, 2024
1 parent 15131c2 commit 4539ade
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ services:
volumes:
- ${UPLOAD_LOCATION}/postgres:/var/lib/postgresql/data
ports:
- 5432:5432
- 5433:5432
healthcheck:
test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
interval: 5m
Expand Down
12 changes: 7 additions & 5 deletions web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,13 @@
onClick={() => openFileUploadDialog({ multiple: false, assetId: asset.id })}
text={$t('replace_with_upload')}
/>
<MenuOption
icon={mdiImageSearch}
onClick={() => goto(`${AppRoute.PHOTOS}?at=${asset.id}`)}
text={$t('view_in_timeline')}
/>
{#if !asset.isArchived && !asset.isTrashed}
<MenuOption
icon={mdiImageSearch}
onClick={() => goto(`${AppRoute.PHOTOS}?at=${asset.id}`)}
text={$t('view_in_timeline')}
/>
{/if}
<hr />
<MenuOption
icon={mdiDatabaseRefreshOutline}
Expand Down
3 changes: 1 addition & 2 deletions web/src/lib/components/memory-page/memory-viewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
mdiChevronUp,
mdiDotsVertical,
mdiImageSearch,
mdiOpenInNew,
mdiPause,
mdiPlay,
mdiPlus,
Expand Down Expand Up @@ -310,7 +309,7 @@
class:opacity-100={!galleryInView}
>
<CircleIconButton
href={`${AppRoute.PHOTOS}?at=${currentAsset.id}`}
href="${AppRoute.PHOTOS}?at=${currentAsset.id}"
icon={mdiImageSearch}
title={$t('view_in_timeline')}
color="light"
Expand Down
30 changes: 17 additions & 13 deletions web/src/lib/stores/assets.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ export class AssetStore {
this.buckets = timebuckets.map(
(bucket) => new AssetBucket({ store: this, bucketDate: bucket.timeBucket, bucketCount: bucket.count }),
);
// this.extensiveStuff();
this.initializedSignal();
this.initialized = true;
}
Expand Down Expand Up @@ -850,22 +851,25 @@ export class AssetStore {

private emit(recalculate: boolean) {
if (recalculate) {
this.assets = this.buckets.flatMap(({ assets }) => assets);
this.extensiveStuff();
}
this.store$.set(this);
}

const assetToBucket: Record<string, AssetLookup> = {};
for (let index = 0; index < this.buckets.length; index++) {
const bucket = this.buckets[index];
if (bucket.assets.length > 0) {
bucket.bucketCount = bucket.assets.length;
}
for (let index_ = 0; index_ < bucket.assets.length; index_++) {
const asset = bucket.assets[index_];
assetToBucket[asset.id] = { bucket, bucketIndex: index, assetIndex: index_ };
}
private extensiveStuff() {
this.assets = this.buckets.flatMap(({ assets }) => assets);
const assetToBucket: Record<string, AssetLookup> = {};
for (let index = 0; index < this.buckets.length; index++) {
const bucket = this.buckets[index];
if (bucket.assets.length > 0) {
bucket.bucketCount = bucket.assets.length;
}
for (let index_ = 0; index_ < bucket.assets.length; index_++) {
const asset = bucket.assets[index_];
assetToBucket[asset.id] = { bucket, bucketIndex: index, assetIndex: index_ };
}
this.assetToBucket = assetToBucket;
}
this.store$.set(this);
this.assetToBucket = assetToBucket;
}
}

Expand Down

0 comments on commit 4539ade

Please sign in to comment.