'use client';

import {StoreSwitcher} from './StoreSwitcher';
import {RangePicker} from './RangePicker';

/**
 * The store + period controls a data page puts in its own header.
 *
 * These read and write WorkspaceProvider, so the selection still persists
 * across navigation — what changed is where they are *stated*. A page that
 * queries by store and period declares those controls itself; a page that
 * does not (Settings) shows none, instead of the shell implying a scope that
 * nothing on screen honours.
 *
 * Returns a fragment: PageHeader's `controls` slot supplies the row.
 */
export function ScopeControls({
  /** Off for pages that read the period but deliberately ignore store scope. */
  hasStore = true,
}: {
  hasStore?: boolean;
}) {
  return (
    <>
      {hasStore ? <StoreSwitcher /> : null}
      <RangePicker />
    </>
  );
}
