Skip to content

Commit

Permalink
Make everything standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
cremertim committed Nov 29, 2024
1 parent 5f2e030 commit 1e24b87
Show file tree
Hide file tree
Showing 22 changed files with 151 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import { LinkPreview, LinkPreviewService } from 'app/shared/link-preview/service
import { Link, LinkifyService } from 'app/shared/link-preview/services/linkify.service';
import { User } from 'app/core/user/user.model';
import { Posting } from 'app/entities/metis/posting.model';
import { LinkPreviewComponent } from 'app/shared/link-preview/components/link-preview/link-preview.component';

@Component({
selector: 'jhi-link-preview-container',
templateUrl: './link-preview-container.component.html',
styleUrls: ['./link-preview-container.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [LinkPreviewComponent],
})
export class LinkPreviewContainerComponent implements OnInit, OnChanges {
private readonly linkPreviewService: LinkPreviewService = inject(LinkPreviewService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import { faTimes } from '@fortawesome/free-solid-svg-icons';
import { MetisService } from 'app/shared/metis/metis.service';
import { Posting } from 'app/entities/metis/posting.model';
import { urlRegex } from 'app/shared/link-preview/services/linkify.service';
import { ArtemisConfirmIconModule } from 'app/shared/confirm-icon/confirm-icon.module';
import { ArtemisSharedModule } from 'app/shared/shared.module';

@Component({
selector: 'jhi-link-preview',
templateUrl: './link-preview.component.html',
styleUrls: ['./link-preview.component.scss'],
standalone: true,
imports: [ArtemisConfirmIconModule, ArtemisSharedModule],
})
export class LinkPreviewComponent implements OnInit {
@Input() linkPreview: LinkPreview;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ import { Reaction } from 'app/entities/metis/reaction.model';
import { faBookmark, faPencilAlt, faSmile, faTrash } from '@fortawesome/free-solid-svg-icons';
import { DOCUMENT } from '@angular/common';
import { AnswerPostReactionsBarComponent } from 'app/shared/metis/posting-reactions-bar/answer-post-reactions-bar/answer-post-reactions-bar.component';
import { PostingContentComponent } from 'app/shared/metis/posting-content/posting-content.components';
import { AnswerPostHeaderComponent } from 'app/shared/metis/posting-header/answer-post-header/answer-post-header.component';
import { AnswerPostCreateEditModalComponent } from 'app/shared/metis/posting-create-edit-modal/answer-post-create-edit-modal/answer-post-create-edit-modal.component';
import { OverlayModule } from '@angular/cdk/overlay';
import { EmojiPickerComponent } from 'app/shared/metis/emoji/emoji-picker.component';
import { ArtemisSharedModule } from 'app/shared/shared.module';

@Component({
selector: 'jhi-answer-post',
Expand All @@ -35,6 +41,16 @@ import { AnswerPostReactionsBarComponent } from 'app/shared/metis/posting-reacti
transition(':leave', [animate('300ms ease-out', style({ opacity: 0 }))]),
]),
],
standalone: true,
imports: [
AnswerPostReactionsBarComponent,
PostingContentComponent,
AnswerPostHeaderComponent,
AnswerPostCreateEditModalComponent,
ArtemisSharedModule,
OverlayModule,
EmojiPickerComponent,
],
})
export class AnswerPostComponent extends PostingDirective<AnswerPost> implements OnInit, OnChanges {
@Input() lastReadDate?: dayjs.Dayjs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import { Component, EventEmitter, Input, Output, computed, inject } from '@angul
import { Theme, ThemeService } from 'app/core/theme/theme.service';
import { EmojiUtils } from 'app/shared/metis/emoji/emoji.utils';
import { EmojiData } from '@ctrl/ngx-emoji-mart/ngx-emoji';
import { EmojiModule } from '@ctrl/ngx-emoji-mart/ngx-emoji';
import { ArtemisSharedModule } from 'app/shared/shared.module';
import { PickerModule } from '@ctrl/ngx-emoji-mart';

@Component({
selector: 'jhi-emoji-picker',
templateUrl: './emoji-picker.component.html',
standalone: true,
imports: [EmojiModule, ArtemisSharedModule, PickerModule],
})
export class EmojiPickerComponent {
private themeService = inject(ThemeService);
Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/app/shared/metis/emoji/emoji.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Component, Input, computed, inject } from '@angular/core';
import { Theme, ThemeService } from 'app/core/theme/theme.service';
import { EmojiUtils } from 'app/shared/metis/emoji/emoji.utils';
import { EmojiModule } from '@ctrl/ngx-emoji-mart/ngx-emoji';

@Component({
selector: 'jhi-emoji',
templateUrl: './emoji.component.html',
styleUrls: ['./emoji.component.scss'],
standalone: true,
imports: [EmojiModule],
})
export class EmojiComponent {
private themeService = inject(ThemeService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { PostContentValidationPattern } from 'app/shared/metis/metis.util';
import { PostingCreateEditDirective } from 'app/shared/metis/posting-create-edit.directive';
import { LocalStorageService } from 'ngx-webstorage';
import { ArtemisSharedModule } from 'app/shared/shared.module';
import { PostingButtonComponent } from 'app/shared/metis/posting-button/posting-button.component';
import { PostingMarkdownEditorComponent } from 'app/shared/metis/posting-markdown-editor/posting-markdown-editor.component';

@Component({
selector: 'jhi-message-inline-input',
templateUrl: './message-inline-input.component.html',
styleUrls: ['./message-inline-input.component.scss'],
encapsulation: ViewEncapsulation.None,
standalone: true,
imports: [ArtemisSharedModule, PostingButtonComponent, PostingMarkdownEditorComponent],
})
export class MessageInlineInputComponent extends PostingCreateEditDirective<Post | AnswerPost> implements OnInit {
warningDismissed = false;
Expand Down
33 changes: 15 additions & 18 deletions src/main/webapp/app/shared/metis/metis.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,15 @@ import { ProfilePictureComponent } from 'app/shared/profile-picture/profile-pict
ReactiveFormsModule,
FormsModule,
ArtemisSharedComponentModule,
PostReactionsBarComponent,
AnswerPostReactionsBarComponent,
PostCreateEditModalComponent,
PickerModule,
EmojiComponent,
EmojiPickerComponent,
EmojiModule,
PostingMarkdownEditorComponent,
PostComponent,
OverlayModule,
CommonModule,
FontAwesomeModule,
Expand All @@ -64,33 +71,22 @@ import { ProfilePictureComponent } from 'app/shared/profile-picture/profile-pict
MatDialogModule,
LinkPreviewModule,
ProfilePictureComponent,
],
declarations: [
PostingThreadComponent,
PostHeaderComponent,
AnswerPostHeaderComponent,
PostCreateEditModalComponent,
ReactingUsersOnPostingPipe,
PostTagSelectorComponent,
PostFooterComponent,
PostingContentComponent,
AnswerPostCreateEditModalComponent,
PostingButtonComponent,
PostingMarkdownEditorComponent,
PostComponent,
AnswerPostComponent,
PostingContentComponent,
PostingContentPartComponent,
LinkPreviewComponent,
LinkPreviewContainerComponent,
EnlargeSlideImageComponent,
PostReactionsBarComponent,
AnswerPostReactionsBarComponent,
MessageInlineInputComponent,
MessageReplyInlineInputComponent,
PostingContentPartComponent,
PostHeaderComponent,
AnswerPostHeaderComponent,
PostingButtonComponent,
HtmlForPostingMarkdownPipe,
ReactingUsersOnPostingPipe,
EmojiComponent,
EmojiPickerComponent,
],
declarations: [PostingThreadComponent, EnlargeSlideImageComponent, MessageReplyInlineInputComponent],
exports: [
PostingThreadComponent,
PostHeaderComponent,
Expand All @@ -115,6 +111,7 @@ import { ProfilePictureComponent } from 'app/shared/profile-picture/profile-pict
HtmlForPostingMarkdownPipe,
EmojiComponent,
EmojiPickerComponent,
ReactingUsersOnPostingPipe,
],
providers: [MetisConversationService],
})
Expand Down
19 changes: 18 additions & 1 deletion src/main/webapp/app/shared/metis/post/post.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ import { AnswerPostCreateEditModalComponent } from 'app/shared/metis/posting-cre
import { animate, style, transition, trigger } from '@angular/animations';
import { PostCreateEditModalComponent } from 'app/shared/metis/posting-create-edit-modal/post-create-edit-modal/post-create-edit-modal.component';
import { PostReactionsBarComponent } from 'app/shared/metis/posting-reactions-bar/post-reactions-bar/post-reactions-bar.component';
import { CdkOverlayOrigin } from '@angular/cdk/overlay';
import { CdkOverlayOrigin, OverlayModule } from '@angular/cdk/overlay';
import { DOCUMENT } from '@angular/common';
import { EmojiPickerComponent } from 'app/shared/metis/emoji/emoji-picker.component';
import { ArtemisSharedModule } from 'app/shared/shared.module';
import { MessageInlineInputComponent } from 'app/shared/metis/message/message-inline-input/message-inline-input.component';
import { PostingContentComponent } from 'app/shared/metis/posting-content/posting-content.components';
import { PostHeaderComponent } from 'app/shared/metis/posting-header/post-header/post-header.component';

@Component({
selector: 'jhi-post',
Expand All @@ -47,6 +52,18 @@ import { DOCUMENT } from '@angular/common';
transition(':leave', [animate('300ms ease-out', style({ opacity: 0 }))]),
]),
],
standalone: true,
imports: [
EmojiPickerComponent,
OverlayModule,
ArtemisSharedModule,
MessageInlineInputComponent,
PostFooterComponent,
PostReactionsBarComponent,
AnswerPostCreateEditModalComponent,
PostingContentComponent,
PostHeaderComponent,
],
})
export class PostComponent extends PostingDirective<Post> implements OnInit, OnChanges, AfterContentChecked {
@Input() lastReadDate?: dayjs.Dayjs;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Component, HostBinding, Input } from '@angular/core';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons';

