Files
indee-demo/src/stores/contentSource.ts
Dorian 35bc78b890 Enhance content management and user interaction features
- Introduced a new content source toggle in the profile and app header to switch between IndeeHub and TopDoc films.
- Updated the content fetching logic to dynamically load content based on the selected source.
- Enhanced the seeding process to include a combined catalog of IndeeHub and TopDoc films, ensuring diverse content availability.
- Improved user interaction by preventing duplicate reactions and ensuring a smoother voting experience across comments and content.
- Added support for Amber login (NIP-55) for Android users, integrating it into the existing authentication flow.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 14:24:52 +00:00

27 lines
790 B
TypeScript

import { defineStore } from 'pinia'
import { ref, watch } from 'vue'
export type ContentSourceId = 'indeehub' | 'topdocfilms'
const STORAGE_KEY = 'indeedhub:content-source'
export const useContentSourceStore = defineStore('contentSource', () => {
const saved = localStorage.getItem(STORAGE_KEY) as ContentSourceId | null
const activeSource = ref<ContentSourceId>(saved === 'topdocfilms' ? 'topdocfilms' : 'indeehub')
// Persist to localStorage on change
watch(activeSource, (v) => {
localStorage.setItem(STORAGE_KEY, v)
})
function setSource(source: ContentSourceId) {
activeSource.value = source
}
function toggle() {
activeSource.value = activeSource.value === 'indeehub' ? 'topdocfilms' : 'indeehub'
}
return { activeSource, setSource, toggle }
})