Skip to content
Snippets Groups Projects

#3521811: Move drupalSettings and Drupal to a utility module in the frontend

Files
21
@@ -3,10 +3,17 @@ import { ExternalLinkIcon } from '@radix-ui/react-icons';
@@ -3,10 +3,17 @@ import { ExternalLinkIcon } from '@radix-ui/react-icons';
import ExtensionButton from '@/components/extensions/ExtensionButton';
import ExtensionButton from '@/components/extensions/ExtensionButton';
import { handleNonWorkingBtn } from '@/utils/function-utils';
import { handleNonWorkingBtn } from '@/utils/function-utils';
import type React from 'react';
import type React from 'react';
 
import {
 
getBaseUrl,
 
getDrupalSettings,
 
getXbSettings,
 
} from '@/utils/drupal-globals';
interface ExtensionsPopoverProps {}
interface ExtensionsPopoverProps {}
const { drupalSettings } = window;
const drupalSettings = getDrupalSettings();
 
const baseUrl = getBaseUrl();
 
const xbSettings = getXbSettings();
const ExtensionsList: React.FC<ExtensionsPopoverProps> = () => {
const ExtensionsList: React.FC<ExtensionsPopoverProps> = () => {
let extensionsList = [];
let extensionsList = [];
@@ -16,7 +23,7 @@ const ExtensionsList: React.FC<ExtensionsPopoverProps> = () => {
@@ -16,7 +23,7 @@ const ExtensionsList: React.FC<ExtensionsPopoverProps> = () => {
...value,
...value,
imgSrc:
imgSrc:
value.imgSrc ||
value.imgSrc ||
`${drupalSettings.path.baseUrl}${drupalSettings.xb.xbModulePath}/ui/assets/icons/extension-default-abstract.svg`,
`${baseUrl}${xbSettings.xbModulePath}/ui/assets/icons/extension-default-abstract.svg`,
name: value.name,
name: value.name,
description: value.description,
description: value.description,
};
};
Loading