mirror of
https://github.com/block/buzz.git
synced 2026-11-25 02:31:36 +00:00
Revamp first-run onboarding (#924)
This commit is contained in:
@@ -10,6 +10,7 @@ import type { ReactNode } from "react";
|
||||
|
||||
import type { Workspace } from "./types";
|
||||
import {
|
||||
clearWorkspaceStorage,
|
||||
loadActiveWorkspaceId,
|
||||
loadWorkspaces,
|
||||
saveActiveWorkspaceId,
|
||||
@@ -23,6 +24,7 @@ export type UseWorkspacesReturn = {
|
||||
reinitKey: number;
|
||||
/** Add a workspace, deduplicating by relayUrl. Returns the final ID in the list. */
|
||||
addWorkspace: (workspace: Workspace) => string;
|
||||
clearWorkspaces: () => void;
|
||||
removeWorkspace: (id: string) => void;
|
||||
switchWorkspace: (id: string) => void;
|
||||
/** Force the active workspace to re-init (e.g. after a deep-link reconnect). */
|
||||
@@ -95,6 +97,12 @@ function useWorkspacesInternal(): UseWorkspacesReturn {
|
||||
return resolvedId;
|
||||
}, []);
|
||||
|
||||
const clearWorkspaces = useCallback(() => {
|
||||
clearWorkspaceStorage();
|
||||
setWorkspacesState([]);
|
||||
setActiveId(null);
|
||||
}, []);
|
||||
|
||||
const removeWorkspace = useCallback(
|
||||
(id: string) => {
|
||||
setWorkspacesState((prev) => {
|
||||
@@ -166,6 +174,7 @@ function useWorkspacesInternal(): UseWorkspacesReturn {
|
||||
activeWorkspace,
|
||||
reinitKey,
|
||||
addWorkspace,
|
||||
clearWorkspaces,
|
||||
removeWorkspace,
|
||||
switchWorkspace,
|
||||
reconnectWorkspace,
|
||||
|
||||
Reference in New Issue
Block a user