Skip to content

Commit 8f6af8f

Browse files
committed
References preview fixes
Some style updates.
1 parent dc54521 commit 8f6af8f

File tree

8 files changed

+42
-25
lines changed

8 files changed

+42
-25
lines changed

CONTRIBUTING.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,28 @@ If you would like to make changes to the source, feel free to submit a PR!
55

66
## Getting Started
77

8-
You can find the source code for the library under `lib`.
9-
The demo project used for development is under `example`.
8+
This project is a monorepo managed with [Yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/).
109

11-
After pulling the code you just need to run
10+
You can find all the FireCMS packages in the `packages` folder.
11+
The code that simulates a final project implemented by a user can be found in the `examples` folder.
12+
13+
All dependencies are linked automatically and just running the following commands should be enough to get you started.
14+
15+
After pulling the code you just need to run:
1216

1317
```bash
1418
yarn
1519
yarn dev
1620
```
17-
1821
to start the demo project.
1922

23+
You can also run:
24+
```bash
25+
yarn
26+
yarn pro
27+
```
28+
to use the example project with the Pro version of FireCMS.
29+
2030
## Support and discussion
2131

2232
Please join our [Discord channel](https://discord.gg/fxy7xsQm3m) to discuss any details regarding adaptations. We are

examples/example_pro/src/FirestoreApp/App.tsx

+12-8
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import CustomColorTextField from "./custom_field/CustomColorTextField";
5858
import { booksCollection } from "./collections/books_collection";
5959
import { FirebaseApp } from "@firebase/app";
6060
import { TestEditorView } from "./views/TestEditorView";
61-
import { useCollectionEditorPlugin } from "@firecms/collection_editor";
61+
import { mergeCollections, useCollectionEditorPlugin } from "@firecms/collection_editor";
6262
import { useFirestoreCollectionsConfigController } from "@firecms/collection_editor_firebase";
6363
import { ReCaptchaEnterpriseProvider } from "@firebase/app-check";
6464
import { useExportPlugin } from "@firecms/data_export";
@@ -231,11 +231,11 @@ export function App() {
231231
if (process.env.NODE_ENV !== "production") {
232232
sourceCollections.push(testCollection);
233233
}
234-
return sourceCollections;
235-
// return mergeCollections(
236-
// sourceCollections,
237-
// collectionConfigController.collections ?? []
238-
// )
234+
// return sourceCollections;
235+
return mergeCollections(
236+
sourceCollections,
237+
collectionConfigController.collections ?? []
238+
);
239239
}, [collectionConfigController.collections, secondaryFirestoreDelegate]);
240240

241241
const views: CMSView[] = useMemo(() => ([
@@ -348,8 +348,12 @@ export function App() {
348348
dataSourceDelegate={firestoreDelegate}
349349
storageSource={storageSource}
350350

351-
plugins={[userManagementPlugin, dataEnhancementPlugin, exportPlugin, demoPlugin
352-
// collectionEditorPlugin
351+
plugins={[
352+
userManagementPlugin,
353+
dataEnhancementPlugin,
354+
exportPlugin,
355+
demoPlugin,
356+
collectionEditorPlugin
353357
]}
354358
onAnalyticsEvent={onAnalyticsEvent}
355359
propertyConfigs={propertyConfigs}

examples/example_pro/src/FirestoreApp/collection_actions/SampleCollectionActions.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export function SampleCollectionActions({ selectionController }: CollectionActio
1717

1818
return (
1919
<Button onClick={onClick}
20-
color="primary"
20+
color="text"
2121
variant={"text"}>
22-
Extra action
22+
Demo action
2323
</Button>
2424
);
2525

examples/example_pro/src/FirestoreApp/collections/products_collection.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export const productsCollection = buildCollection<Product>({
114114
create: true,
115115
delete: true
116116
}),
117-
Actions: [SampleCollectionActions, CustomFiltersActions],
117+
Actions: [SampleCollectionActions],
118118
subcollections: [localeCollection],
119119
// defaultSelectedView: "sample_custom_view",
120120
entityViews: [

packages/firecms_core/src/components/EntityPreview.tsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ export function EntityPreview({
7171
const titleProperty = getEntityTitlePropertyKey(resolvedCollection, customizationController.propertyConfigs);
7272
const imagePropertyKey = getEntityImagePreviewPropertyKey(resolvedCollection);
7373
const imageProperty = imagePropertyKey ? resolvedCollection.properties[imagePropertyKey] : undefined;
74-
const usedImageProperty = "of" in imageProperty ? imageProperty.of : imageProperty;
74+
const usedImageProperty = imageProperty && "of" in imageProperty ? imageProperty.of : imageProperty;
7575
const restProperties = listProperties.filter(p => p !== titleProperty && p !== imagePropertyKey);
7676

77-
const imageValue = getValueInPath(entity.values, imagePropertyKey as string);
78-
const usedImageValue = "of" in imageProperty ? ((imageValue ?? []).length > 0 ? imageValue[0] : undefined) : imageValue;
77+
const imageValue = imagePropertyKey ? getValueInPath(entity.values, imagePropertyKey) : undefined;
78+
const usedImageValue = imageProperty !== undefined ? ("of" in imageProperty
79+
? ((imageValue ?? []).length > 0
80+
? imageValue[0] : undefined)
81+
: imageValue)
82+
: undefined;
7983

8084
return <EntityPreviewContainer onClick={disabled ? undefined : onClick}
8185
hover={disabled ? undefined : hover}
@@ -108,7 +112,7 @@ export function EntityPreview({
108112
: <Skeleton/>)}
109113

110114
{titleProperty && (
111-
<div className={"my-0.5 text-sm font-medium"}>
115+
<div className={"truncate my-0.5 text-sm font-medium"}>
112116
{
113117
entity
114118
? <PropertyPreview
@@ -129,7 +133,7 @@ export function EntityPreview({
129133

130134
return (
131135
<div key={"ref_prev_" + key}
132-
className={restProperties.length > 1 ? "my-0.5" : "my-0"}>
136+
className={cls("truncate", restProperties.length > 1 ? "my-0.5" : "my-0")}>
133137
{
134138
entity
135139
? <PropertyPreview

packages/firecms_core/src/core/EntityEditView.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
785785
})?.toString()}
786786
</>;
787787
return (
788-
<div>
788+
<div key={`additional_${key}`}>
789789
<LabelWithIconAndTooltip
790790
propertyKey={key}
791791
icon={<NotesIcon size={"small"}/>}
@@ -808,8 +808,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
808808
})
809809
.filter(Boolean)}
810810

811-
</>
812-
);
811+
</>);
813812

814813
const disabled = formex.isSubmitting || (!modified && status === "existing");
815814
const formRef = React.useRef<HTMLDivElement>(null);

packages/firecms_core/src/preview/property_previews/MapPropertyPreview.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export function KeyValuePreview({ value }: { value: any }) {
127127
</div>
128128
<div
129129
className="flex-grow max-w-[75%]">
130-
{childValue && ("toString" in childValue) && <Typography>
130+
{childValue && <Typography>
131131
<ErrorBoundary>
132132
{childValue.toString()}
133133
</ErrorBoundary>

website/src/neat_colors.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"enabled": true
2222
}
2323
],
24-
"speed": 3,
24+
"speed": 2,
2525
"horizontalPressure": 2,
2626
"verticalPressure": 2,
2727
"waveFrequencyX": 2,

0 commit comments

Comments
 (0)