Skip to content

Commit

Permalink
Web images optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
fgatti675 committed Dec 12, 2023
1 parent bfe341a commit 7c89278
Show file tree
Hide file tree
Showing 102 changed files with 1,963 additions and 170 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ data.

### ✨ Robust Forms

![fields](https://firecms.co/img/post_editing.png)
![fields](https://firecms.co/img/post_editing.webp)

When editing an entity, FireCMS offers a nested system of side dialogs for
navigating through **subcollections** and accessing custom views (such as custom
Expand Down
21 changes: 7 additions & 14 deletions examples/example_pro/src/SampleApp/SampleApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,8 @@ import "@fontsource/roboto"
import { getAnalytics, logEvent } from "firebase/analytics";
import { User as FirebaseUser } from "firebase/auth";

import {
CMSView,
GitHubIcon,
IconButton,
Tooltip
} from "@firecms/core";
import {
Authenticator,
FirebaseCMSApp,
FirestoreIndexesBuilder,
} from "@firecms/firebase_pro";
import { CMSView, GitHubIcon, IconButton, Tooltip } from "@firecms/core";
import { Authenticator, FireCMSProApp, FirestoreIndexesBuilder, } from "@firecms/firebase_pro";
import { useDataEnhancementPlugin } from "@firecms/data_enhancement";

import { firebaseConfig } from "../firebase_config";
Expand Down Expand Up @@ -149,7 +140,7 @@ function SampleApp() {
return undefined;
}

return <FirebaseCMSApp
return <FireCMSProApp
name={"My Online Shop"}
// appCheckOptions={appCheckOptions}
authentication={myAuthenticator}
Expand All @@ -174,14 +165,16 @@ function SampleApp() {
firebaseConfig={firebaseConfig}
onFirebaseInit={onFirebaseInit}
toolbarExtraWidget={githubLink}
LoginView={CustomLoginView}
components={{
LoginView: CustomLoginView
}}
onAnalyticsEvent={onAnalyticsEvent}
// autoOpenDrawer={true}
propertyConfigs={[
{
key: "test_custom_field",
name: "Test custom field",
property:{
property: {
dataType: "string",
Field: CustomColorTextField
}
Expand Down
11 changes: 8 additions & 3 deletions examples/example_pro/src/SampleApp/useCustomDatasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ import {
EntityCollection,
FetchCollectionProps,
FetchEntityProps,
SaveEntityProps
SaveEntityProps,
useBuildDataSource
} from "@firecms/core";

import { FirebaseApp } from "firebase/app";
import { useFirestoreDataSource } from "@firecms/firebase_pro";
import { useFirestoreDelegate } from "@firecms/firebase_pro";

type CustomDataSourceProps = { firebaseApp?: FirebaseApp };

export function useCustomDatasource({ firebaseApp }: CustomDataSourceProps): DataSource {
const firestoreDataSource = useFirestoreDataSource({
const firestoreDelegate = useFirestoreDelegate({
firebaseApp
})

const firestoreDataSource = useBuildDataSource({
delegate: firestoreDelegate
});

return {
Expand Down
4 changes: 2 additions & 2 deletions examples/example_pro/src/docs/SimpleApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback } from "react";

import { User as FirebaseUser } from "firebase/auth";
import { buildCollection, buildProperty, EntityReference, } from "@firecms/core";
import { Authenticator, FirebaseCMSApp } from "@firecms/firebase_pro";
import { Authenticator, FireCMSProApp } from "@firecms/firebase_pro";

import "typeface-rubik";
import "@fontsource/ibm-plex-mono";
Expand Down Expand Up @@ -197,7 +197,7 @@ export default function App() {
return true;
}, []);

return <FirebaseCMSApp
return <FireCMSProApp
name={"My Online Shop"}
authentication={myAuthenticator}
collections={[productsCollection]}
Expand Down
4 changes: 2 additions & 2 deletions examples/example_pro/src/docs/nextjs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, { useCallback } from "react";

import { User as FirebaseUser } from "firebase/auth";
import { buildCollection, buildProperty, EntityReference, } from "@firecms/core";
import { Authenticator, FirebaseCMSApp } from "@firecms/firebase_pro";
import { Authenticator, FireCMSProApp } from "@firecms/firebase_pro";

import "typeface-rubik";
import "@fontsource/ibm-plex-mono";
Expand Down Expand Up @@ -201,7 +201,7 @@ export default function CMS() {
return true;
}, []);

return <FirebaseCMSApp
return <FireCMSProApp
name={"My Online Shop"}
basePath={"/cms"}
authentication={myAuthenticator}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {
Entity,
FetchCollectionProps,
FetchEntityProps,
ResolvedProperty,
useBuildDataSource,
SaveEntityProps,
} from "@firecms/core";
import { FirebaseApp } from "firebase/app";
import { useFirestoreDataSource } from "@firecms/firebase_pro";
import { useFirestoreDelegate } from "@firecms/firebase_pro";

type CustomDataSourceProps = { firebaseApp?: FirebaseApp };

Expand All @@ -20,8 +20,12 @@ type CustomDataSourceProps = { firebaseApp?: FirebaseApp };
*/
export function useCustomDatasource({ firebaseApp }: CustomDataSourceProps): DataSource {

const firestoreDataSource = useFirestoreDataSource({
firebaseApp
const firestoreDelegate = useFirestoreDelegate({
firebaseApp,
})

const firestoreDataSource = useBuildDataSource({
delegate: firestoreDelegate
});

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {

import "typeface-rubik";
import "@fontsource/ibm-plex-mono";
import { FirebaseCMSApp } from "@firecms/firebase_pro";
import { FireCMSProApp } from "@firecms/firebase_pro";

// TODO: Replace with your config
const firebaseConfig = {
Expand Down Expand Up @@ -79,7 +79,7 @@ export default function App() {
]
};

return <FirebaseCMSApp
return <FireCMSProApp
name={"My learning app"}
collections={collectionBuilder}
firebaseConfig={firebaseConfig}
Expand Down
2 changes: 1 addition & 1 deletion packages/collection_editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "80d437634caccc4400fa111504186eb13197bac1"
"gitHead": "bfe341a3a8e3d2b33d4dc3f48fabc350eccace1b"
}
2 changes: 1 addition & 1 deletion packages/create_firecms_app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@
"node_modules",
"template/node_modules"
],
"gitHead": "80d437634caccc4400fa111504186eb13197bac1"
"gitHead": "bfe341a3a8e3d2b33d4dc3f48fabc350eccace1b"
}
2 changes: 1 addition & 1 deletion packages/data_import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "80d437634caccc4400fa111504186eb13197bac1"
"gitHead": "bfe341a3a8e3d2b33d4dc3f48fabc350eccace1b"
}
5 changes: 4 additions & 1 deletion packages/firebase_firecms/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# FireCMS
# FireCMS Firebase

This library provides a set of utilities to integrate [FireCMS](https://firecms.co) with
[Firebase](https://firebase.google.com/).
2 changes: 1 addition & 1 deletion packages/firebase_firecms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@
"react-app/jest"
]
},
"gitHead": "80d437634caccc4400fa111504186eb13197bac1"
"gitHead": "bfe341a3a8e3d2b33d4dc3f48fabc350eccace1b"
}
20 changes: 10 additions & 10 deletions packages/firebase_firecms/src/hooks/useFirestoreDelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function useFirestoreDelegate({
limit: number | undefined,
collectionGroup = false) => {

if (!firebaseApp) throw Error("useFirestoreDataSource Firebase not initialised");
if (!firebaseApp) throw Error("useFirestoreDelegate Firebase not initialised");

const firestore = getFirestore(firebaseApp);
const collectionReference: Query = collectionGroup ? collectionGroupClause(firestore, path) : collectionClause(firestore, path);
Expand Down Expand Up @@ -132,7 +132,7 @@ export function useFirestoreDelegate({
const getAndBuildEntity = useCallback(<M extends Record<string, any>>(path: string,
entityId: string
): Promise<Entity<M> | undefined> => {
if (!firebaseApp) throw Error("useFirestoreDataSource Firebase not initialised");
if (!firebaseApp) throw Error("useFirestoreDelegate Firebase not initialised");

const firestore = getFirestore(firebaseApp);

Expand Down Expand Up @@ -222,7 +222,7 @@ export function useFirestoreDelegate({
return new FirestoreGeoPoint(geoPoint.latitude, geoPoint.longitude)
},
buildReference(reference: EntityReference): any {
if (!firebaseApp) throw Error("useFirestoreDataSource Firebase not initialised");
if (!firebaseApp) throw Error("useFirestoreDelegate Firebase not initialised");
const firestore = getFirestore(firebaseApp);
return doc(firestore, reference.path, reference.id);
},
Expand Down Expand Up @@ -370,7 +370,7 @@ export function useFirestoreDelegate({
onUpdate,
onError
}: ListenEntityProps<M>): () => void => {
if (!firebaseApp) throw Error("useFirestoreDataSource Firebase not initialised");
if (!firebaseApp) throw Error("useFirestoreDelegate Firebase not initialised");

const firestore = getFirestore(firebaseApp);

Expand Down Expand Up @@ -404,7 +404,7 @@ export function useFirestoreDelegate({
status
}: SaveEntityProps<M>): Promise<Entity<M>> => {

if (!firebaseApp) throw Error("useFirestoreDataSource Firebase not initialised");
if (!firebaseApp) throw Error("useFirestoreDelegate Firebase not initialised");

const firestore = getFirestore(firebaseApp);

Expand Down Expand Up @@ -437,7 +437,7 @@ export function useFirestoreDelegate({
entity
}: DeleteEntityProps<M>
): Promise<void> => {
if (!firebaseApp) throw Error("useFirestoreDataSource Firebase not initialised");
if (!firebaseApp) throw Error("useFirestoreDelegate Firebase not initialised");

const firestore = getFirestore(firebaseApp);

Expand All @@ -461,7 +461,7 @@ export function useFirestoreDelegate({
entityId?: string
): Promise<boolean> => {

if (!firebaseApp) throw Error("useFirestoreDataSource Firebase not initialised");
if (!firebaseApp) throw Error("useFirestoreDelegate Firebase not initialised");

const firestore = getFirestore(firebaseApp);

Expand All @@ -479,7 +479,7 @@ export function useFirestoreDelegate({
}, [firebaseApp]),

generateEntityId: useCallback((path: string): string => {
if (!firebaseApp) throw Error("useFirestoreDataSource Firebase not initialised");
if (!firebaseApp) throw Error("useFirestoreDelegate Firebase not initialised");
const firestore = getFirestore(firebaseApp);
return doc(collectionClause(firestore, path)).id;
}, [firebaseApp]),
Expand All @@ -497,7 +497,7 @@ export function useFirestoreDelegate({
order?: "desc" | "asc",
isCollectionGroup?: boolean
}): Promise<number> => {
if (!firebaseApp) throw Error("useFirestoreDataSource Firebase not initialised");
if (!firebaseApp) throw Error("useFirestoreDelegate Firebase not initialised");
const query = buildQuery(path, filter, orderBy, order, undefined, undefined, isCollectionGroup);
const snapshot = await getCountFromServer(query);
return snapshot.data().count;
Expand All @@ -514,7 +514,7 @@ export function useFirestoreDelegate({
filterValues: FilterValues<any>,
sortBy?: [string, "asc" | "desc"]
}): boolean => {
if (!firebaseApp) throw Error("useFirestoreDataSource Firebase not initialised");
if (!firebaseApp) throw Error("useFirestoreDelegate Firebase not initialised");

const indexes = firestoreIndexesBuilder?.({
path,
Expand Down
1 change: 0 additions & 1 deletion packages/firebase_firecms/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./collections_firestore";
export * from "./database";
export * from "./local_storage";
6 changes: 3 additions & 3 deletions packages/firebase_firecms_pro/src/FireCMSProApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
useBuildModeController
} from "@firecms/core";

import { FirebaseCMSAppProps } from "./FirebaseCMSAppProps";
import { FireCMSProAppProps } from "./FireCMSProAppProps";
import { FirebaseLoginView } from "./components/FirebaseLoginView";
import {
FirebaseAuthController,
Expand Down Expand Up @@ -51,7 +51,7 @@ const DEFAULT_SIGN_IN_OPTIONS = [
* @constructor
* @category Firebase
*/
export function FirebaseCMSApp({
export function FireCMSProApp({
name,
logo,
logoDark,
Expand All @@ -75,7 +75,7 @@ export function FirebaseCMSApp({
autoOpenDrawer,
firestoreIndexesBuilder,
components
}: FirebaseCMSAppProps) {
}: FireCMSProAppProps) {

/**
* Update the browser title and icon
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_firecms_pro/src/FireCMSProAppProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
* Main entry point that defines the CMS configuration
* @category Firebase
*/
export type FirebaseCMSAppProps = {
export type FireCMSProAppProps = {

/**
* Name of the app, displayed as the main title and in the tab title
Expand Down
4 changes: 2 additions & 2 deletions packages/firebase_firecms_pro/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { FirebaseCMSApp } from "./FirebaseCMSApp";
export type { FirebaseCMSAppProps } from "./FirebaseCMSAppProps";
export { FireCMSProApp } from "./FireCMSProApp";
export type { FireCMSProAppProps } from "./FireCMSProAppProps";

export type { FirebaseLoginViewProps } from "./components/FirebaseLoginView";
export { FirebaseLoginView, LoginButton } from "./components/FirebaseLoginView";
Expand Down
2 changes: 1 addition & 1 deletion packages/firecms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@
"react-app/jest"
]
},
"gitHead": "80d437634caccc4400fa111504186eb13197bac1"
"gitHead": "bfe341a3a8e3d2b33d4dc3f48fabc350eccace1b"
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export function PlansComparison() {
<li className={"ml-8 list-disc"}>Everything in PLUS</li>
<li className={"ml-8 list-disc"}>SAML SSO</li>
<li className={"ml-8 list-disc"}>Custom domain</li>
<li className={"ml-8 list-disc"}>Full CMS components customization</li>
<li className={"ml-8 list-disc"}>Priority support</li>
<li className={"ml-8 list-disc"}>Roadmap prioritization</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion packages/firecms/src/hooks/useBuildFireCMSBackend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "firebase/auth";
import { useCallback, useEffect, useRef, useState } from "react";
import { buildProjectsApi } from "../api/projects";
import { clearDelegatedLoginTokensCache, FirebaseSignInOption, FirebaseSignInProvider } from "@firecms/firebase";
import { clearDelegatedLoginTokensCache } from "../utils";

const AUTH_SCOPES = [
"https://www.googleapis.com/auth/cloud-platform"
Expand Down
2 changes: 1 addition & 1 deletion packages/firecms/src/hooks/useDelegatedLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FirebaseApp } from "firebase/app";
import { useCallback, useEffect, useState } from "react";
import { getAuth, signInWithCustomToken, User as FirebaseUser } from "firebase/auth";
import { ProjectsApi } from "../api/projects";
import { cacheDelegatedLoginToken, getDelegatedLoginTokenFromCache } from "@firecms/firebase";
import { cacheDelegatedLoginToken, getDelegatedLoginTokenFromCache } from "../utils";

export type DelegatedLoginProps = {
projectsApi: ProjectsApi;
Expand Down
2 changes: 1 addition & 1 deletion packages/firecms/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./permissions";
export * from "./admin_views";
export * from "./firecms_tailwind_plugin";
export * from "./local_storage";
Loading

0 comments on commit 7c89278

Please sign in to comment.