Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

635 B
Raw Blame
import { useContext, useEffect } from 'react';
import { useLocation } from 'react-router';
import { isPreferencePath, peachHistory, preferenceSection } from '@peach/history';
import { ShellActionsContext } from '../router';

export function SettingsMatch() {
  const actions = useContext(ShellActionsContext);
  const { pathname } = useLocation();
  useEffect(() => { void actions?.openSettings?.(preferenceSection(pathname)) }, [actions, pathname]);
  useEffect(() => () => {
    queueMicrotask(() => { if (!isPreferencePath(peachHistory.navigation.location.pathname)) actions?.closeSettings?.() });
  }, [actions]);
  return null;
}