Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

external website favicon detection #98

Closed
furknyavuz opened this issue Sep 11, 2021 · 1 comment · Fixed by #110
Closed

external website favicon detection #98

furknyavuz opened this issue Sep 11, 2021 · 1 comment · Fixed by #110
Assignees
Labels
feature New feature or request
Milestone

Comments

@furknyavuz
Copy link
Collaborator

furknyavuz commented Sep 11, 2021

Logo

Open Template Hub - Feature Request

Description

Just replace the existing code with the ones below:

Supplementary Info

external.component.html

<div class="splash-content flex-layout-column flex-center-center">
  <div class="splash-logos flex-layout-row flex-center-center">
    <img [src]="brand.brandLogo" alt="logo"/>
    <i aria-hidden="true" class="fa fa-arrow-alt-circle-right success-text"></i>
    <img [src]="website.logo" alt="partner"
         onerror="this.src='./assets/common/globe.png'"/>
  </div>
  <div class="alert-with-icon">
    <i aria-hidden="true" class="fas fa-info fa-lg fa-fw success-text"></i>
    <p>
      {{ info }}
    </p>
    <br />
    <p>
      {{ 'Will be redirected to: ' }}<br/><a class="link green-theme" (click)="redirect()">{{ href }}</a>
    </p>
  </div>
  <div class="external-component-button-wrapper">
    <app-button1 [text]="'Home'" [lighterContrast]="true" [themeColor]="ThemeColorSettings.green" [isSleekButton]="true"
                 transparent="true" [routerLink]="URLS.root">
    </app-button1>
    <app-button1 [text]="'Proceed'" [lighterContrast]="true" [themeColor]="ThemeColorSettings.green"
                 [isSleekButton]="true" transparent="true" (click)="redirect()">
    </app-button1>
  </div>
</div>

external.component.ts

import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { environmentCommon } from '../../../../environments/environment-common';
import { ThemeColorSettings, URLS } from '../../../data/constant';
import { ThemeService } from '../../../service/theme/theme.service';

@Component( {
  selector: 'app-external',
  templateUrl: './external.component.html',
  styleUrls: [ './external.component.scss' ]
} )
export class ExternalComponent {

  href: any;
  info: string;
  website: any;

  brand = {
    brandLogo: '',
  };

  ThemeColorSettings = ThemeColorSettings;
  URLS = URLS;

  constructor(
      private route: ActivatedRoute,
      private router: Router,
      private themeService: ThemeService
  ) {
    this.brand = this.themeService.brand;

    this.route.queryParams.subscribe( params => {
      this.href = params.href;
      this.info = params.info;

      for ( const key in environmentCommon.website ) {
        if ( this.href.startsWith( environmentCommon.website[ key ].url ) ) {
          this.website = environmentCommon.website[ key ];
          break;
        }
      }

      if ( !this.website ) {
        const url = new URL( this.href );

        const favicon = 'https://www.google.com/s2/favicons?sz=64&domain=' + url.origin;

        this.website = {
          logo: favicon
        };
      }
    } );
  }

  redirect() {
    window.location.href = this.href;
  }
}
othOpen Template Hub © 2021
@furknyavuz furknyavuz added the feature New feature or request label Sep 11, 2021
@furknyavuz furknyavuz added this to the 3.0.0 milestone Sep 11, 2021
@fatihturker fatihturker self-assigned this Sep 13, 2021
@create-issue-branch
Copy link

Branch feature/external-website-favicon-detection created!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants