From e4abf23a576ca8b5f2db85ffedba4478950b297a Mon Sep 17 00:00:00 2001 From: dobromirts Date: Fri, 21 Jun 2024 18:39:28 +0300 Subject: [PATCH] Fix dv samples git path for codesandbox --- src/app/services/code-view/angular-code-service.ts | 8 ++++---- src/app/services/code-view/base-code-service.ts | 1 + src/app/services/localization.ts | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/services/code-view/angular-code-service.ts b/src/app/services/code-view/angular-code-service.ts index 2c617ede..52b32961 100644 --- a/src/app/services/code-view/angular-code-service.ts +++ b/src/app/services/code-view/angular-code-service.ts @@ -135,13 +135,13 @@ export class AngularCodeService extends CodeService { return `https://codesandbox.io/s/github/IgniteUI/${repositoryPath}${branch}/${sampleUrl}`; } - private getGitHubSampleUrl(demosBaseUrl: string, sampleUrl: string) { + private getGitHubSampleUrl(demosBaseUrl: string, sampleUrl: string, gitSrc?: string) { // Get sample application base path const projectPath = demosBaseUrl.substring(demosBaseUrl.lastIndexOf("/") + 1) let demoPath = sampleUrl.replace(demosBaseUrl + "/", projectPath + "/"); - if (util.isLocalhost) { - demoPath = this.isDvSample(demosBaseUrl, sampleUrl) ? demoPath.replace(projectPath, 'samples') : demoPath.replace(projectPath, 'angular-demos'); + if (this.isDvSample(demosBaseUrl, sampleUrl) && gitSrc) { + demoPath = 'samples/' + gitSrc; } return demoPath; } @@ -150,7 +150,7 @@ export class AngularCodeService extends CodeService { const codeService = this; codeService.isButtonClickInProgress = true; let demosBaseUrl = $codeView.attr(codeService.demosBaseUrlAttrName)!; - let sampleFileUrl = codeService.getGitHubSampleUrl(demosBaseUrl, $codeView.attr(codeService.sampleUrlAttrName)!); + let sampleFileUrl = codeService.getGitHubSampleUrl(demosBaseUrl, $codeView.attr(codeService.sampleUrlAttrName)!, $codeView.attr(codeService.githubSrc)!); let editor = $button.hasClass(codeService.stkbButtonClass) ? "stackblitz" : "codesandbox"; let branch = demosBaseUrl.indexOf("staging.infragistics.com") !== -1 ? "vNext" : "master"; window.open(codeService.getAngularGitHubSampleUrl(editor, sampleFileUrl, branch, demosBaseUrl), '_blank'); diff --git a/src/app/services/code-view/base-code-service.ts b/src/app/services/code-view/base-code-service.ts index a64ba9c4..551af7e8 100644 --- a/src/app/services/code-view/base-code-service.ts +++ b/src/app/services/code-view/base-code-service.ts @@ -6,6 +6,7 @@ export abstract class CodeService { protected buttonSampleSourceAttrName = "data-sample-src"; protected demosBaseUrlAttrName = "data-demos-base-url"; protected sampleUrlAttrName = "iframe-src"; + protected githubSrc = "github-src"; protected isButtonClickInProgress = false; protected demosUrls: Map = new Map(); diff --git a/src/app/services/localization.ts b/src/app/services/localization.ts index 8b5ffc7c..b6fb8c02 100644 --- a/src/app/services/localization.ts +++ b/src/app/services/localization.ts @@ -44,7 +44,7 @@ class LocalizationService { "ctaGenericActionText": "60+ reusable components", "ctaGridText": "A {{actionText}}, covering everything from paging, sorting, filtering, editing, grouping to virtualization on rows and columns, and beyond. No limits for .NET developers.", "ctaGridActionText": "full set of ready-to-use features", - "ctaChartText": "Transform raw data into stunning visualizations and ensure the best UX, using {{actionText}} and graphs optimized for Blazor WebAssembly and Blazor Server.", + "ctaChartText": "Transform raw data into stunning visualizations and ensure the best UX, {{actionText}} and graphs optimized for Blazor WebAssembly and Blazor Server.", "ctaChartActionText": "using 60+ high-performance charts", }, "hljs": {