Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1.1 KB
Raw Blame
import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';

/**
 * The runtime flag `dashboard` (off by default) as the client sees it.
 * `ready` is false until the server config β€” and so the user's flags β€” has
 * loaded; surfaces should neither render nor redirect before that.
 */
export const useDashboardFeature = () => {
  const ready = useServerConfigStore((s) => s.serverConfigInit);
  const enabled = useServerConfigStore(serverConfigSelectors.enableDashboard);
  return { enabled: ready && enabled, ready };
};

/**
 * The home dashboard (`/dashboard`): personal boards only for now β€”
 * workspace-level boards have no UI yet β€” so it is off inside a workspace even
 * while the flag is on. Project dashboards use `useDashboardFeature` instead.
 */
export const useHomeDashboardFeature = () => {
  const { enabled, ready } = useDashboardFeature();
  const activeWorkspaceSlug = useActiveWorkspaceSlug();
  return { enabled: enabled && !activeWorkspaceSlug, ready };
};