From e76dfd74d52039fa6426ccf0c68ca803cf77ff4b Mon Sep 17 00:00:00 2001 From: Harit Gandhi Date: Sun, 11 May 2025 01:55:56 +0530 Subject: [PATCH 1/6] Adding Logo --- .env | 1 + custom-application-config.js | 3 +++ src/components/container-list/container-list.tsx | 11 +++++++++++ .../custom-objects-list/custom-objects-list.tsx | 14 +++++++++++++- src/routes.tsx | 9 +-------- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.env b/.env index 4bdf3e6..ea651dc 100644 --- a/.env +++ b/.env @@ -1,5 +1,6 @@ ENABLE_NEW_JSX_TRANSFORM="true" FAST_REFRESH="true" +LOGO_MUST_BE_VISIBLE="true" CLOUD_IDENTIFIER=gcp-us APPLICATION_ID=cldoqtyfj009nzk01wfj8r99o diff --git a/custom-application-config.js b/custom-application-config.js index af7c291..a482ad5 100644 --- a/custom-application-config.js +++ b/custom-application-config.js @@ -36,6 +36,9 @@ const config = { labelAllLocales: [], permissions: [PERMISSIONS.View], }, + additionalEnv: { + logoMustBeVisible: '${env:LOGO_MUST_BE_VISIBLE}', + }, submenuLinks: [ // { // defaultLabel: 'Custom Objects Editor List', diff --git a/src/components/container-list/container-list.tsx b/src/components/container-list/container-list.tsx index 312e862..2346266 100644 --- a/src/components/container-list/container-list.tsx +++ b/src/components/container-list/container-list.tsx @@ -1,4 +1,5 @@ import React, { lazy, ReactNode } from 'react'; +import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors'; import { Link, Switch, useHistory, useRouteMatch } from 'react-router-dom'; import { SuspendedRoute } from '@commercetools-frontend/application-shell'; import { FormattedMessage, useIntl } from 'react-intl'; @@ -25,6 +26,7 @@ import LoadingSpinner from '@commercetools-uikit/loading-spinner'; import { CONTAINER, SORT_OPTIONS } from '../../constants'; import { getErrorMessage } from '../../helpers'; import { useCustomObjectsFetcher } from '../../hooks/use-custom-object-connector/use-custom-object-connector'; +import { Logo } from '../../images/logo'; import { FIELDS } from './constants'; import messages from './messages'; @@ -66,6 +68,12 @@ const ContainerList = () => { order: 'asc', }); + const { environment } = useApplicationContext<{ + logoMustBeVisible?: unknown; + }>(); + const logoMustBeVisible = + String(environment.logoMustBeVisible).toLowerCase() === 'true'; + const { customObjectsPaginatedResult, loading, error, refetch } = useCustomObjectsFetcher({ container: CONTAINER, @@ -185,6 +193,9 @@ const ContainerList = () => { /> ) )} + + {logoMustBeVisible && } + import('../create-custom-object')); const CustomObjectDetails = lazy(() => import('../custom-object-details')); @@ -50,6 +52,12 @@ const CustomObjectsList = () => { const { push } = useHistory(); const { hasContainers, containers } = useContainerContext(); + const { environment } = useApplicationContext<{ + logoMustBeVisible?: unknown; + }>(); + const logoMustBeVisible = + String(environment.logoMustBeVisible).toLowerCase() === 'true'; + const [key, setKey] = useState(''); const { page, perPage } = usePaginationState(); @@ -340,7 +348,11 @@ const CustomObjectsList = () => { /> ) )} + + + {logoMustBeVisible && } + { - - - Aries Labs Logo - - ); }; From c8ff5b63ba8e371230e0a6c6d243f90308d48dbb Mon Sep 17 00:00:00 2001 From: Harit Gandhi Date: Sun, 11 May 2025 02:02:30 +0530 Subject: [PATCH 2/6] Fixing errors and logo file --- .github/workflows/build.yml | 8 +++++--- src/images/logo.tsx | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 src/images/logo.tsx diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fccdd55..71cb8c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,26 +15,28 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + - name: Get yarn cache id: yarn-cache run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + - uses: actions/cache@v4 with: path: ${{ steps.yarn-cache.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- + - name: Install dependencies run: yarn install --pure-lockfile + - name: Test run: yarn run test - - name: Load custom application config - run: node node_modules/@commercetools-frontend/application-config/scripts/load-js-module.js ${{ github.workspace }}/custom-application-config.js - - name: Build run: yarn run build diff --git a/src/images/logo.tsx b/src/images/logo.tsx new file mode 100644 index 0000000..e84331d --- /dev/null +++ b/src/images/logo.tsx @@ -0,0 +1,37 @@ +export const Logo = () => { + return ( + + + + + + + + ); + }; \ No newline at end of file From 64e6e317faa013a15081e67dfe45304b10110c61 Mon Sep 17 00:00:00 2001 From: Harit Gandhi Date: Sun, 11 May 2025 02:07:37 +0530 Subject: [PATCH 3/6] Fixing errors --- .github/workflows/build.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71cb8c8..12eaf9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,29 +14,23 @@ jobs: node-version: [20.x] steps: - - uses: actions/checkout@v4 - + - uses: actions/checkout@v1 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - name: Get yarn cache id: yarn-cache - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v4 + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v1 with: path: ${{ steps.yarn-cache.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - - name: Install dependencies run: yarn install --pure-lockfile - - name: Test run: yarn run test - - name: Build run: yarn run build From 2bfb50b62c9b51e40d5f888ce93a4568b68db337 Mon Sep 17 00:00:00 2001 From: Harit Gandhi Date: Sun, 11 May 2025 02:42:08 +0530 Subject: [PATCH 4/6] Fixing bugs in build file --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12eaf9b..9beed82 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,15 +14,15 @@ jobs: node-version: [20.x] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Get yarn cache id: yarn-cache run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ${{ steps.yarn-cache.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} From 119559b75409d5b256cd8fa14a25e3d9430fc5b9 Mon Sep 17 00:00:00 2001 From: Harit Gandhi Date: Sun, 11 May 2025 02:50:20 +0530 Subject: [PATCH 5/6] Fixing bugs custom application file --- custom-application-config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom-application-config.js b/custom-application-config.js index a482ad5..f854f4a 100644 --- a/custom-application-config.js +++ b/custom-application-config.js @@ -1,4 +1,5 @@ -import { PERMISSIONS, entryPointUriPath } from './src/constants'; +// eslint-disable-next-line import/extensions +import { PERMISSIONS, entryPointUriPath } from './src/constants.ts'; /** * @type {import('@commercetools-frontend/application-config').ConfigOptions} From 634ea433ab9b423555adb0b808229c667984efd2 Mon Sep 17 00:00:00 2001 From: Harit Gandhi Date: Sun, 11 May 2025 02:59:27 +0530 Subject: [PATCH 6/6] Updating tsconfig file --- tsconfig.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index ded508b..0fff807 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,3 +1,9 @@ { - "extends": "@commercetools-frontend/application-config/tsconfig-mc-app.json" + "extends": "@commercetools-frontend/application-config/tsconfig-mc-app.json", + "compilerOptions": { + "typeRoots": ["@types", "@types-extensions", "node_modules/@types"], + // Allow tsc to resolve dependencies of `@types` packages in the way pnpm sets up the `node_modules`. + "preserveSymlinks": false + }, + "include": ["src"] }