π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Extra
Manav Rathicf25cc40e429
diff --git a/web/packages/base/context.ts b/web/packages/base/context.tsindex aa01858b3c..96e1fe302b 100644--- a/web/packages/base/context.ts+++ b/web/packages/base/context.ts@@ -1,8 +1,11 @@import type { MiniDialogAttributes } from "@/base/components/MiniDialog";+import { createContext, useContext } from "react";/*** The type of the context expected to be present in the React tree for all apps* that use the base package.+ *+ * It is usually provided by the _app.tsx for the corresponding app.*/export interface BaseContextT {/**@@ -18,3 +21,15 @@ export interface BaseContextT {*/showMiniDialog: (attributes: MiniDialogAttributes) => void;}++/**+ * The React {@link Context} of type {@link BaseContextT} available to all React+ * components that refer to the base package.+ */+export const BaseContext = createContext<BaseContextT | undefined>(undefined);++/**+ * Utility hook to get the required {@link BaseContextT} that is expected to be+ * available to all React components that refer to the base package.+ */+export const useBaseContext = (): BaseContextT => useContext(BaseContext)!;