@Component({
/* eslint-disable-next-line @angular-eslint/component-selector */
selector: 'button[jhi-posting-button]',
templateUrl: './posting-button.component.html',
standalone: true,
imports: [FontAwesomeModule],
})
export class PostingButtonComponent {
@Input() buttonIcon: IconProp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { EnlargeSlideImageComponent } from 'app/shared/metis/posting-content/enlarge-slide-image/enlarge-slide-image.component';
import { MatDialog } from '@angular/material/dialog';
import { AccountService } from 'app/core/auth/account.service';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { HtmlForPostingMarkdownPipe } from 'app/shared/pipes/html-for-posting-markdown.pipe';
import { RouterModule } from '@angular/router';

@Component({
selector: 'jhi-posting-content-part',
templateUrl: './posting-content-part.component.html',
styleUrls: ['./../../metis.component.scss'],
standalone: true,
imports: [FontAwesomeModule, HtmlForPostingMarkdownPipe, RouterModule],
})
export class PostingContentPartComponent implements OnInit {
@Input() postingContentPart: PostingContentPart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ import { PatternMatch, PostingContentPart, ReferenceType } from '../metis.util';
import { User } from 'app/core/user/user.model';
import { Posting } from 'app/entities/metis/posting.model';
import { isCommunicationEnabled } from 'app/entities/course.model';
import { ArtemisSharedComponentModule } from 'app/shared/components/shared-component.module';
import { ArtemisSharedModule } from 'app/shared/shared.module';
import { LinkPreviewContainerComponent } from 'app/shared/link-preview/components/link-preview-container/link-preview-container.component';
import { PostingContentPartComponent } from 'app/shared/metis/posting-content/posting-content-part/posting-content-part.components';

@Component({
selector: 'jhi-posting-content',
templateUrl: './posting-content.component.html',
styleUrls: ['./posting-content.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [ArtemisSharedComponentModule, ArtemisSharedModule, LinkPreviewContainerComponent, PostingContentPartComponent],
})
export class PostingContentComponent implements OnInit, OnChanges, OnDestroy {
@Input() content?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ import { MetisService } from 'app/shared/metis/metis.service';
import { FormBuilder, Validators } from '@angular/forms';
import { PostContentValidationPattern } from 'app/shared/metis/metis.util';
import { Posting } from 'app/entities/metis/posting.model';
import { ArtemisSharedModule } from 'app/shared/shared.module';
import { PostingMarkdownEditorComponent } from 'app/shared/metis/posting-markdown-editor/posting-markdown-editor.component';
import { PostingButtonComponent } from 'app/shared/metis/posting-button/posting-button.component';

@Component({
selector: 'jhi-answer-post-create-edit-modal',
templateUrl: './answer-post-create-edit-modal.component.html',
styleUrls: ['answer-post-create-edit-modal.component.scss'],
encapsulation: ViewEncapsulation.None,
standalone: true,
imports: [ArtemisSharedModule, PostingMarkdownEditorComponent, PostingButtonComponent],
})
export class AnswerPostCreateEditModalComponent extends PostingCreateEditModalDirective<AnswerPost> {
@Input() createEditAnswerPostContainerRef: ViewContainerRef;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ import { faAngleDown, faAngleUp } from '@fortawesome/free-solid-svg-icons';
import { PageType, PostContentValidationPattern, PostTitleValidationPattern, PostingEditType } from 'app/shared/metis/metis.util';
import { Conversation } from 'app/entities/metis/conversation/conversation.model';
import { getAsChannelDTO } from 'app/entities/metis/conversation/channel.model';
import { ArtemisSharedModule } from 'app/shared/shared.module';
import { PostingMarkdownEditorComponent } from 'app/shared/metis/posting-markdown-editor/posting-markdown-editor.component';
import { PostComponent } from 'app/shared/metis/post/post.component';
import { PostingContentComponent } from 'app/shared/metis/posting-content/posting-content.components';
import { PostingButtonComponent } from 'app/shared/metis/posting-button/posting-button.component';
import { ArtemisSharedComponentModule } from 'app/shared/components/shared-component.module';
import { PostTagSelectorComponent } from 'app/shared/metis/posting-create-edit-modal/post-create-edit-modal/post-tag-selector/post-tag-selector.component';

const TITLE_MAX_LENGTH = 200;

Expand All @@ -23,6 +30,16 @@ export interface ContextSelectorOption {
selector: 'jhi-post-create-edit-modal',
templateUrl: './post-create-edit-modal.component.html',
styleUrls: ['../../metis.component.scss'],
standalone: true,
imports: [
PostingMarkdownEditorComponent,
ArtemisSharedModule,
PostingContentComponent,
PostingButtonComponent,
ArtemisSharedComponentModule,
PostTagSelectorComponent,
PostComponent,
],
})
export class PostCreateEditModalComponent extends PostingCreateEditModalDirective<Post> implements OnInit, OnChanges {
@Input() isCommunicationPage: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ import { Observable, Subscription, map, startWith } from 'rxjs';
import { MetisService } from 'app/shared/metis/metis.service';
import { COMMA, ENTER, TAB } from '@angular/cdk/keycodes';
import { FormControl } from '@angular/forms';
import { MatChipInputEvent } from '@angular/material/chips';
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
import { MatChipInputEvent, MatChipsModule } from '@angular/material/chips';
import { MatAutocompleteModule, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
import { faTimes } from '@fortawesome/free-solid-svg-icons';
import { ArtemisSharedModule } from 'app/shared/shared.module';
import { MatSelectModule } from '@angular/material/select';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatDialogModule } from '@angular/material/dialog';

@Component({
selector: 'jhi-post-tag-selector',
templateUrl: './post-tag-selector.component.html',
styleUrls: ['./post-tag-selector.component.scss'],
standalone: true,
imports: [MatChipsModule, MatAutocompleteModule, MatSelectModule, MatFormFieldModule, MatDialogModule, ArtemisSharedModule],
})
export class PostTagSelectorComponent implements OnInit, OnChanges, OnDestroy, AfterContentChecked {
@Input() postTags?: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { AnswerPostCreateEditModalComponent } from 'app/shared/metis/posting-cre
import { AnswerPost } from 'app/entities/metis/answer-post.model';
import dayjs from 'dayjs/esm';
import { User } from 'app/core/user/user.model';
import { AnswerPostComponent } from 'app/shared/metis/answer-post/answer-post.component';
import { ArtemisSharedModule } from 'app/shared/shared.module';

interface PostGroup {
author: User | undefined;
Expand All @@ -30,6 +32,8 @@ interface PostGroup {
selector: 'jhi-post-footer',
templateUrl: './post-footer.component.html',
styleUrls: ['./post-footer.component.scss'],
standalone: true,
imports: [AnswerPostCreateEditModalComponent, AnswerPostComponent, ArtemisSharedModule],
})
export class PostFooterComponent extends PostingFooterDirective<Post> implements OnInit, OnDestroy, AfterContentChecked, OnChanges {
@Input() lastReadDate?: dayjs.Dayjs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ import { AnswerPost } from 'app/entities/metis/answer-post.model';
import { PostingHeaderDirective } from 'app/shared/metis/posting-header/posting-header.directive';
import { faCheck, faPencilAlt } from '@fortawesome/free-solid-svg-icons';
import dayjs from 'dayjs/esm';
import { ProfilePictureComponent } from 'app/shared/profile-picture/profile-picture.component';
import { ArtemisSharedModule } from 'app/shared/shared.module';
import { EmojiPickerComponent } from 'app/shared/metis/emoji/emoji-picker.component';

@Component({
selector: 'jhi-answer-post-header',
templateUrl: './answer-post-header.component.html',
styleUrls: ['../../metis.component.scss'],
standalone: true,
imports: [ProfilePictureComponent, ArtemisSharedModule, EmojiPickerComponent],
})
export class AnswerPostHeaderComponent extends PostingHeaderDirective<AnswerPost> implements OnInit, OnChanges {
@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ import { PostCreateEditModalComponent } from 'app/shared/metis/posting-create-ed
import { faCheckSquare, faPencilAlt } from '@fortawesome/free-solid-svg-icons';
import dayjs from 'dayjs/esm';
import { CachingStrategy } from 'app/shared/image/secured-image.component';
import { ProfilePictureComponent } from 'app/shared/profile-picture/profile-picture.component';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { ArtemisSharedModule } from 'app/shared/shared.module';

@Component({
selector: 'jhi-post-header',
templateUrl: './post-header.component.html',
styleUrls: ['../../metis.component.scss'],
standalone: true,
imports: [ProfilePictureComponent, FontAwesomeModule, ArtemisSharedModule],
})
export class PostHeaderComponent extends PostingHeaderDirective<Post> implements OnInit, OnDestroy, OnChanges {
@Input()
Expand Down
Loading

0 comments on commit 1e24b87

Please sign in to comment.