@firecms/collection_editor 3.1.0-canary.1df3b2c → 3.1.0-canary.501d471

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.
Files changed (67) hide show
  1. package/dist/index.es.js +7010 -3754
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.umd.js +7008 -3752
  4. package/dist/index.umd.js.map +1 -1
  5. package/dist/locales/de.d.ts +120 -0
  6. package/dist/locales/en.d.ts +120 -0
  7. package/dist/locales/es.d.ts +120 -0
  8. package/dist/locales/fr.d.ts +120 -0
  9. package/dist/locales/hi.d.ts +120 -0
  10. package/dist/locales/it.d.ts +120 -0
  11. package/dist/locales/pt.d.ts +120 -0
  12. package/dist/ui/collection_editor/AICollectionGeneratorPopover.d.ts +5 -1
  13. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +4 -0
  14. package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +2 -1
  15. package/package.json +12 -12
  16. package/src/ConfigControllerProvider.tsx +1 -0
  17. package/src/locales/de.ts +125 -0
  18. package/src/locales/en.ts +145 -0
  19. package/src/locales/es.ts +125 -0
  20. package/src/locales/fr.ts +125 -0
  21. package/src/locales/hi.ts +125 -0
  22. package/src/locales/it.ts +125 -0
  23. package/src/locales/pt.ts +125 -0
  24. package/src/ui/EditorCollectionAction.tsx +3 -3
  25. package/src/ui/EditorEntityAction.tsx +3 -2
  26. package/src/ui/NewCollectionButton.tsx +3 -1
  27. package/src/ui/NewCollectionCard.tsx +7 -4
  28. package/src/ui/PropertyAddColumnComponent.tsx +3 -2
  29. package/src/ui/collection_editor/AICollectionGeneratorPopover.tsx +29 -11
  30. package/src/ui/collection_editor/CollectionDetailsForm.tsx +28 -25
  31. package/src/ui/collection_editor/CollectionEditorDialog.tsx +55 -42
  32. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +23 -19
  33. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +12 -10
  34. package/src/ui/collection_editor/DisplaySettingsForm.tsx +19 -17
  35. package/src/ui/collection_editor/EntityActionsEditTab.tsx +11 -12
  36. package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +5 -6
  37. package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +5 -5
  38. package/src/ui/collection_editor/EnumForm.tsx +6 -2
  39. package/src/ui/collection_editor/ExtendSettingsForm.tsx +8 -7
  40. package/src/ui/collection_editor/GeneralSettingsForm.tsx +42 -42
  41. package/src/ui/collection_editor/GetCodeDialog.tsx +13 -12
  42. package/src/ui/collection_editor/KanbanConfigSection.tsx +11 -9
  43. package/src/ui/collection_editor/LayoutModeSwitch.tsx +7 -4
  44. package/src/ui/collection_editor/PropertyEditView.tsx +75 -66
  45. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +16 -19
  46. package/src/ui/collection_editor/ViewModeSwitch.tsx +8 -6
  47. package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +6 -3
  48. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +5 -2
  49. package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +3 -1
  50. package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +6 -4
  51. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +20 -18
  52. package/src/ui/collection_editor/properties/EnumPropertyField.tsx +5 -4
  53. package/src/ui/collection_editor/properties/MapPropertyField.tsx +8 -7
  54. package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +22 -23
  55. package/src/ui/collection_editor/properties/NumberPropertyField.tsx +3 -1
  56. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +5 -4
  57. package/src/ui/collection_editor/properties/StoragePropertyField.tsx +46 -51
  58. package/src/ui/collection_editor/properties/StringPropertyField.tsx +3 -1
  59. package/src/ui/collection_editor/properties/UrlPropertyField.tsx +12 -10
  60. package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +23 -4
  61. package/src/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +8 -3
  62. package/src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +5 -2
  63. package/src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +7 -5
  64. package/src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +10 -7
  65. package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +11 -9
  66. package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +4 -1
  67. package/src/useCollectionEditorPlugin.tsx +22 -6
@@ -22,7 +22,8 @@ import {
22
22
  useCustomizationController,
23
23
  useNavigationController,
24
24
  User,
25
- useSnackbarController
25
+ useSnackbarController,
26
+ useTranslation,
26
27
  } from "@firecms/core";
