refactor: Clean lint errors and organise files
This commit is contained in:
@@ -12,7 +12,7 @@ export class LinkMetadataService {
|
||||
private readonly serverDirectory = inject(ServerDirectoryFacade);
|
||||
|
||||
extractUrls(content: string): string[] {
|
||||
return [...content.matchAll(URL_PATTERN)].map((m) => m[0]);
|
||||
return [...content.matchAll(URL_PATTERN)].map((match) => match[0]);
|
||||
}
|
||||
|
||||
async fetchMetadata(url: string): Promise<LinkMetadata> {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { NgIcon, provideIcons } from '@ng-icons/core';
|
||||
import { lucideX } from '@ng-icons/lucide';
|
||||
import { LinkMetadata } from '../../../../../../shared-kernel';
|
||||
import { LinkMetadata } from '../../../../../../../shared-kernel';
|
||||
|
||||
@Component({
|
||||
selector: 'app-chat-link-embed',
|
||||
@@ -43,8 +43,8 @@ import {
|
||||
ProfileCardService,
|
||||
UserAvatarComponent
|
||||
} from '../../../../../../shared';
|
||||
import { ChatMessageMarkdownComponent } from './chat-message-markdown.component';
|
||||
import { ChatLinkEmbedComponent } from './chat-link-embed.component';
|
||||
import { ChatMessageMarkdownComponent } from './chat-message-markdown/chat-message-markdown.component';
|
||||
import { ChatLinkEmbedComponent } from './chat-link-embed/chat-link-embed.component';
|
||||
import {
|
||||
ChatMessageDeleteEvent,
|
||||
ChatMessageEditEvent,
|
||||
@@ -155,7 +155,7 @@ export class ChatMessageItemComponent {
|
||||
const msg = this.message();
|
||||
// Look up full user from store
|
||||
const users = this.allUsers();
|
||||
const found = users.find((u) => u.id === msg.senderId || u.oderId === msg.senderId);
|
||||
const found = users.find((userEntry) => userEntry.id === msg.senderId || userEntry.oderId === msg.senderId);
|
||||
const user: User = found ?? {
|
||||
id: msg.senderId,
|
||||
oderId: msg.senderId,
|
||||
|
||||
@@ -5,8 +5,8 @@ import remarkBreaks from 'remark-breaks';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import remarkParse from 'remark-parse';
|
||||
import { unified } from 'unified';
|
||||
import { ChatImageProxyFallbackDirective } from '../../../chat-image-proxy-fallback.directive';
|
||||
import { ChatYoutubeEmbedComponent, isYoutubeUrl } from './chat-youtube-embed.component';
|
||||
import { ChatImageProxyFallbackDirective } from '../../../../chat-image-proxy-fallback.directive';
|
||||
import { ChatYoutubeEmbedComponent, isYoutubeUrl } from '../chat-youtube-embed/chat-youtube-embed.component';
|
||||
|
||||
const PRISM_LANGUAGE_ALIASES: Record<string, string> = {
|
||||
cs: 'csharp',
|
||||
@@ -0,0 +1,11 @@
|
||||
@if (videoId()) {
|
||||
<div class="mt-2 w-[480px] max-w-full overflow-hidden rounded-md border border-border/60">
|
||||
<iframe
|
||||
[src]="embedUrl()"
|
||||
class="aspect-video w-full"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
loading="lazy"
|
||||
></iframe>
|
||||
</div>
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
inject,
|
||||
input
|
||||
} from '@angular/core';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
@@ -10,19 +11,7 @@ const YOUTUBE_URL_PATTERN = /(?:youtube\.com\/(?:watch\?.*v=|embed\/|shorts\/)|y
|
||||
@Component({
|
||||
selector: 'app-chat-youtube-embed',
|
||||
standalone: true,
|
||||
template: `
|
||||
@if (videoId()) {
|
||||
<div class="mt-2 w-[480px] max-w-full overflow-hidden rounded-md border border-border/60">
|
||||
<iframe
|
||||
[src]="embedUrl()"
|
||||
class="aspect-video w-full"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
loading="lazy"
|
||||
></iframe>
|
||||
</div>
|
||||
}
|
||||
`
|
||||
templateUrl: './chat-youtube-embed.component.html'
|
||||
})
|
||||
export class ChatYoutubeEmbedComponent {
|
||||
readonly url = input.required<string>();
|
||||
@@ -44,7 +33,7 @@ export class ChatYoutubeEmbedComponent {
|
||||
);
|
||||
});
|
||||
|
||||
constructor(private readonly sanitizer: DomSanitizer) {}
|
||||
private readonly sanitizer = inject(DomSanitizer);
|
||||
}
|
||||
|
||||
export function isYoutubeUrl(url?: string): boolean {
|
||||
Reference in New Issue
Block a user