-
Notifications
You must be signed in to change notification settings - Fork 559
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
[Feat] Create Reusable Component and Add Workspace Links #8383
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
01492f5
feat: export social links
adkif 17afd59
feat: create a shared logo component
adkif 60053ba
feat: create a shared social links component
adkif ab370ea
feat: add reusable patterns to constants
adkif 68e998b
feat: add link to magic workspace signin and use reusable logo, links…
adkif aff5409
feat: SwitchThemeModule, LogoComponent, and SocialLinksComponent to N…
adkif File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core'; | ||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; | ||
import { Router } from '@angular/router'; | ||
import { NB_AUTH_OPTIONS, NbAuthService, NbLoginComponent } from '@nebular/auth'; | ||
import { UntilDestroy } from '@ngneat/until-destroy'; | ||
import { GAUZY_ENV } from '../constants/app.constants'; | ||
import { ElectronService } from '../electron/services'; | ||
import { LanguageElectronService } from '../language/language-electron.service'; | ||
|
||
|
@@ -23,10 +21,7 @@ export class NgxLoginComponent extends NbLoginComponent implements OnInit { | |
public readonly cdr: ChangeDetectorRef, | ||
public readonly router: Router, | ||
@Inject(NB_AUTH_OPTIONS) | ||
options: any, | ||
private readonly _domSanitizer: DomSanitizer, | ||
@Inject(GAUZY_ENV) | ||
private readonly _environment: any | ||
options: any | ||
) { | ||
super(nbAuthService, options, cdr, router); | ||
} | ||
|
@@ -42,8 +37,4 @@ export class NgxLoginComponent extends NbLoginComponent implements OnInit { | |
public register(): void { | ||
this.electronService.shell.openExternal('https://app.gauzy.co/#/auth/register'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @adkif we should have this URL read from env var, we can't hardcode it, please fix in next PR :) (needed for customizations) |
||
} | ||
|
||
public get logoUrl(): SafeResourceUrl { | ||
return this._domSanitizer.bypassSecurityTrustResourceUrl(this._environment.PLATFORM_LOGO); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/desktop-ui-lib/src/lib/login/shared/ui/logo/logo.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="svg-wrapper"> | ||
<img [src]="logoUrl" class="ever-logo-svg" /> | ||
</div> |
9 changes: 9 additions & 0 deletions
9
packages/desktop-ui-lib/src/lib/login/shared/ui/logo/logo.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.svg-wrapper { | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
& .ever-logo-svg { | ||
margin-bottom: 40px; | ||
height: 25px; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/desktop-ui-lib/src/lib/login/shared/ui/logo/logo.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Component, Inject } from '@angular/core'; | ||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; | ||
import { GAUZY_ENV } from '../../../../constants'; | ||
|
||
@Component({ | ||
selector: 'gauzy-logo', | ||
templateUrl: './logo.component.html', | ||
styleUrls: ['./logo.component.scss'] | ||
}) | ||
export class LogoComponent { | ||
constructor( | ||
private readonly _domSanitizer: DomSanitizer, | ||
@Inject(GAUZY_ENV) | ||
private readonly _environment: any | ||
) {} | ||
|
||
public get logoUrl(): SafeResourceUrl { | ||
return this._domSanitizer.bypassSecurityTrustResourceUrl(this._environment.PLATFORM_LOGO); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
packages/desktop-ui-lib/src/lib/login/shared/ui/social-links/social-links.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<ng-container *ngIf="socialLinks$ | async as socialLinks"> | ||
<ng-container *ngIf="socialLinks.length > 0"> | ||
<div class="links" aria-label="Social SignIn"> | ||
{{ 'LOGIN_PAGE.OR_SIGN_IN_WITH' | translate }} | ||
<div class="socials"> | ||
<ng-container *ngFor="let socialLink of socialLinks"> | ||
<ng-container *ngIf="socialLink.link"> | ||
<a [routerLink]="socialLink.link" [attr.target]="socialLink.target" class="social-link"> | ||
<nb-icon *ngIf="socialLink.icon; else title" [icon]="socialLink.icon"></nb-icon> | ||
<ng-template #title> | ||
{{ socialLink.title }} | ||
</ng-template> | ||
</a> | ||
</ng-container> | ||
<ng-container *ngIf="socialLink.url"> | ||
<a [attr.href]="socialLink.url" [attr.target]="socialLink.target" class="social-link"> | ||
<nb-icon *ngIf="socialLink.icon; else title" [icon]="socialLink.icon"></nb-icon> | ||
<ng-template #title> | ||
{{ socialLink.title }} | ||
</ng-template> | ||
</a> | ||
</ng-container> | ||
</ng-container> | ||
adkif marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
</div> | ||
</ng-container> | ||
</ng-container> | ||
adkif marked this conversation as resolved.
Show resolved
Hide resolved
|
10 changes: 10 additions & 0 deletions
10
packages/desktop-ui-lib/src/lib/login/shared/ui/social-links/social-links.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@import '@shared/reusable'; | ||
|
||
.links { | ||
margin-top: 21px; | ||
@include social-links-style; | ||
& .socials { | ||
margin-top: 15px; | ||
margin-bottom: 25px; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
packages/desktop-ui-lib/src/lib/login/shared/ui/social-links/social-links.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { UntilDestroy } from '@ngneat/until-destroy'; | ||
import { Observable, of } from 'rxjs'; | ||
import { socialLinks } from '../../../../auth'; | ||
|
||
/** | ||
* Interface representing a social link. | ||
*/ | ||
export interface ISocialLink { | ||
/** The URL of the social link. */ | ||
url: string; | ||
/** The icon associated with the social link. */ | ||
icon: string; | ||
/** (Optional) The target attribute for the link. */ | ||
target?: string; | ||
/** (Optional) The link attribute for the link. */ | ||
link?: string; | ||
/** (Optional) The title attribute for the link. */ | ||
title?: string; | ||
} | ||
|
||
@UntilDestroy({ checkProperties: true }) | ||
@Component({ | ||
selector: 'ngx-social-links', | ||
templateUrl: './social-links.component.html', | ||
styleUrls: ['./social-links.component.scss'] | ||
}) | ||
export class SocialLinksComponent implements OnInit { | ||
/** */ | ||
public socialLinks$: Observable<ISocialLink[]>; // Observable for an array of social links | ||
|
||
/** | ||
* Lifecycle hook called after Angular has initialized all data-bound properties of a directive. | ||
* Called once after the first ngOnChanges(). | ||
*/ | ||
ngOnInit(): void { | ||
this.socialLinks$ = of(socialLinks); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adkif We already have such patterns in
@gauzy/ui-core
package. Why we are duplicating many things?