mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(settings): add expanded video auto-unmute preference (#1104)
* feat(settings): add expanded video auto-unmute preference * fix(translations): add missing unmute labels * fix(translations): localize unmute label
This commit is contained in:
@@ -32,15 +32,19 @@ describe('ui state stores', () => {
|
||||
expect(store.getState().selectedText).toBe('');
|
||||
});
|
||||
|
||||
it('useExpandedMediaStore persists fitExpandedImagesToScreen', async () => {
|
||||
it('useExpandedMediaStore persists expanded media preferences', async () => {
|
||||
const store = (await import('../use-expanded-media-store')).default;
|
||||
|
||||
expect(store.getState().fitExpandedImagesToScreen).toBe(false);
|
||||
expect(store.getState().unmuteExpandedVideoSound).toBe(false);
|
||||
|
||||
store.getState().setFitExpandedImagesToScreen(true);
|
||||
store.getState().setUnmuteExpandedVideoSound(true);
|
||||
|
||||
expect(store.getState().fitExpandedImagesToScreen).toBe(true);
|
||||
expect(store.getState().unmuteExpandedVideoSound).toBe(true);
|
||||
expect(localStorage.getItem('expanded-media-store')).toContain('fitExpandedImagesToScreen');
|
||||
expect(localStorage.getItem('expanded-media-store')).toContain('unmuteExpandedVideoSound');
|
||||
});
|
||||
|
||||
it('useSubplebbitOfflineStore merges updates and clears initialLoad after the timeout', async () => {
|
||||
|
||||
@@ -3,14 +3,18 @@ import { persist } from 'zustand/middleware';
|
||||
|
||||
interface ExpandedMediaState {
|
||||
fitExpandedImagesToScreen: boolean;
|
||||
unmuteExpandedVideoSound: boolean;
|
||||
setFitExpandedImagesToScreen: (fit: boolean) => void;
|
||||
setUnmuteExpandedVideoSound: (unmute: boolean) => void;
|
||||
}
|
||||
|
||||
const useExpandedMediaStore = create<ExpandedMediaState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
fitExpandedImagesToScreen: false,
|
||||
unmuteExpandedVideoSound: false,
|
||||
setFitExpandedImagesToScreen: (fit) => set({ fitExpandedImagesToScreen: fit }),
|
||||
setUnmuteExpandedVideoSound: (unmute) => set({ unmuteExpandedVideoSound: unmute }),
|
||||
}),
|
||||
{
|
||||
name: 'expanded-media-store',
|
||||
|
||||
Reference in New Issue
Block a user