Skip to content

Commit

Permalink
renamed all ai to regenerated
Browse files Browse the repository at this point in the history
  • Loading branch information
GunkaArtur committed May 8, 2024
1 parent 7d60fd6 commit 3671b4f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions public/editor-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import merge from "lodash/merge";
import set from "lodash/set";
import { getAIGlobalStyles } from "./aiGlobalStyles";
import { doAiRequest } from "./aiText";
import { autoSave } from "./autoSave";
import { getCollectionItemsIds } from "./collectionItems/getCollectionItemsIds";
Expand All @@ -27,6 +26,7 @@ import { onChange } from "./onChange";
import { onStartLoad } from "./onStartLoad";
import { popupConditions } from "./popupConditions";
import { publish } from "./publish";
import { getRegeneratedGlobalStyles } from "./regeneratedGlobalStyles";
import { savedBlocks } from "./savedBlocks/savedBlocks";
import { savedLayouts } from "./savedBlocks/savedLayouts";
import { savedPopups } from "./savedBlocks/savedPopups";
Expand Down Expand Up @@ -94,7 +94,7 @@ if (window.__VISUAL_CONFIG__) {
set(
window.__VISUAL_CONFIG__.ui,
["leftSidebar", "styles"],
getAIGlobalStyles(config)
getRegeneratedGlobalStyles(config)
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { getStyles, getTypography } from "@/api";
import { Config } from "@/config";
import { t } from "@/utils/i18n";
import { AiGlobalStyles, FontStyle, Palette } from "../types/DefaultTemplate";
import {
FontStyle,
Palette,
RegeneratedGlobalStyles
} from "../types/DefaultTemplate";

export const getAIGlobalStyles = (
export const getRegeneratedGlobalStyles = (
config: Config
): AiGlobalStyles<Palette, FontStyle> => {
): RegeneratedGlobalStyles<Palette, FontStyle> => {
return {
async regenerateColors(res, rej) {
try {
const styles = await getStyles(config);

res(styles.colorPalette);
} catch (e) {
rej(t("Failed to load meta.json"));
rej(t("Failed to load Regenerated Styles"));
}
},
async regenerateTypography(res, rej) {
Expand All @@ -22,7 +26,7 @@ export const getAIGlobalStyles = (

res(data.fontStyles);
} catch (e) {
rej(t("Failed to load resolves for selected DefaultTemplate"));
rej(t("Failed to load Regenerated Typography"));
}
},
label: t("Regenerate with AI")
Expand Down
2 changes: 1 addition & 1 deletion public/editor-client/src/types/DefaultTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface DefaultBlock {
value: Record<string, unknown>;
}

export interface AiGlobalStyles<T1, T2> {
export interface RegeneratedGlobalStyles<T1, T2> {
regenerateColors: (res: Response<T1>, rej: Response<string>) => void;
regenerateTypography: (
res: Response<Promise<T2>>,
Expand Down

0 comments on commit 3671b4f

Please sign in to comment.