Files
kandev/apps/web/lib/state/slices/features/features-slice.ts
T
José Almeida 9c16d337a2 feat(web): add global app status surface (#1869)
* feat(web): add app status bar

* feat(web): add app status bar visibility toggle

* feat(web): persist status bar item order

* fix(web): refine app status bar behavior

* fix(web): polish app status bar presentation

* test(web): split plugin slot coverage groups

* fix(web): address status surface review feedback

* fix(web): stabilize status bar overlay tests
2026-07-23 12:28:54 +01:00

31 lines
854 B
TypeScript

import type { StateCreator } from "zustand";
import type { FeaturesSlice, FeaturesSliceState } from "./types";
export const defaultFeaturesState: FeaturesSliceState = {
// All flags default to false. Production releases ship every flag off
// until the deployment opts in via env var (e.g. KANDEV_FEATURES_OFFICE).
// The SSR layer overwrites this with whatever the backend reports.
features: {
office: false,
plugins: false,
appStatusBar: false,
},
};
type ImmerSet = Parameters<
StateCreator<FeaturesSlice, [["zustand/immer", never]], [], FeaturesSlice>
>[0];
export const createFeaturesSlice: StateCreator<
FeaturesSlice,
[["zustand/immer", never]],
[],
FeaturesSlice
> = (set: ImmerSet) => ({
...defaultFeaturesState,
setFeatures: (features) =>
set((draft) => {
draft.features = features;
}),
});