Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 35 additions & 10 deletions website/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommonModule, isPlatformBrowser } from '@angular/common';
import { Component, Inject, PLATFORM_ID } from '@angular/core';
import { Component, Inject, OnDestroy, PLATFORM_ID } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

Expand All @@ -13,19 +13,44 @@ import { FooterComponent } from './shared/footer';
templateUrl: './app.component.html',
standalone: true
})
export class AppComponent {
export class AppComponent implements OnDestroy{
constructor(@Inject(PLATFORM_ID) private platformId: Object) {
this.loadPlausible();
// Ensure we are in the browser (not SSR)
if (isPlatformBrowser(this.platformId)) {
this.loadPlausible();
this.setupMessageListener();
}
}

loadPlausible() {
// Ensure we are in the browser (not SSR)
public ngOnDestroy(): void {
this.removeMessageListener();
}

public loadPlausible() {
const script = document.createElement('script');
script.src = 'https://plausible.cluster.dev.meshcloud.io/js/script.js';
script.setAttribute('data-domain', 'hub.meshcloud.io');
script.defer = true;
document.head.appendChild(script);
}

private setupMessageListener(): void {
if (isPlatformBrowser(this.platformId)) {
const script = document.createElement('script');
script.src = 'https://plausible.cluster.dev.meshcloud.io/js/script.js';
script.setAttribute('data-domain', 'hub.meshcloud.io');
script.defer = true;
document.head.appendChild(script);
window.addEventListener('message', this.handleMessage.bind(this), false);
}
}

private removeMessageListener(): void {
if (isPlatformBrowser(this.platformId)) {
window.removeEventListener('message', this.handleMessage.bind(this), false);
}
}

private handleMessage(event: MessageEvent): void {
const originUrl = event.data.originUrl;

if (typeof originUrl === 'string') {
localStorage.setItem('referrerUrl', originUrl);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ export class ImportDialogComponent implements OnInit {
) { }

public ngOnInit(): void {
const originUrl = localStorage.getItem('referrerUrl') ?? '';
this.form = this.fb.group({
meshStackUrl: this.fb.nonNullable.control('', [Validators.required, Validators.pattern(/^(https?:\/\/).*/)]),
meshStackUrl: this.fb.nonNullable.control(
originUrl, [Validators.required, Validators.pattern(/^(https?:\/\/).*/)]
),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ export class TemplateGalleryComponent implements OnInit, OnDestroy {

public onSearch(): void {
const searchTerm = this.searchForm.value.searchTerm;
this.templates$ = this.getTemplatesWithLogos(
this.templateService.search(searchTerm)
);

this.templates$ = this.getTemplatesWithLogos(this.templateService.search(searchTerm));
this.isSearch = !!searchTerm;
this.router.navigate(['/all']);
}
Expand Down Expand Up @@ -93,4 +90,5 @@ export class TemplateGalleryComponent implements OnInit, OnDestroy {
)
);
}

}
26 changes: 19 additions & 7 deletions website/src/app/shared/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,23 @@
<h1 class="title">Welcome to meshStack Hub!</h1>
</div>

<div class="w-50">
<p class="text-dark">
Find ready-to-use Terraform modules to integrate with meshStack. Automate cloud governance or roll out commonly
used cloud resources. Built for scalability and security, these modules help you build your platform faster!
Explore the collection below and get started!
</p>
<div class="d-flex justify-content-between">
<div class="w-50">
<p class="text-dark">
Find ready-to-use Terraform modules to integrate with meshStack. Automate cloud governance or roll out commonly
used cloud resources. Built for scalability and security, these modules help you build your platform faster!
Explore the collection below and get started!
</p>
</div>
<span class="user-select-all text-truncate" style="color: transparent; width: 21ch; max-height: 4rem;">
Eggcelent! 🥚 <br>Now copy & paste me! <br>
You've cracked the clue wide open LOL
And this my friend, is an example of *what not to do* when hiding content.
#Accessibility Talk
You've discovered what was meant to hide,
a div transparent just like we tried.
Now for your next, look up hiiiigh
where muscles pull and ceiling tiles lie.
</span>
</div>
</header>
</header>
Loading