Skip to content

Commit

Permalink
feat: add new icon picker component #4335
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 authored Oct 28, 2024
2 parents 690a0c4 + f11b7d7 commit 59e9712
Show file tree
Hide file tree
Showing 122 changed files with 3,621 additions and 3,284 deletions.
1 change: 0 additions & 1 deletion apps/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@webiny/app-form-builder": "0.0.0",
"@webiny/app-headless-cms": "0.0.0",
"@webiny/app-page-builder": "0.0.0",
"@webiny/app-page-builder-editor": "0.0.0",
"@webiny/app-serverless-cms": "0.0.0",
"@webiny/cli": "0.0.0",
"@webiny/plugins": "0.0.0",
Expand Down
16 changes: 0 additions & 16 deletions apps/admin/src/App.editor.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions apps/admin/src/okta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import OktaSignIn from "@okta/okta-signin-widget";
import { OktaAuth } from "@okta/okta-auth-js";
import "@okta/okta-signin-widget/dist/css/okta-sign-in.min.css";

const oktaDomain = `https://dev-844500.oktapreview.com`;
export const rootAppClientId = "0oa1149zslypdjy5B0h8";
const oktaDomain = String(process.env.WEBINY_ADMIN_OKTA_DOMAIN);
export const rootAppClientId = String(process.env.WEBINY_ADMIN_OKTA_APP_CLIENT_ID);

const redirectUri = window.location.origin + "/";

