- 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>
27 lines
790 B
TypeScript
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 }
|
|
})
|