From 0b0366a4ae27519e8b755aab4ba66816d3fa04dd Mon Sep 17 00:00:00 2001 From: francesco Date: Thu, 12 Sep 2024 12:51:50 +0200 Subject: [PATCH] Minor and cosmetic updates related to drawer --- .../collections/test_collection.tsx | 7 +- .../CollectionDetailsForm.tsx | 2 +- .../properties/DateTimePropertyField.tsx | 97 ++++++++++--------- .../templates/pages_template.ts | 5 - .../src/utils/collections_firestore.ts | 8 +- .../src/components/FireCMSCloudDrawer.tsx | 1 + .../src/components/PaywallDatabaseIdField.tsx | 28 +++--- .../subscriptions/TextSearchInfoDialog.tsx | 4 +- .../firecms_cloud/src/hooks/useSaasPlugin.tsx | 6 +- packages/firecms_core/src/app/Scaffold.tsx | 7 +- .../EntityCollectionView.tsx | 7 +- .../src/components/EntityPreview.tsx | 4 +- .../firecms_core/src/core/DefaultDrawer.tsx | 4 +- .../src/core/DrawerNavigationItem.tsx | 2 +- packages/ui/.gitignore | 2 +- packages/ui/src/components/Sheet.tsx | 2 +- packages/ui/src/components/Tooltip.tsx | 4 +- packages/ui/src/dist/index.css | 1 + 18 files changed, 104 insertions(+), 87 deletions(-) create mode 120000 packages/ui/src/dist/index.css diff --git a/examples/example_pro/src/FirestoreApp/collections/test_collection.tsx b/examples/example_pro/src/FirestoreApp/collections/test_collection.tsx index d7c87b74f..1a72d5355 100644 --- a/examples/example_pro/src/FirestoreApp/collections/test_collection.tsx +++ b/examples/example_pro/src/FirestoreApp/collections/test_collection.tsx @@ -3,7 +3,6 @@ import { buildProperty, EntityCallbacks, EntityOnFetchProps, - MapProperty, resolveNavigationFrom } from "@firecms/core"; import { SecondaryForm } from "../custom_entity_view/SecondaryForm"; @@ -48,7 +47,6 @@ export const testCallbacks: EntityCallbacks = { } }; - export const testCollection = buildCollection({ callbacks: testCallbacks, id: "test_entity", @@ -69,6 +67,11 @@ export const testCollection = buildCollection({ // } // }], properties: { + date: { + name: "on create", + dataType: "date", + // autoValue: "on_create" + }, locale: { name: "Locales", dataType: "string", diff --git a/packages/collection_editor/src/ui/collection_editor/CollectionDetailsForm.tsx b/packages/collection_editor/src/ui/collection_editor/CollectionDetailsForm.tsx index 1d6b3b92a..29eefef19 100644 --- a/packages/collection_editor/src/ui/collection_editor/CollectionDetailsForm.tsx +++ b/packages/collection_editor/src/ui/collection_editor/CollectionDetailsForm.tsx @@ -156,7 +156,7 @@ export function CollectionDetailsForm({ required error={showErrors && Boolean(errors.name)}/> - {touched.name && Boolean(errors.name) ? errors.name : "Name of in this collection, usually a plural name (e.g. Products)"} + {touched.name && Boolean(errors.name) ? errors.name : "Name of this collection, usually a plural name (e.g. Products)"} diff --git a/packages/collection_editor/src/ui/collection_editor/properties/DateTimePropertyField.tsx b/packages/collection_editor/src/ui/collection_editor/properties/DateTimePropertyField.tsx index fe7587019..07538dcdb 100644 --- a/packages/collection_editor/src/ui/collection_editor/properties/DateTimePropertyField.tsx +++ b/packages/collection_editor/src/ui/collection_editor/properties/DateTimePropertyField.tsx @@ -26,53 +26,56 @@ export function DateTimePropertyField({ disabled }: { return ( <> -
- - - {modeError} - - - - - {autoValueError ?? "Update this field automatically when creating or updating the entity"} - +
+
+ + + {modeError} + +
+
+ + + {autoValueError ?? "Update this field automatically when creating or updating the entity"} + +
diff --git a/packages/collection_editor/src/ui/collection_editor/templates/pages_template.ts b/packages/collection_editor/src/ui/collection_editor/templates/pages_template.ts index f54300d02..28cd24979 100644 --- a/packages/collection_editor/src/ui/collection_editor/templates/pages_template.ts +++ b/packages/collection_editor/src/ui/collection_editor/templates/pages_template.ts @@ -178,11 +178,6 @@ export const pagesCollectionTemplate: EntityCollection = { name: "Is Published", columnWidth: 100, description: "Should this page be live on the site?" - }, - author_uid: { - dataType: "reference", - name: "Author", - path: "users" } } }; diff --git a/packages/firebase_firecms/src/utils/collections_firestore.ts b/packages/firebase_firecms/src/utils/collections_firestore.ts index e4d2a3606..87325e1a2 100644 --- a/packages/firebase_firecms/src/utils/collections_firestore.ts +++ b/packages/firebase_firecms/src/utils/collections_firestore.ts @@ -3,7 +3,6 @@ import { CMSType, COLLECTION_PATH_SEPARATOR, makePropertiesEditable, - PermissionsBuilder, Properties, PropertiesOrBuilders, Property, @@ -24,6 +23,8 @@ export function buildCollectionId(idOrPath: string, parentCollectionIds?: string export function setUndefinedToDelete(data: any): any { if (Array.isArray(data)) { return data.map(v => setUndefinedToDelete(v)); + } else if (data == null) { + return null; } else if (typeof data === "object") { return Object.entries(data) .map(([key, value]) => ({ [key]: setUndefinedToDelete(value) })) @@ -77,7 +78,10 @@ export function prepareCollectionForPersistence(collection: Partial>, propertyConfigs: Record) { - const { properties: inputProperties, ...rest } = collection; + const { + properties: inputProperties, + ...rest + } = collection; const cleanedProperties = inputProperties ? cleanPropertyConfigs(inputProperties, propertyConfigs) : undefined; const properties = cleanedProperties ? setUndefinedToDelete(removeFunctions(cleanedProperties)) : undefined; let newCollection: Partial = {}; diff --git a/packages/firecms_cloud/src/components/FireCMSCloudDrawer.tsx b/packages/firecms_cloud/src/components/FireCMSCloudDrawer.tsx index 9ebb11d64..ee8980917 100644 --- a/packages/firecms_cloud/src/components/FireCMSCloudDrawer.tsx +++ b/packages/firecms_cloud/src/components/FireCMSCloudDrawer.tsx @@ -87,6 +87,7 @@ export function FireCMSCloudDrawer() { {groups.map((group) => (
{buildGroupHeader(group)} {Object.values(navigationEntries) diff --git a/packages/firecms_cloud/src/components/PaywallDatabaseIdField.tsx b/packages/firecms_cloud/src/components/PaywallDatabaseIdField.tsx index 65a0943c1..10dfcbe5b 100644 --- a/packages/firecms_cloud/src/components/PaywallDatabaseIdField.tsx +++ b/packages/firecms_cloud/src/components/PaywallDatabaseIdField.tsx @@ -2,20 +2,20 @@ import React from "react"; import { Button, TextField, Tooltip, Typography } from "@firecms/ui"; import { useProjectConfig } from "../hooks"; -export function PaywallDatabaseIdField({ - databaseId, - onDatabaseIdUpdate - }: - { databaseId?: string, onDatabaseIdUpdate: (databaseId: string) => void }) { +export function PaywallDatabaseIdField() { + + const ref = React.useRef(null); const projectConfig = useProjectConfig(); return <> - Subscription required - Please upgrade plans to use alternate databases + title={
+ Subscription required + Please upgrade plans to use alternate databases
}> - +
; } diff --git a/packages/firecms_cloud/src/components/subscriptions/TextSearchInfoDialog.tsx b/packages/firecms_cloud/src/components/subscriptions/TextSearchInfoDialog.tsx index f4d465104..4a544c46a 100644 --- a/packages/firecms_cloud/src/components/subscriptions/TextSearchInfoDialog.tsx +++ b/packages/firecms_cloud/src/components/subscriptions/TextSearchInfoDialog.tsx @@ -66,12 +66,12 @@ export function TextSearchInfoDialog({ {!hasOwnTextSearchImplementation && <> -
+
Local text search is not recommended for large collections. - + Note that enabling local text search will need to fetch all documents from your collection and store them in the browser. This can be inefficient for large collections. It can also incur in additional costs. diff --git a/packages/firecms_cloud/src/hooks/useSaasPlugin.tsx b/packages/firecms_cloud/src/hooks/useSaasPlugin.tsx index d8812efc3..63d45d2d7 100644 --- a/packages/firecms_cloud/src/hooks/useSaasPlugin.tsx +++ b/packages/firecms_cloud/src/hooks/useSaasPlugin.tsx @@ -28,14 +28,18 @@ export function useSaasPlugin({ const additionalChildrenStart = <> {introMode ? : undefined} + ; + + const additionalChildrenEnd = <> {!introMode && } + ; return { key: "saas", homePage: { additionalChildrenStart, - additionalChildrenEnd: , + additionalChildrenEnd, }, collectionView: { diff --git a/packages/firecms_core/src/app/Scaffold.tsx b/packages/firecms_core/src/app/Scaffold.tsx index 483fd8c5c..072452896 100644 --- a/packages/firecms_core/src/app/Scaffold.tsx +++ b/packages/firecms_core/src/app/Scaffold.tsx @@ -166,10 +166,9 @@ function DrawerWrapper(props: { + asChild={true}>
+ className="ml-2 fixed top-2 left-3 !bg-gray-50 dark:!bg-gray-900 rounded-full w-fit z-20"> props.setDrawerOpen(true)} size="large" - className="absolute top-2 left-6" + className="absolute top-2 left-5" > diff --git a/packages/firecms_core/src/components/EntityCollectionView/EntityCollectionView.tsx b/packages/firecms_core/src/components/EntityCollectionView/EntityCollectionView.tsx index e6e927fd9..81b566960 100644 --- a/packages/firecms_core/src/components/EntityCollectionView/EntityCollectionView.tsx +++ b/packages/firecms_core/src/components/EntityCollectionView/EntityCollectionView.tsx @@ -45,7 +45,7 @@ import { EntityCollectionViewActions } from "./EntityCollectionViewActions"; import { AddIcon, Button, - cls, + cls, focusedDisabled, IconButton, KeyboardTabIcon, Markdown, @@ -785,6 +785,9 @@ function EntityIdHeaderWidget({ @@ -814,7 +817,7 @@ function EntityIdHeaderWidget({ setSearchString(e.target.value); }} value={searchString} - className={"flex-grow bg-transparent outline-none p-1"}/> + className={"flex-grow bg-transparent outline-none p-1 " + focusedDisabled}/>