Expand Down
10 changes: 9 additions & 1 deletion packages/app-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@editorjs/editorjs": "^2.19.0",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@iconify/json": "^2.2.142",
"@material-design-icons/svg": "^0.14.3",
"@svgr/webpack": "^6.1.1",
"@types/mime": "^2.0.3",
Expand All @@ -27,6 +28,7 @@
"@webiny/lexical-editor": "0.0.0",
"@webiny/plugins": "0.0.0",
"@webiny/react-composition": "0.0.0",
"@webiny/react-properties": "0.0.0",
"@webiny/react-router": "0.0.0",
"@webiny/telemetry": "0.0.0",
"@webiny/ui": "0.0.0",
Expand All @@ -43,17 +45,21 @@
"emotion": "^10.0.17",
"graphlib": "^2.1.7",
"graphql": "^15.7.2",
"graphql-tag": "^2.12.6",
"is-hotkey": "^0.1.3",
"lodash": "^4.17.21",
"mobx": "^6.9.0",
"mobx-react-lite": "^3.4.3",
"prop-types": "^15.7.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hotkeyz": "^1.0.4",
"react-resizable-panels": "^2.0.19",
"react-transition-group": "^4.3.0",
"react-virtualized": "^9.21.2",
"reset-css": "^5.0.1",
"store": "^2.0.12"
"store": "^2.0.12",
"unicode-emoji-json": "^0.4.0"
},
"devDependencies": {
"@emotion/babel-plugin": "^11.11.0",
Expand All @@ -79,6 +85,8 @@
"ignore": {
"dependencies": [
"@svgr/webpack",
"@iconify/json",
"unicode-emoji-json",
"@emotion/react",
"@types/mime",
"reset-css"
Expand Down
22 changes: 14 additions & 8 deletions packages/app-admin/src/base/Admin.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { App, Provider } from "@webiny/app";
import { App } from "@webiny/app";
import { ThemeProvider } from "@webiny/app-theme";
import { WcpProvider } from "@webiny/app-wcp";
import { CircularProgress } from "@webiny/ui/Progress";
Expand All @@ -11,6 +11,7 @@ import { SearchProvider } from "./ui/Search";
import { UserMenuProvider } from "./ui/UserMenu";
import { NavigationProvider } from "./ui/Navigation";
import { createDialogsProvider } from "~/components/Dialogs/DialogsContext";
import { DefaultIcons, IconPickerConfigProvider } from "~/components/IconPicker/config";

export interface AdminProps {
createApolloClient: ApolloClientFactory;
Expand All @@ -27,14 +28,19 @@ export const Admin = ({ children, createApolloClient }: AdminProps) => {
<ApolloProvider>
<ThemeProvider>
<WcpProvider loader={<CircularProgress label={"Loading..."} />}>
<App>
<Provider hoc={TelemetryProvider} />
<Provider hoc={UiStateProvider} />
<Provider hoc={SearchProvider} />
<Provider hoc={UserMenuProvider} />
<Provider hoc={NavigationProvider} />
<Provider hoc={DialogsProvider} />
<App
providers={[
TelemetryProvider,
UiStateProvider,
SearchProvider,
UserMenuProvider,
NavigationProvider,
DialogsProvider,
IconPickerConfigProvider
]}
>
<Base />
<DefaultIcons />
{children}
</App>
</WcpProvider>
Expand Down
26 changes: 14 additions & 12 deletions packages/app-admin/src/base/providers/TelemetryProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
import React, { useEffect } from "react";
import { sendEvent } from "@webiny/telemetry/react";
import { ComponentWithChildren } from "~/types";
import { createProvider } from "@webiny/app";

let eventSent = false;

interface TelemetryProviderProps {
children: React.ReactNode;
}

export const createTelemetryProvider = () => (Component: ComponentWithChildren) => {
return function TelemetryProvider({ children }: TelemetryProviderProps) {
useEffect(() => {
if (eventSent) {
return;
}
export const createTelemetryProvider = () => {
return createProvider(Component => {
return function TelemetryProvider({ children }: TelemetryProviderProps) {
useEffect(() => {
if (eventSent) {
return;
}

eventSent = true;
eventSent = true;

sendEvent("admin-app-start");
}, []);
sendEvent("admin-app-start");
}, []);

return <Component>{children}</Component>;
};
return <Component>{children}</Component>;
};
});
};
20 changes: 11 additions & 9 deletions packages/app-admin/src/base/providers/UiStateProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import React from "react";
import { UiProvider } from "@webiny/app/contexts/Ui";
import { ComponentWithChildren } from "~/types";
import { createProvider } from "@webiny/app";

interface UiStateProviderProps {
children: React.ReactNode;
}

export const createUiStateProvider = () => (Component: ComponentWithChildren) => {
return function UiStateProvider({ children }: UiStateProviderProps) {
return (
<UiProvider>
<Component>{children}</Component>
</UiProvider>
);
};
export const createUiStateProvider = () => {
return createProvider(Component => {
return function UiStateProvider({ children }: UiStateProviderProps) {
return (
<UiProvider>
<Component>{children}</Component>
</UiProvider>
);
};
});
};
7 changes: 3 additions & 4 deletions packages/app-admin/src/base/ui/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import React, {
useState
} from "react";
import { generateId } from "@webiny/utils";
import { createVoidComponent, makeDecoratable, Plugins } from "@webiny/app";
import { createProvider, createVoidComponent, makeDecoratable, Plugins } from "@webiny/app";
import { AddMenu as Menu, createEmptyMenu, MenuData, MenuProps, MenuUpdater, Tags } from "~/index";
import { plugins } from "@webiny/plugins";
import { AdminMenuPlugin } from "~/types";
import { ItemProps, SectionProps } from "~/plugins/MenuPlugin";
import { ComponentWithChildren } from "~/types";

export interface NavigationContext {
menuItems: MenuData[];
Expand Down Expand Up @@ -89,7 +88,7 @@ interface NavigationProviderProps {
children: React.ReactNode;
}

export const NavigationProvider = (Component: ComponentWithChildren) => {
export const NavigationProvider = createProvider(Component => {
return function NavigationProvider({ children }: NavigationProviderProps) {
const [menuItems, setState] = useState<MenuData[]>([]);

Expand Down Expand Up @@ -141,7 +140,7 @@ export const NavigationProvider = (Component: ComponentWithChildren) => {
</NavigationContext.Provider>
);
};
};
});

export const Navigation = makeDecoratable("Navigation", () => {
return (
Expand Down
7 changes: 3 additions & 4 deletions packages/app-admin/src/base/ui/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useCallback, useEffect, useState } from "react";
import { createVoidComponent, makeDecoratable } from "@webiny/app";
import { ComponentWithChildren } from "~/types";
import { createProvider, createVoidComponent, makeDecoratable } from "@webiny/app";

export interface SearchOptionData {
route: string;
Expand Down Expand Up @@ -33,7 +32,7 @@ interface SearchProviderProps {
[key: string]: any;
}

export const SearchProvider = (Component: ComponentWithChildren) => {
export const SearchProvider = createProvider(Component => {
return function SearchProvider({ children, ...props }: SearchProviderProps) {
const [options, setOptions] = useState<SearchOptionData[]>([]);

Expand All @@ -53,7 +52,7 @@ export const SearchProvider = (Component: ComponentWithChildren) => {
</SearchContext.Provider>
);
};
};
});

export const Search = makeDecoratable("Search", () => {
return <SearchRenderer />;
Expand Down
7 changes: 3 additions & 4 deletions packages/app-admin/src/base/ui/UserMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Fragment, useCallback, useEffect, useState } from "react";
import { createVoidComponent, makeDecoratable } from "@webiny/app";
import { ComponentWithChildren } from "~/types";
import { createProvider, createVoidComponent, makeDecoratable } from "@webiny/app";

export interface UserMenuItemData {
label?: string;
Expand Down Expand Up @@ -32,7 +31,7 @@ interface UserMenuProviderProps {
[key: string]: any;
}

export const UserMenuProvider = (Component: ComponentWithChildren) => {
export const UserMenuProvider = createProvider(Component => {
return function UserMenuProvider({ children, ...props }: UserMenuProviderProps) {
const [menuItems, setItems] = useState<UserMenuItemData[]>([]);

Expand Down Expand Up @@ -65,7 +64,7 @@ export const UserMenuProvider = (Component: ComponentWithChildren) => {
</UserMenuContext.Provider>
);
};
};
});

export const UserMenu = makeDecoratable("UserMenu", () => {
return <UserMenuRenderer />;
Expand Down
8 changes: 5 additions & 3 deletions packages/app-admin/src/components/Dialogs/DialogsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { GenericFormData } from "@webiny/form";
import { useSnackbar } from "~/hooks";
import { Dialog } from "./Dialog";
import { CustomDialog } from "./CustomDialog";
import { createProvider } from "@webiny/app";

interface ShowDialogParams {
title: ReactNode;
Expand Down Expand Up @@ -154,13 +155,14 @@ interface DialogsProviderProps {
children: React.ReactNode;
}

export const createDialogsProvider =
() => (Component: React.ComponentType<React.PropsWithChildren>) => {
export const createDialogsProvider = () => {
return createProvider(Component => {
return function DialogsProviderDecorator({ children }: DialogsProviderProps) {
return (
<DialogsProvider>
<Component>{children}</Component>
</DialogsProvider>
);
};
};
});
};
Loading

0 comments on commit 59e9712

Please sign in to comment.