mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
27 lines
716 B
TypeScript
27 lines
716 B
TypeScript
import { atom, type WritableAtom } from 'nanostores';
|
|
|
|
export class WorkbenchStore {
|
|
// The current repository.
|
|
repositoryId = atom<string | undefined>(undefined);
|
|
|
|
// Any available preview URL for the current repository.
|
|
previewURL = atom<string | undefined>(undefined);
|
|
|
|
// Whether there was an error loading the preview.
|
|
previewError = atom<boolean>(false);
|
|
|
|
showWorkbench: WritableAtom<boolean> = import.meta.hot?.data.showWorkbench ?? atom(false);
|
|
|
|
constructor() {
|
|
if (import.meta.hot) {
|
|
import.meta.hot.data.showWorkbench = this.showWorkbench;
|
|
}
|
|
}
|
|
|
|
setShowWorkbench(show: boolean) {
|
|
this.showWorkbench.set(show);
|
|
}
|
|
}
|
|
|
|
export const workbenchStore = new WorkbenchStore();
|