Files
dashtab/app/components/photo-thumbnail.gjs
raucao 6750c61d87 Add Nostr photo feeds and wallpaper selection
Read the curated photo feeds from wss://nostr.kosmos.org, verify events, cache originals and thumbnails, and let users pick a wallpaper from the Photos section. Nature is the default feed; City Nights is opt-in. Adds the manual publishing scripts, real event fixtures, protocol documentation, and tests with stubbed network connections.
2026-11-08 21:51:23 +04:00

40 lines
943 B
Plaintext

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { service } from '@ember/service';
// Settings-grid thumbnail. Prefers the cached object URL and falls back to the
// remote Blossom thumbnail while the cache is warming.
export default class PhotoThumbnailComponent extends Component {
@service photoCache;
@tracked src = null;
constructor(owner, args) {
super(owner, args);
this.src = this.args.photo.thumbUrl;
this.loadCached();
}
async loadCached() {
try {
const url = await this.photoCache.thumbUrl(this.args.photo);
if (url) {
this.src = url;
}
} catch {
// The remote thumbnail remains as the fallback.
}
}
<template>
<img
src={{this.src}}
alt={{@photo.alt}}
data-test-photo-thumbnail
loading="lazy"
draggable="false"
class="h-full w-full object-cover"
/>
</template>
}