27
28
  import {
28
29
  ArrowBackIcon,
@@ -106,9 +107,15 @@ export interface CollectionEditorDialogProps {
106
107
  * The plugin is API-agnostic - the consumer provides the implementation.
107
108
  */
108
109
  generateCollection?: CollectionGenerationCallback;
110
+ /**
111
+ * Optional analytics callback
112
+ */
113
+ onAnalyticsEvent?: (event: string, params?: object) => void;
109
114
  }
110
115
 
111
116
  export function CollectionEditorDialog(props: CollectionEditorDialogProps) {
117
+ const { t } = useTranslation();
118
+
112
119
 
113
120
  const open = props.open;
114
121
 
@@ -139,7 +146,7 @@ export function CollectionEditorDialog(props: CollectionEditorDialogProps) {
139
146
  maxWidth={"7xl"}
140
147
  onOpenChange={(open) => !open ? handleCancel() : undefined}
141
148
  >
142
- <DialogTitle hidden>Collection editor</DialogTitle>
149
+ <DialogTitle hidden>{t("collection_editor")}</DialogTitle>
143
150
  <AIModifiedPathsProvider>
144
151
  {open && <CollectionEditor {...props}
145
152
  handleCancel={handleCancel}
@@ -149,7 +156,7 @@ export function CollectionEditorDialog(props: CollectionEditorDialogProps) {
149
156
  open={unsavedChangesDialogOpen}
150
157
  handleOk={() => props.handleClose(undefined)}
151
158
  handleCancel={() => setUnsavedChangesDialogOpen(false)}
152
- body={"There are unsaved changes in this collection"} />
159
+ body={t("unsaved_changes_in_collection")} />
153
160
  </AIModifiedPathsProvider>
154
161
  </Dialog>
155
162
  );
@@ -290,7 +297,8 @@ function CollectionEditorInternal<M extends Record<string, any>>({
290
297
  existingEntities,
291
298
  initialView: initialViewProp,
292
299
  expandKanban,
293
- generateCollection
300
+ generateCollection,
301
+ onAnalyticsEvent
294
302
  }: CollectionEditorDialogProps & {
295
303
  handleCancel: () => void,
296
304
  setFormDirty: (dirty: boolean) => void,
@@ -301,10 +309,11 @@ function CollectionEditorInternal<M extends Record<string, any>>({
301
309
  collection: PersistedCollection<M> | undefined,
302
310
  setCollection: (collection: PersistedCollection<M>) => void,
303
311
  propertyConfigs: Record<string, PropertyConfig<any>>,
304
- groups: string[],
312
+ groups: (string | null)[],
305
313
  }
306
314
  ) {
307
315
 
316
+ const { t } = useTranslation();
308
317
  const importConfig = useImportConfig();
309
318
  const navigation = useNavigationController();
310
319
  const snackbarController = useSnackbarController();
@@ -337,7 +346,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
337
346
  console.error(e);
338
347
  snackbarController.open({
339
348
  type: "error",
340
- message: "Error persisting collection: " + (e.message ?? "Details in the console")
349
+ message: t("error_persisting_collection", { error: e.message ?? t("details_in_console") })
341
350
  });
342
351
  return false;
343
352
  });
@@ -418,7 +427,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
418
427
  console.error(e);
419
428
  snackbarController.open({
420
429
  type: "error",
421
- message: "Error inferring collection: " + (e.message ?? "Details in the console")
430
+ message: t("error_inferring_collection", { error: e.message ?? t("details_in_console") })
422
431
  });
423
432
  return newCollection;
424
433
  }
@@ -481,7 +490,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
481
490
  } catch (e: any) {
482
491
  snackbarController.open({
483
492
  type: "error",
484
- message: "Error persisting collection: " + (e.message ?? "Details in the console")
493
+ message: t("error_persisting_collection", { error: e.message ?? t("details_in_console") })
485
494
  });
486
495
  console.error(e);
487
496
  formexController.resetForm({ values: newCollectionState });
@@ -505,11 +514,11 @@ function CollectionEditorInternal<M extends Record<string, any>>({
505
514
  errors = { ...errors, ...propertyErrorsRef.current };
506
515
  }
507
516
  if (currentView === "general") {
508
- const pathError = validatePath(col.path, isNewCollection, existingPaths, col.id);
517
+ const pathError = validatePath(t, col.path, isNewCollection, existingPaths, col.id);
509
518
  if (pathError) {
510
519
  errors.path = pathError;
511
520
  }
512
- const idError = validateId(col.id, isNewCollection, existingPaths, existingIds);
521
+ const idError = validateId(t, col.id, isNewCollection, existingPaths, existingIds);
513
522
  if (idError) {
514
523
  errors.id = idError;
515
524
  }
@@ -534,7 +543,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
534
543
 
535
544
  const path = values.path;
536
545
  const updatedFullPath = fullPath?.includes("/") ? fullPath?.split("/").slice(0, -1).join("/") + "/" + path : path; // TODO: this path is wrong
537
- const pathError = validatePath(path, isNewCollection, existingPaths, values.id);
546
+ const pathError = validatePath(t, path, isNewCollection, existingPaths, values.id);
538
547
 
539
548
  const parentPaths = !pathError && parentCollectionIds ? navigation.convertIdsToPaths(parentCollectionIds) : undefined;
540
549
  const resolvedPath = !pathError ? navigation.resolveIdsFrom(updatedFullPath) : undefined;
@@ -596,7 +605,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
596
605
  setDeleteRequested(false);
597
606
  handleCancel();
598
607
  snackbarController.open({
599
- message: "Collection deleted",
608
+ message: t("collection_deleted"),
600
609
  type: "success"
601
610
  });
602
611
  });
@@ -630,21 +639,22 @@ function CollectionEditorInternal<M extends Record<string, any>>({
630
639
  existingCollection={values}
631
640
  onGenerated={handleAIGenerated}
632
641
  generateCollection={generateCollection}
642
+ onAnalyticsEvent={onAnalyticsEvent}
633
643
  />
634
644
  )}
635
645
  <Tabs value={currentView}
636
646
  onValueChange={(v) => setCurrentView(v as EditorView)}>
637
647
  <Tab value={"general"}>
638
- General
648
+ {t("tab_general")}
639
649
  </Tab>
640
650
  <Tab value={"display"}>
641
- Display
651
+ {t("tab_display")}
642
652
  </Tab>
643
653
  <Tab value={"properties"}>
644
- Properties
654
+ {t("tab_properties")}
645
655
  </Tab>
646
656
  <Tab value={"extend"}>
647
- Extend
657
+ {t("tab_extend")}
648
658
  </Tab>
649
659
  </Tabs>
650
660
  </div>}
@@ -669,7 +679,8 @@ function CollectionEditorInternal<M extends Record<string, any>>({
669
679
  onContinue={onWelcomeScreenContinue}
670
680
  existingCollectionPaths={existingPaths}
671
681
  parentCollection={parentCollection}
672
- generateCollection={generateCollection} />}
682
+ generateCollection={generateCollection}
683
+ onAnalyticsEvent={onAnalyticsEvent} />}
673
684
 
674
685
  {currentView === "import_data_mapping" && importConfig &&
675
686
  <CollectionEditorImportMapping importConfig={importConfig}
@@ -688,7 +699,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
688
699
  onImportSuccess={async (importedCollection) => {
689
700
  snackbarController.open({
690
701
  type: "info",
691
- message: "Data imported successfully"
702
+ message: t("data_imported_successfully_msg")
692
703
  });
693
704
  await saveCollection(values);
694
705
  handleClose(importedCollection);
@@ -756,7 +767,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
756
767
  importConfig.setInUse(false);
757
768
  return setCurrentView("welcome");
758
769
  }}>
759
- Back
770
+ {t("back")}
760
771
  </Button>}
761
772
 
762
773
  {isNewCollection && includeTemplates && currentView === "import_data_preview" &&
@@ -765,14 +776,14 @@ function CollectionEditorInternal<M extends Record<string, any>>({
765
776
  onClick={() => {
766
777
  setCurrentView("import_data_mapping");
767
778
  }}>
768
- Back
779
+ {t("back")}
769
780
  </Button>}
770
781
 
771
782
  {isNewCollection && includeTemplates && currentView === "general" &&
772
783
  <Button variant={"text"}
773
784
  type="button"
774
785
  onClick={() => setCurrentView("welcome")}>
775
- Back
786
+ {t("back")}
776
787
  </Button>}
777
788
 
778
789
  {isNewCollection && currentView === "properties" && <Button variant={"text"}
@@ -780,7 +791,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
780
791
  color={"neutral"}
781
792
  onClick={() => setCurrentView("general")}>
782
793
  <ArrowBackIcon />
783
- Back
794
+ {t("back")}
784
795
  </Button>}
785
796
 
786
797
  <Button variant={"text"}
@@ -788,12 +799,12 @@ function CollectionEditorInternal<M extends Record<string, any>>({
788
799
  onClick={() => {
789
800
  handleCancel();
790
801
  }}>
791
- Cancel
802
+ {t("cancel")}
792
803
  </Button>
793
804
 
794
805
  {currentView === "welcome" &&
795
806
  <Button variant={"text"} onClick={() => onWelcomeScreenContinue()}>
796
- Continue from scratch
807
+ {t("continue_from_scratch")}
797
808
  </Button>}
798
809
 
799
810
  {isNewCollection && currentView === "import_data_mapping" &&
@@ -802,7 +813,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
802
813
  color="primary"
803
814
  onClick={onImportMappingComplete}
804
815
  >
805
- Next
816
+ {t("next")}
806
817
  </Button>}
807
818
 
808
819
  {isNewCollection && currentView === "import_data_preview" &&
@@ -813,7 +824,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
813
824
  setNextMode();
814
825
  }}
815
826
  >
816
- Next
827
+ {t("next")}
817
828
  </Button>}
818
829
 
819
830
  {isNewCollection && (currentView === "general" || currentView === "properties") &&
@@ -827,8 +838,8 @@ function CollectionEditorInternal<M extends Record<string, any>>({
827
838
  ? <CheckIcon />
828
839
  : undefined}
829
840
  >
830
- {currentView === "general" && "Next"}
831
- {currentView === "properties" && "Create collection"}
841
+ {currentView === "general" && t("next")}
842
+ {currentView === "properties" && t("create_collection")}
832
843
  </LoadingButton>}
833
844
 
834
845
  {!isNewCollection && <LoadingButton
@@ -837,7 +848,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
837
848
  type="submit"
838
849
  loading={isSubmitting}
839
850
  >
840
- Update collection
851
+ {t("update_collection")}
841
852
  </LoadingButton>}
842
853
 
843
854
  </DialogActions>
@@ -850,10 +861,8 @@ function CollectionEditorInternal<M extends Record<string, any>>({
850
861
  open={deleteRequested}
851
862
  onAccept={deleteCollection}
852
863
  onCancel={() => setDeleteRequested(false)}
853
- title={<>Delete the stored config?</>}
854
- body={<> This will <b>not
855
- delete any data</b>, only
856
- the stored config, and reset to the code state.</>} />
864
+ title={<>{t("delete_stored_config")}</>}
865
+ body={<>{t("delete_stored_config_body")}</>} />
857
866
 
858
867
  </DialogContent>
859
868
 
@@ -867,7 +876,9 @@ function applyPropertyConfigs<M extends Record<string, any> = any>(collection: P
867
876
  const propertiesResult: PropertiesOrBuilders<any> = {};
868
877
  if (properties) {
869
878
  Object.keys(properties).forEach((key) => {
870
- propertiesResult[key] = applyPropertiesConfig(properties[key] as PropertyOrBuilder, propertyConfigs);
879
+ const prop = properties[key];
880
+ if (prop == null) return;
881
+ propertiesResult[key] = applyPropertiesConfig(prop as PropertyOrBuilder, propertyConfigs);
871
882
  });
872
883
  }
873
884
 
@@ -879,7 +890,7 @@ function applyPropertyConfigs<M extends Record<string, any> = any>(collection: P
879
890
 
880
891
  function applyPropertiesConfig(property: PropertyOrBuilder, propertyConfigs: Record<string, PropertyConfig<any>>) {
881
892
  let internalProperty = property;
882
- if (propertyConfigs && typeof internalProperty === "object" && internalProperty.propertyConfig) {
893
+ if (propertyConfigs && internalProperty && typeof internalProperty === "object" && internalProperty.propertyConfig) {
883
894
  const propertyConfig = propertyConfigs[internalProperty.propertyConfig];
884
895
  if (propertyConfig && isPropertyBuilder(propertyConfig.property)) {
885
896
  internalProperty = propertyConfig.property;
@@ -906,30 +917,32 @@ function applyPropertiesConfig(property: PropertyOrBuilder, propertyConfigs: Rec
906
917
 
907
918
  }
908
919
 
909
- const validatePath = (value: string, isNewCollection: boolean, existingPaths: string[], idValue?: string) => {
920
+ type TranslateFn = (key: string, params?: Record<string, string>) => string;
921
+
922
+ const validatePath = (t: TranslateFn, value: string, isNewCollection: boolean, existingPaths: string[], idValue?: string) => {
910
923
  let error;
911
924
  if (!value) {
912
- error = "You must specify a path in the database for this collection";
925
+ error = t("must_specify_path");
913
926
  }
914
927
  // if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))
915
928
  // error = "There is already a collection which uses this path as an id";
916
929
  if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()) && !idValue)
917
- error = "There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids";
930
+ error = t("collection_path_already_exists");
918
931
 
919
932
  const subpaths = removeInitialAndTrailingSlashes(value).split("/");
920
933
  if (subpaths.length % 2 === 0) {
921
- error = `Collection paths must have an odd number of segments: ${value}`;
934
+ error = t("collection_path_odd_segments", { path: value });
922
935
  }
923
936
  return error;
924
937
  };
925
938
 
926
- const validateId = (value: string, isNewCollection: boolean, existingPaths: string[], existingIds: string[]) => {
939
+ const validateId = (t: TranslateFn, value: string, isNewCollection: boolean, existingPaths: string[], existingIds: string[]) => {
927
940
  if (!value) return undefined;
928
941
  let error;
929
942
  if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()))
930
- error = "There is already a collection that uses this value as a path";
943
+ error = t("collection_uses_path_as_id");
931
944
  if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))
932
- error = "There is already a collection which uses this id";
945
+ error = t("collection_uses_this_id");
933
946
  // if (error) {
934
947
  // setAdvancedPanelExpanded(true);
935
948
  // }
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from "react";
2
- import { AIIcon, EntityCollection, prettifyIdentifier, } from "@firecms/core";
2
+ import { AIIcon, EntityCollection, prettifyIdentifier, useTranslation } from "@firecms/core";
3
3
  import { Button, Card, Chip, cls, CodeIcon, Container, Icon, Tooltip, Typography, } from "@firecms/ui";
4
4
  import { CollectionJsonImportDialog } from "./CollectionJsonImportDialog";
5
5
 
@@ -18,16 +18,19 @@ export function CollectionEditorWelcomeView({
18
18
  parentCollection,
19
19
  onContinue,
20
20
  existingCollectionPaths,
21
- generateCollection
21
+ generateCollection,
22
+ onAnalyticsEvent
22
23
  }: {
23
24
  path: string;
24
25
  parentCollection?: EntityCollection;
25
26
  onContinue: (importData?: object[], propertiesOrder?: string[]) => void;
26
27
  existingCollectionPaths?: string[];
27
28
  generateCollection?: CollectionGenerationCallback;
29
+ onAnalyticsEvent?: (event: string, params?: object) => void;
28
30
  }) {
29
31
 
30
32
  const { pathSuggestions } = useCollectionEditorController();
33
+ const { t } = useTranslation();
31
34
 
32
35
  const filteredSuggestions = (pathSuggestions ?? []).filter(s => !(existingCollectionPaths ?? []).find(c => c.trim().toLowerCase() === s.trim().toLowerCase()));
33
36
 
@@ -47,13 +50,13 @@ export function CollectionEditorWelcomeView({
47
50
  <div
48
51
  className="flex flex-row py-2 pt-3 items-center">
49
52
  <Typography variant={"h4"} className={"flex-grow"}>
50
- New collection
53
+ {t("new_collection")}
51
54
  </Typography>
52
55
  </div>
53
56
 
54
57
  {parentCollection && <Chip colorScheme={"tealDarker"}>
55
58
  <Typography variant={"caption"}>
56
- This is a subcollection of <b>{parentCollection.name}</b>
59
+ {t("this_is_subcollection_of")} <b>{parentCollection.name}</b>
57
60
  </Typography>
58
61
  </Chip>}
59
62
 
@@ -61,7 +64,7 @@ export function CollectionEditorWelcomeView({
61
64
 
62
65
  <Typography variant={"caption"}
63
66
  color={"secondary"}>
64
- ● Use one of the existing paths in your database:
67
+ ● {t("use_existing_paths_database")}
65
68
  </Typography>
66
69
  <div className={"flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7"}>
67
70
 
@@ -90,7 +93,7 @@ export function CollectionEditorWelcomeView({
90
93
  <Typography variant={"caption"}
91
94
  color={"secondary"}
92
95
  className={"mb-2"}>
93
- ● Describe your collection to AI:
96
+ ● {t("describe_collection_ai")}
94
97
  </Typography>
95
98
 
96
99
  <AICollectionGeneratorPopover
@@ -99,12 +102,13 @@ export function CollectionEditorWelcomeView({
99
102
  onContinue();
100
103
  }}
101
104
  generateCollection={generateCollection}
105
+ onAnalyticsEvent={onAnalyticsEvent}
102
106
  trigger={
103
107
  <Button
104
108
  variant="outlined"
105
109
  startIcon={<AIIcon size="small" />}
106
110
  >
107
- Generate with AI
111
+ {t("generate_with_ai")}
108
112
  </Button>
109
113
  }
110
114
  />
@@ -115,7 +119,7 @@ export function CollectionEditorWelcomeView({
115
119
  <Typography variant={"caption"}
116
120
  color={"secondary"}
117
121
  className={"mb-2"}>
118
- ● Create from JSON configuration:
122
+ ● {t("create_from_json_config")}
119
123
  </Typography>
120
124
 
121
125
  <Button
@@ -123,7 +127,7 @@ export function CollectionEditorWelcomeView({
123
127
  onClick={() => setJsonImportOpen(true)}
124
128
  startIcon={<CodeIcon size="small" />}
125
129
  >
126
- Paste JSON Configuration
130
+ {t("paste_json_config")}
127
131
  </Button>
128
132
 
129
133
  <CollectionJsonImportDialog
@@ -146,7 +150,7 @@ export function CollectionEditorWelcomeView({
146
150
  <Typography variant={"caption"}
147
151
  color={"secondary"}
148
152
  className={"mb-2"}>
149
- ● Create a collection from a file (csv, json, xls, xslx...)
153
+ ● {t("create_collection_from_file_formats")}
150
154
  </Typography>
151
155
 
152
156
  <ImportFileUpload onDataAdded={(data, propertiesOrder) => onContinue(data, propertiesOrder)} />
@@ -156,34 +160,34 @@ export function CollectionEditorWelcomeView({
156
160
  <div className={"my-2"}>
157
161
  <Typography variant={"caption"}
158
162
  color={"secondary"}>
159
- ● Select a template:
163
+ ● {t("select_template")}
160
164
  </Typography>
161
165
 
162
166
  <div className={"flex gap-2"}>
163
- <TemplateButton title={"Products"}
164
- subtitle={"A collection of products with images, prices and stock"}
167
+ <TemplateButton title={t("products")}
168
+ subtitle={t("collection_products_subtitle")}
165
169
  icon={<Icon size={"small"}
166
170
  iconKey={productsCollectionTemplate.icon! as string} />}
167
171
  onClick={() => {
168
172
  setValues(productsCollectionTemplate);
169
173
  onContinue();
170
174
  }} />
171
- <TemplateButton title={"Users"}
172
- subtitle={"A collection of users with emails, names and roles"}
175
+ <TemplateButton title={t("users")}
176
+ subtitle={t("collection_users_subtitle")}
173
177
  icon={<Icon size={"small"} iconKey={usersCollectionTemplate.icon! as string} />}
174
178
  onClick={() => {
175
179
  setValues(usersCollectionTemplate);
176
180
  onContinue();
177
181
  }} />
178
- <TemplateButton title={"Blog posts"}
179
- subtitle={"A collection of blog posts with images, authors and complex content"}
182
+ <TemplateButton title={t("blog_posts")}
183
+ subtitle={t("collection_blog_posts_subtitle")}
180
184
  icon={<Icon size={"small"} iconKey={blogCollectionTemplate.icon! as string} />}
181
185
  onClick={() => {
182
186
  setValues(blogCollectionTemplate);
183
187
  onContinue();
184
188
  }} />
185
- <TemplateButton title={"Pages"}
186
- subtitle={"A collection of pages with images, authors and complex content"}
189
+ <TemplateButton title={t("pages")}
190
+ subtitle={t("collection_pages_subtitle")}
187
191
  icon={<Icon size={"small"} iconKey={pagesCollectionTemplate.icon! as string} />}
188
192
  onClick={() => {
189
193
  setValues(pagesCollectionTemplate);
@@ -13,7 +13,8 @@ import {
13
13
  PropertyOrBuilder,
14
14
  useLargeLayout,
15
15
  User,
16
- useSnackbarController
16
+ useSnackbarController,
17
+ useTranslation
17
18
  } from "@firecms/core";
18
19
  import {
19
20
  AddIcon,
@@ -79,6 +80,7 @@ export function CollectionPropertiesEditorForm({
79
80
 
80
81
  const largeLayout = useLargeLayout();
81
82
  const asDialog = !largeLayout
83
+ const { t } = useTranslation();
82
84
 
83
85
  // index of the selected property within the namespace
84
86
  const [selectedPropertyIndex, setSelectedPropertyIndex] = useState<number | undefined>();
@@ -431,7 +433,7 @@ export function CollectionPropertiesEditorForm({
431
433
  <Typography variant={"body2"}
432
434
  className={"ml-2"}
433
435
  color={"secondary"}>
434
- Created by {owner.displayName}
436
+ {t("created_by", { name: owner.displayName ?? "" })}
435
437
  </Typography>}
436
438
  </div>
437
439
 
@@ -440,7 +442,7 @@ export function CollectionPropertiesEditorForm({
440
442
  </div>}
441
443
 
442
444
  <div className="ml-1 mt-2 flex flex-row gap-2">
443
- <Tooltip title={"Get the code for this collection"}
445
+ <Tooltip title={t("get_code_for_collection")}
444
446
  asChild={true}>
445
447
  <IconButton
446
448
  variant={"filled"}
@@ -449,7 +451,7 @@ export function CollectionPropertiesEditorForm({
449
451
  <CodeIcon />
450
452
  </IconButton>
451
453
  </Tooltip>
452
- {inferPropertiesFromData && <Tooltip title={"Add new properties based on data"}
454
+ {inferPropertiesFromData && <Tooltip title={t("add_properties_from_data")}
453
455
  asChild={true}>
454
456
  <IconButton
455
457
  variant={"filled"}
@@ -458,7 +460,7 @@ export function CollectionPropertiesEditorForm({
458
460
  {inferringProperties ? <CircularProgress size={"small"} /> : <FindInPageIcon />}
459
461
  </IconButton>
460
462
  </Tooltip>}
461
- <Tooltip title={"Add new property"}
463
+ <Tooltip title={t("add_new_property")}
462
464
  asChild={true}>
463
465
  <Button
464
466
  onClick={() => setNewPropertyDialogOpen(true)}>
@@ -487,7 +489,7 @@ export function CollectionPropertiesEditorForm({
487
489
  size={"large"}
488
490
  onClick={() => setNewPropertyDialogOpen(true)}
489
491
  startIcon={<AddIcon />}>
490
- Add new property
492
+ {t("add_new_property")}
491
493
  </Button>
492
494
  </div>
493
495
 
@@ -524,20 +526,20 @@ export function CollectionPropertiesEditorForm({
524
526
  <div className={"w-full flex flex-col items-center justify-center h-full gap-4"}>
525
527
  <Typography variant={"label"} className="">
526
528
  {emptyCollection
527
- ? "Now you can add your first property"
528
- : "Select a property to edit it"}
529
+ ? t("add_first_property")
530
+ : t("select_property_to_edit")}
529
531
  </Typography>
530
532
  <Button
531
533
  onClick={() => setNewPropertyDialogOpen(true)}
532
534
  >
533
535
  <AddIcon />
534
- Add new property
536
+ {t("add_new_property")}
535
537
  </Button>
536
538
  </div>}
537
539
 
538
540
  {selectedProperty && isPropertyBuilder(selectedProperty) &&
539
541
  <Typography variant={"label"} className="flex items-center justify-center">
540
- {"This property is defined as a property builder in code"}
542
+ {t("property_defined_as_builder")}
541
543
  </Typography>}
542
544
  </div>
543
545
  </div>}