@rebasepro/app 0.0.1-canary.4829d6e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/auth/api.d.ts +66 -0
- package/dist/auth/index.d.ts +13 -0
- package/dist/auth/types.d.ts +127 -0
- package/dist/auth/useRebaseAuthController.d.ts +13 -0
- package/dist/components/AIIcon.d.ts +17 -0
- package/dist/components/AuthSimulationMenu.d.ts +0 -0
- package/dist/components/ConfirmationDialog.d.ts +9 -0
- package/dist/components/Debug/UIReferenceView.d.ts +13 -0
- package/dist/components/Debug/UIStyleGuide.d.ts +2 -0
- package/dist/components/Debug/collection-views/CardViewDemo.d.ts +2 -0
- package/dist/components/Debug/collection-views/CollectionTableDemo.d.ts +2 -0
- package/dist/components/Debug/collection-views/KanbanBoardDemo.d.ts +2 -0
- package/dist/components/Debug/collection-views/index.d.ts +3 -0
- package/dist/components/Debug/collection-views/sample_data.d.ts +23 -0
- package/dist/components/Debug/crm-dashboard/CalendarWidget.d.ts +22 -0
- package/dist/components/Debug/crm-dashboard/CrmDashboardDemo.d.ts +2 -0
- package/dist/components/Debug/crm-dashboard/DashboardMetrics.d.ts +15 -0
- package/dist/components/Debug/crm-dashboard/PipelineOverview.d.ts +34 -0
- package/dist/components/Debug/crm-dashboard/RecentActivity.d.ts +19 -0
- package/dist/components/Debug/crm-dashboard/TaskFilters.d.ts +30 -0
- package/dist/components/Debug/crm-dashboard/TaskTable.d.ts +50 -0
- package/dist/components/Debug/crm-dashboard/TasksView.d.ts +41 -0
- package/dist/components/ErrorTooltip.d.ts +3 -0
- package/dist/components/ErrorView.d.ts +21 -0
- package/dist/components/LanguageToggle.d.ts +2 -0
- package/dist/components/LoginView/LoginView.d.ts +113 -0
- package/dist/components/LoginView/index.d.ts +2 -0
- package/dist/components/NotFoundPage.d.ts +2 -0
- package/dist/components/RebaseAuth.d.ts +10 -0
- package/dist/components/RebaseLogo.d.ts +7 -0
- package/dist/components/SchemaDriftBanner.d.ts +27 -0
- package/dist/components/UnsavedChangesDialog.d.ts +9 -0
- package/dist/components/UserDisplay.d.ts +7 -0
- package/dist/components/UserSelectPopover.d.ts +63 -0
- package/dist/components/UserSettingsView.d.ts +2 -0
- package/dist/components/common/index.d.ts +6 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/common/types.d.ts +66 -0
- package/dist/components/common/useColumnsIds.d.ts +9 -0
- package/dist/components/common/useDataTableController.d.ts +45 -0
- package/dist/components/common/useDebouncedData.d.ts +9 -0
- package/dist/components/common/useScrollRestoration.d.ts +14 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/contexts/AdminModeController.d.ts +4 -0
- package/dist/contexts/AnalyticsContext.d.ts +3 -0
- package/dist/contexts/AuthControllerContext.d.ts +3 -0
- package/dist/contexts/CollectionScopeContext.d.ts +50 -0
- package/dist/contexts/ComponentOverrideContext.d.ts +42 -0
- package/dist/contexts/CustomizationControllerContext.d.ts +3 -0
- package/dist/contexts/DataDriverContext.d.ts +3 -0
- package/dist/contexts/DataSourcesContext.d.ts +31 -0
- package/dist/contexts/DatabaseAdminContext.d.ts +3 -0
- package/dist/contexts/DialogsProvider.d.ts +4 -0
- package/dist/contexts/EffectiveRoleController.d.ts +4 -0
- package/dist/contexts/ModeController.d.ts +4 -0
- package/dist/contexts/RebaseClientInstanceContext.d.ts +6 -0
- package/dist/contexts/RebaseDataContext.d.ts +3 -0
- package/dist/contexts/SnackbarProvider.d.ts +2 -0
- package/dist/contexts/StorageSourceContext.d.ts +3 -0
- package/dist/contexts/StorageSourcesContext.d.ts +25 -0
- package/dist/contexts/UserConfigurationPersistenceContext.d.ts +3 -0
- package/dist/contexts/index.d.ts +17 -0
- package/dist/core/PluginLifecycleManager.d.ts +17 -0
- package/dist/core/PluginProviderStack.d.ts +21 -0
- package/dist/core/Rebase.d.ts +15 -0
- package/dist/core/RebaseProps.d.ts +291 -0
- package/dist/core/RebaseRouter.d.ts +4 -0
- package/dist/core/RebaseRoutes.d.ts +17 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/hooks/ApiConfigContext.d.ts +24 -0
- package/dist/hooks/data/delete.d.ts +33 -0
- package/dist/hooks/data/save.d.ts +40 -0
- package/dist/hooks/data/useCollection.d.ts +62 -0
- package/dist/hooks/data/useData.d.ts +13 -0
- package/dist/hooks/data/useDataOrder.d.ts +12 -0
- package/dist/hooks/data/useFetch.d.ts +43 -0
- package/dist/hooks/data/useRelationSelector.d.ts +52 -0
- package/dist/hooks/index.d.ts +36 -0
- package/dist/hooks/useAdminModeController.d.ts +19 -0
- package/dist/hooks/useAnalyticsController.d.ts +5 -0
- package/dist/hooks/useAuthController.d.ts +11 -0
- package/dist/hooks/useAuthSubscription.d.ts +2 -0
- package/dist/hooks/useBackendStorageSource.d.ts +30 -0
- package/dist/hooks/useBridgeRegistration.d.ts +18 -0
- package/dist/hooks/useBrowserTitleAndIcon.d.ts +6 -0
- package/dist/hooks/useBuildAdminModeController.d.ts +6 -0
- package/dist/hooks/useBuildEffectiveRoleController.d.ts +8 -0
- package/dist/hooks/useBuildLocalConfigurationPersistence.d.ts +2 -0
- package/dist/hooks/useBuildModeController.d.ts +6 -0
- package/dist/hooks/useClipboard.d.ts +57 -0
- package/dist/hooks/useCollapsedGroups.d.ts +27 -0
- package/dist/hooks/useComponentOverride.d.ts +32 -0
- package/dist/hooks/useCustomizationController.d.ts +11 -0
- package/dist/hooks/useDialogsController.d.ts +11 -0
- package/dist/hooks/useEffectiveRoleController.d.ts +7 -0
- package/dist/hooks/useLargeLayout.d.ts +1 -0
- package/dist/hooks/useModeController.d.ts +19 -0
- package/dist/hooks/usePermissions.d.ts +12 -0
- package/dist/hooks/useRebaseClient.d.ts +5 -0
- package/dist/hooks/useRebaseContext.d.ts +11 -0
- package/dist/hooks/useRebaseRegistry.d.ts +34 -0
- package/dist/hooks/useResolvedComponent.d.ts +47 -0
- package/dist/hooks/useSlot.d.ts +18 -0
- package/dist/hooks/useSnackbarController.d.ts +20 -0
- package/dist/hooks/useStorageSource.d.ts +6 -0
- package/dist/hooks/useStudioBridge.d.ts +79 -0
- package/dist/hooks/useTranslation.d.ts +17 -0
- package/dist/hooks/useUnsavedChangesDialog.d.ts +12 -0
- package/dist/hooks/useUserConfigurationPersistence.d.ts +8 -0
- package/dist/i18n/RebaseI18nProvider.d.ts +33 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.es.js +16843 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +17021 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/internal/common.d.ts +14 -0
- package/dist/internal/useRestoreScroll.d.ts +15 -0
- package/dist/locales/de.d.ts +2 -0
- package/dist/locales/en.d.ts +10 -0
- package/dist/locales/es.d.ts +10 -0
- package/dist/locales/fr.d.ts +2 -0
- package/dist/locales/hi.d.ts +2 -0
- package/dist/locales/it.d.ts +2 -0
- package/dist/locales/pt.d.ts +7 -0
- package/dist/util/constants.d.ts +1 -0
- package/dist/util/createFormexStub.d.ts +2 -0
- package/dist/util/entity_cache.d.ts +22 -0
- package/dist/util/enums.d.ts +5 -0
- package/dist/util/icon_list.d.ts +5 -0
- package/dist/util/icons.d.ts +20 -0
- package/dist/util/index.d.ts +8 -0
- package/dist/util/previews.d.ts +4 -0
- package/dist/util/useStorageUploadController.d.ts +44 -0
- package/dist/vitePlugin.d.ts +60 -0
- package/dist/vitePlugin.js +113 -0
- package/package.json +145 -0
- package/src/auth/api.ts +148 -0
- package/src/auth/index.ts +25 -0
- package/src/auth/types.ts +115 -0
- package/src/auth/useRebaseAuthController.ts +328 -0
- package/src/components/AIIcon.tsx +47 -0
- package/src/components/AuthSimulationMenu.tsx +0 -0
- package/src/components/ConfirmationDialog.tsx +48 -0
- package/src/components/Debug/UIReferenceView.tsx +958 -0
- package/src/components/Debug/UIStyleGuide.tsx +156 -0
- package/src/components/Debug/collection-views/CardViewDemo.tsx +85 -0
- package/src/components/Debug/collection-views/CollectionTableDemo.tsx +107 -0
- package/src/components/Debug/collection-views/KanbanBoardDemo.tsx +90 -0
- package/src/components/Debug/collection-views/index.ts +3 -0
- package/src/components/Debug/collection-views/sample_data.ts +42 -0
- package/src/components/Debug/crm-dashboard/CalendarWidget.tsx +389 -0
- package/src/components/Debug/crm-dashboard/CrmDashboardDemo.tsx +1102 -0
- package/src/components/Debug/crm-dashboard/DashboardMetrics.tsx +133 -0
- package/src/components/Debug/crm-dashboard/PipelineOverview.tsx +290 -0
- package/src/components/Debug/crm-dashboard/RecentActivity.tsx +215 -0
- package/src/components/Debug/crm-dashboard/TaskFilters.tsx +184 -0
- package/src/components/Debug/crm-dashboard/TaskTable.tsx +427 -0
- package/src/components/Debug/crm-dashboard/TasksView.tsx +234 -0
- package/src/components/ErrorTooltip.tsx +12 -0
- package/src/components/ErrorView.tsx +94 -0
- package/src/components/LanguageToggle.tsx +59 -0
- package/src/components/LoginView/LoginView.tsx +932 -0
- package/src/components/LoginView/index.ts +2 -0
- package/src/components/NotFoundPage.tsx +27 -0
- package/src/components/RebaseAuth.tsx +27 -0
- package/src/components/RebaseLogo.tsx +29 -0
- package/src/components/SchemaDriftBanner.tsx +102 -0
- package/src/components/UnsavedChangesDialog.tsx +46 -0
- package/src/components/UserDisplay.tsx +54 -0
- package/src/components/UserSelectPopover.tsx +399 -0
- package/src/components/UserSettingsView.tsx +318 -0
- package/src/components/common/index.ts +6 -0
- package/src/components/common/table_height.tsx +21 -0
- package/src/components/common/types.tsx +66 -0
- package/src/components/common/useColumnsIds.tsx +222 -0
- package/src/components/common/useDataTableController.tsx +514 -0
- package/src/components/common/useDebouncedData.ts +49 -0
- package/src/components/common/useScrollRestoration.tsx +68 -0
- package/src/components/index.tsx +26 -0
- package/src/contexts/AdminModeController.tsx +11 -0
- package/src/contexts/AnalyticsContext.tsx +4 -0
- package/src/contexts/AuthControllerContext.tsx +4 -0
- package/src/contexts/CollectionScopeContext.tsx +67 -0
- package/src/contexts/ComponentOverrideContext.tsx +81 -0
- package/src/contexts/CustomizationControllerContext.tsx +4 -0
- package/src/contexts/DataDriverContext.tsx +4 -0
- package/src/contexts/DataSourcesContext.tsx +36 -0
- package/src/contexts/DatabaseAdminContext.tsx +4 -0
- package/src/contexts/DialogsProvider.tsx +56 -0
- package/src/contexts/EffectiveRoleController.tsx +12 -0
- package/src/contexts/ModeController.tsx +11 -0
- package/src/contexts/RebaseClientInstanceContext.tsx +7 -0
- package/src/contexts/RebaseDataContext.tsx +4 -0
- package/src/contexts/SnackbarProvider.tsx +15 -0
- package/src/contexts/StorageSourceContext.tsx +4 -0
- package/src/contexts/StorageSourcesContext.tsx +30 -0
- package/src/contexts/UserConfigurationPersistenceContext.tsx +4 -0
- package/src/contexts/index.ts +17 -0
- package/src/core/PluginLifecycleManager.tsx +95 -0
- package/src/core/PluginProviderStack.tsx +40 -0
- package/src/core/Rebase.tsx +439 -0
- package/src/core/RebaseProps.tsx +320 -0
- package/src/core/RebaseRouter.tsx +17 -0
- package/src/core/RebaseRoutes.tsx +24 -0
- package/src/core/index.tsx +5 -0
- package/src/hooks/ApiConfigContext.tsx +41 -0
- package/src/hooks/data/delete.ts +55 -0
- package/src/hooks/data/save.ts +77 -0
- package/src/hooks/data/useCollection.tsx +176 -0
- package/src/hooks/data/useData.tsx +18 -0
- package/src/hooks/data/useDataOrder.ts +26 -0
- package/src/hooks/data/useFetch.tsx +140 -0
- package/src/hooks/data/useRelationSelector.tsx +234 -0
- package/src/hooks/index.tsx +45 -0
- package/src/hooks/useAdminModeController.tsx +23 -0
- package/src/hooks/useAnalyticsController.tsx +8 -0
- package/src/hooks/useAuthController.tsx +14 -0
- package/src/hooks/useAuthSubscription.ts +87 -0
- package/src/hooks/useBackendStorageSource.ts +288 -0
- package/src/hooks/useBridgeRegistration.tsx +32 -0
- package/src/hooks/useBrowserTitleAndIcon.tsx +23 -0
- package/src/hooks/useBuildAdminModeController.tsx +24 -0
- package/src/hooks/useBuildEffectiveRoleController.tsx +31 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +75 -0
- package/src/hooks/useBuildModeController.tsx +71 -0
- package/src/hooks/useClipboard.tsx +158 -0
- package/src/hooks/useCollapsedGroups.ts +116 -0
- package/src/hooks/useComponentOverride.tsx +59 -0
- package/src/hooks/useCustomizationController.tsx +14 -0
- package/src/hooks/useDialogsController.tsx +15 -0
- package/src/hooks/useEffectiveRoleController.tsx +10 -0
- package/src/hooks/useLargeLayout.tsx +65 -0
- package/src/hooks/useModeController.tsx +23 -0
- package/src/hooks/usePermissions.ts +44 -0
- package/src/hooks/useRebaseClient.tsx +10 -0
- package/src/hooks/useRebaseContext.tsx +83 -0
- package/src/hooks/useRebaseRegistry.tsx +91 -0
- package/src/hooks/useResolvedComponent.tsx +159 -0
- package/src/hooks/useSlot.tsx +64 -0
- package/src/hooks/useSnackbarController.tsx +52 -0
- package/src/hooks/useStorageSource.tsx +11 -0
- package/src/hooks/useStudioBridge.tsx +209 -0
- package/src/hooks/useTranslation.ts +33 -0
- package/src/hooks/useUnsavedChangesDialog.tsx +64 -0
- package/src/hooks/useUserConfigurationPersistence.tsx +11 -0
- package/src/i18n/RebaseI18nProvider.tsx +160 -0
- package/src/index.ts +25 -0
- package/src/internal/common.tsx +16 -0
- package/src/internal/useRestoreScroll.tsx +69 -0
- package/src/locales/de.ts +902 -0
- package/src/locales/en.ts +980 -0
- package/src/locales/es.ts +922 -0
- package/src/locales/fr.ts +901 -0
- package/src/locales/hi.ts +901 -0
- package/src/locales/it.ts +901 -0
- package/src/locales/pt.ts +909 -0
- package/src/util/constants.ts +7 -0
- package/src/util/createFormexStub.tsx +66 -0
- package/src/util/entity_cache.ts +239 -0
- package/src/util/enums.ts +32 -0
- package/src/util/icon_list.ts +22 -0
- package/src/util/icons.tsx +149 -0
- package/src/util/index.ts +12 -0
- package/src/util/previews.ts +105 -0
- package/src/util/useStorageUploadController.tsx +350 -0
- package/src/vitePlugin.ts +196 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Link } from "react-router-dom";
|
|
3
|
+
import { Button, Typography } from "@rebasepro/ui";
|
|
4
|
+
import { useTranslation } from "../hooks";
|
|
5
|
+
|
|
6
|
+
export function NotFoundPage() {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex w-full h-full">
|
|
11
|
+
<div className="m-auto flex items-center flex-col"
|
|
12
|
+
>
|
|
13
|
+
<Typography variant={"h4"} align={"center"}
|
|
14
|
+
gutterBottom={true}>
|
|
15
|
+
{t("page_not_found")}
|
|
16
|
+
</Typography>
|
|
17
|
+
<Typography align={"center"} gutterBottom={true}>
|
|
18
|
+
{t("page_not_found_body")}
|
|
19
|
+
</Typography>
|
|
20
|
+
<Button
|
|
21
|
+
variant={"text"}
|
|
22
|
+
component={Link}
|
|
23
|
+
to={"/"}>{t("back_to_home")}</Button>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { useLayoutEffect, useRef } from "react";
|
|
2
|
+
import { useRebaseRegistryDispatch } from "../hooks";
|
|
3
|
+
import type { RebaseAuthConfig } from "@rebasepro/types";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Declarative component to configure authentication in Rebase.
|
|
7
|
+
* Renders nothing — purely registers config into the RebaseRegistry.
|
|
8
|
+
*
|
|
9
|
+
* This is a framework-level component that lives in core since
|
|
10
|
+
* authentication is cross-cutting (CMS, Studio, any app area).
|
|
11
|
+
* @group Core
|
|
12
|
+
*/
|
|
13
|
+
export function RebaseAuth({ loginView }: RebaseAuthConfig) {
|
|
14
|
+
const dispatch = useRebaseRegistryDispatch();
|
|
15
|
+
const registeredRef = useRef(false);
|
|
16
|
+
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
dispatch.registerAuth({ loginView });
|
|
19
|
+
registeredRef.current = true;
|
|
20
|
+
return () => {
|
|
21
|
+
registeredRef.current = false;
|
|
22
|
+
dispatch.unregisterAuth();
|
|
23
|
+
};
|
|
24
|
+
}, [dispatch, loginView]);
|
|
25
|
+
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export function RebaseLogo({
|
|
4
|
+
width,
|
|
5
|
+
height,
|
|
6
|
+
className,
|
|
7
|
+
style
|
|
8
|
+
}: {
|
|
9
|
+
width?: string,
|
|
10
|
+
height?: string,
|
|
11
|
+
className?: string,
|
|
12
|
+
style?: React.CSSProperties
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<svg
|
|
16
|
+
width={width ?? "100%"} height={height ?? "100%"}
|
|
17
|
+
version="1.1"
|
|
18
|
+
style={style}
|
|
19
|
+
className={className}
|
|
20
|
+
viewBox="0 0 583 583" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
21
|
+
<circle cx="291.5" cy="291.5" r="291.5" fill="#0070F4"/>
|
|
22
|
+
<ellipse cx="292" cy="291.5" rx="173" ry="173.5" fill="#FF3773"/>
|
|
23
|
+
<path
|
|
24
|
+
d="M465 291.5C465 268.847 460.525 246.416 451.831 225.487C443.137 204.558 430.394 185.542 414.329 169.524C398.265 153.506 379.194 140.8 358.204 132.131C337.215 123.462 314.719 119 292 119C269.281 119 246.785 123.462 225.796 132.131C204.806 140.8 185.735 153.506 169.671 169.524C153.606 185.542 140.863 204.558 132.169 225.487C123.475 246.416 119 268.847 119 291.5L292 291.5H465Z"
|
|
25
|
+
fill="#FFA400"/>
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
2
|
+
import { Alert, Typography } from "@rebasepro/ui";
|
|
3
|
+
|
|
4
|
+
// ── Schema Drift Context ────────────────────────────────────────────────
|
|
5
|
+
|
|
6
|
+
interface SchemaDriftContextValue {
|
|
7
|
+
/** Report a schema drift error (call from any data-loading hook). */
|
|
8
|
+
reportSchemaDrift: (message: string) => void;
|
|
9
|
+
/** The most recent schema drift message, or null. */
|
|
10
|
+
schemaDriftMessage: string | null;
|
|
11
|
+
/** Dismiss the banner for this session. */
|
|
12
|
+
dismiss: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const SchemaDriftContext = createContext<SchemaDriftContextValue>({
|
|
16
|
+
reportSchemaDrift: () => {},
|
|
17
|
+
schemaDriftMessage: null,
|
|
18
|
+
dismiss: () => {}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export function useSchemaDriftContext(): SchemaDriftContextValue {
|
|
22
|
+
return useContext(SchemaDriftContext);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Detects schema drift from an error object.
|
|
27
|
+
* Checks both the error code (from `RebaseApiError`) and the message
|
|
28
|
+
* for schema drift indicators.
|
|
29
|
+
*/
|
|
30
|
+
export function isSchemaDriftError(error: unknown): boolean {
|
|
31
|
+
if (!error || typeof error !== "object") return false;
|
|
32
|
+
// RebaseApiError from the SDK has a `code` property
|
|
33
|
+
if ("code" in error && (error as { code?: string }).code === "SCHEMA_DRIFT") {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
// Fallback: check the message for the telltale phrase
|
|
37
|
+
if (error instanceof Error && error.message.includes("Schema drift:")) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ── Provider ─────────────────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
export function SchemaDriftProvider({ children }: { children: React.ReactNode }) {
|
|
46
|
+
const [schemaDriftMessage, setSchemaDriftMessage] = useState<string | null>(null);
|
|
47
|
+
const [dismissed, setDismissed] = useState(false);
|
|
48
|
+
|
|
49
|
+
const reportSchemaDrift = useCallback((message: string) => {
|
|
50
|
+
setSchemaDriftMessage(prev => prev ?? message);
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
const dismiss = useCallback(() => {
|
|
54
|
+
setDismissed(true);
|
|
55
|
+
}, []);
|
|
56
|
+
|
|
57
|
+
const value = useMemo<SchemaDriftContextValue>(() => ({
|
|
58
|
+
reportSchemaDrift,
|
|
59
|
+
schemaDriftMessage: dismissed ? null : schemaDriftMessage,
|
|
60
|
+
dismiss
|
|
61
|
+
}), [reportSchemaDrift, schemaDriftMessage, dismissed, dismiss]);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<SchemaDriftContext.Provider value={value}>
|
|
65
|
+
{children}
|
|
66
|
+
</SchemaDriftContext.Provider>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ── Banner Component ─────────────────────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
export interface SchemaDriftBannerProps {
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Persistent banner shown when a schema drift error is detected.
|
|
78
|
+
*/
|
|
79
|
+
export function SchemaDriftBanner({ className }: SchemaDriftBannerProps) {
|
|
80
|
+
const { schemaDriftMessage, dismiss } = useSchemaDriftContext();
|
|
81
|
+
|
|
82
|
+
if (!schemaDriftMessage) return null;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Alert
|
|
86
|
+
color="warning"
|
|
87
|
+
size="small"
|
|
88
|
+
onDismiss={dismiss}
|
|
89
|
+
className={className}
|
|
90
|
+
>
|
|
91
|
+
<div className="flex flex-col gap-1">
|
|
92
|
+
<Typography variant="label" className="text-amber-800 dark:text-amber-200">
|
|
93
|
+
Schema drift detected
|
|
94
|
+
</Typography>
|
|
95
|
+
<Typography variant="body2" className="text-amber-700 dark:text-amber-300">
|
|
96
|
+
{schemaDriftMessage}{" "}
|
|
97
|
+
Run <code className="bg-amber-200 dark:bg-amber-800 px-1 rounded text-xs">pnpm db:push</code> in your backend terminal to sync.
|
|
98
|
+
</Typography>
|
|
99
|
+
</div>
|
|
100
|
+
</Alert>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography } from "@rebasepro/ui";
|
|
3
|
+
import { useTranslation } from "../hooks";
|
|
4
|
+
|
|
5
|
+
export interface UnsavedChangesDialogProps {
|
|
6
|
+
open: boolean;
|
|
7
|
+
body?: React.ReactNode;
|
|
8
|
+
title?: string;
|
|
9
|
+
handleOk: () => void;
|
|
10
|
+
handleCancel: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function UnsavedChangesDialog({
|
|
14
|
+
open,
|
|
15
|
+
handleOk,
|
|
16
|
+
handleCancel,
|
|
17
|
+
body,
|
|
18
|
+
title
|
|
19
|
+
}: UnsavedChangesDialogProps) {
|
|
20
|
+
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Dialog
|
|
25
|
+
onEscapeKeyDown={() => {
|
|
26
|
+
handleCancel();
|
|
27
|
+
}}
|
|
28
|
+
open={open}
|
|
29
|
+
>
|
|
30
|
+
<DialogTitle variant={"h6"}>{title}</DialogTitle>
|
|
31
|
+
<DialogContent>
|
|
32
|
+
|
|
33
|
+
<Typography>
|
|
34
|
+
{body ?? t("unsaved_changes")}
|
|
35
|
+
</Typography>
|
|
36
|
+
|
|
37
|
+
</DialogContent>
|
|
38
|
+
<DialogActions>
|
|
39
|
+
<Button variant="text"
|
|
40
|
+
onClick={handleCancel} autoFocus> {t("cancel")} </Button>
|
|
41
|
+
<Button
|
|
42
|
+
onClick={handleOk}> {t("ok")} </Button>
|
|
43
|
+
</DialogActions>
|
|
44
|
+
</Dialog>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CircleUserIcon, cls, defaultBorderMixin } from "@rebasepro/ui";
|
|
2
|
+
import { User } from "@rebasepro/types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component to render a single user with name and email
|
|
6
|
+
*/
|
|
7
|
+
export function UserDisplay({
|
|
8
|
+
user
|
|
9
|
+
}: { user: User | null }) {
|
|
10
|
+
if (!user) {
|
|
11
|
+
return <span className={cls("italic", "text-text-disabled dark:text-text-disabled-dark", "text-sm")}>Not set</span>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const avatarSizeClass = "w-6 h-6";
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className={cls(
|
|
18
|
+
"inline-flex items-center gap-4 px-2 py-1 rounded-xl text-left max-w-full overflow-hidden",
|
|
19
|
+
"bg-surface-accent-100 dark:bg-surface-accent-800",
|
|
20
|
+
"border",
|
|
21
|
+
defaultBorderMixin
|
|
22
|
+
)}>
|
|
23
|
+
{user.photoURL ? (
|
|
24
|
+
<img
|
|
25
|
+
src={user.photoURL}
|
|
26
|
+
alt={user.displayName || user.email || "User"}
|
|
27
|
+
className={cls(
|
|
28
|
+
"rounded-full object-cover",
|
|
29
|
+
avatarSizeClass
|
|
30
|
+
)}
|
|
31
|
+
/>
|
|
32
|
+
) : (
|
|
33
|
+
<CircleUserIcon
|
|
34
|
+
className={cls(
|
|
35
|
+
"text-text-secondary dark:text-text-secondary-dark",
|
|
36
|
+
avatarSizeClass
|
|
37
|
+
)}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
<div className="flex flex-col min-w-0">
|
|
41
|
+
<span className={cls("font-regular truncate", "text-sm")}>
|
|
42
|
+
{user.displayName || user.email || "-"}
|
|
43
|
+
</span>
|
|
44
|
+
{user.displayName && user.email && (
|
|
45
|
+
<span className={cls("text-text-secondary dark:text-text-secondary-dark truncate",
|
|
46
|
+
"text-xs"
|
|
47
|
+
)}>
|
|
48
|
+
{user.email}
|
|
49
|
+
</span>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|