-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
142 additions
and
57 deletions.
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
File renamed without changes.
File renamed without changes.
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
23 changes: 23 additions & 0 deletions
23
src/app/elements/element-connections/element-connections.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,23 @@ | ||
<article class="message"> | ||
<div class="message-header"> | ||
<p> | ||
{{ 'user.settings.connections.title' | translate }} <br/> | ||
<small>{{ 'user.settings.connections.subtitle' | translate }}</small> | ||
</p> | ||
</div> | ||
<div class="message-body"> | ||
<p class="pb-2">{{ 'user.settings.connections.visibility' | translate }}</p> | ||
<div class="row"> | ||
<app-connection-settings *ngFor="let connection of connections" | ||
class="column is-full" | ||
[connection]="connection" | ||
[discordId]="discordId" | ||
[twitchId]="twitchId" | ||
(deleteSelf)="deleteConnection(connection)" | ||
></app-connection-settings> | ||
</div> | ||
<button type="button" (click)="addNewConnection()" class="button is-success is-outlined is-fullwidth"> | ||
<fa-icon [icon]="faPlus"></fa-icon> | ||
</button> | ||
</div> | ||
</article> |
4 changes: 4 additions & 0 deletions
4
src/app/elements/element-connections/element-connections.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,4 @@ | ||
:host { | ||
box-sizing: border-box; | ||
display: block; | ||
} |
43 changes: 43 additions & 0 deletions
43
src/app/elements/element-connections/element-connections.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,43 @@ | ||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | ||
import { SocialAccount } from '../../../model/social-account'; | ||
import { faPlus } from '@fortawesome/free-solid-svg-icons'; | ||
|
||
@Component({ | ||
selector: 'app-element-connections', | ||
templateUrl: './element-connections.component.html', | ||
styleUrls: ['./element-connections.component.scss'] | ||
}) | ||
export class ElementConnectionsComponent implements OnInit { | ||
faPlus = faPlus; | ||
|
||
@Input() discordId = ''; | ||
@Input() twitchId = ''; | ||
|
||
@Input() connections: SocialAccount[] = []; | ||
@Output() connectionsChange = new EventEmitter<SocialAccount[]>(); | ||
|
||
constructor() { } | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
addNewConnection(): void { | ||
this.connections.push({ | ||
platform: '', | ||
username: '', | ||
}); | ||
this.connectionsChange.emit(this.connections); | ||
} | ||
|
||
deleteConnection(connection: SocialAccount): void { | ||
const conns = this.connections; | ||
|
||
const index = conns.indexOf(connection); | ||
|
||
if (index > -1) { | ||
conns.splice(index, 1); | ||
|
||
this.connectionsChange.emit(this.connections); | ||
} | ||
} | ||
} |
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
Submodule i18n
updated
from c1b088 to b72667
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,5 +1,13 @@ | ||
const mastodonRegex = /@?([^@]+)(?:@(.*))?/; | ||
|
||
export function parseMastodonUrl(input: string): string { | ||
const [username, platform] = input.split('@'); | ||
const match = mastodonRegex.exec(input); | ||
|
||
if (match == null) { | ||
return ''; | ||
} | ||
|
||
const [_, username, platform] = match; | ||
|
||
return `https://${platform}/@${username}`; | ||
return `https://${platform || 'mastodon.social'}/@${username}`; | ||
} |