Skip to content

Commit

Permalink
listmonk: remove
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelCoding committed Aug 22, 2024
1 parent 6c93d36 commit 2bb06c0
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 150 deletions.
15 changes: 0 additions & 15 deletions src/app/api/mailing-list.service.spec.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/app/api/mailing-list.service.ts

This file was deleted.

15 changes: 3 additions & 12 deletions src/app/core/mailing-list/mailing-list.component.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
<div class="typography">
<h2 i18n>Subscribe to the {{ listName }} mailing list</h2>
<form (submit)="$event.preventDefault();submit()" [formGroup]="form" class="form">
<feel-text-field formControlName="email" i18n-label label="E-Mail" type="text">
<feel-form-error *ngIf="form.controls?.['email']?.touched && !form.controls?.['email']?.valid" i18n>A valid
e-mail
is required!
</feel-form-error>
</feel-text-field>

<feel-button [disabled]="working || !form.valid" class="button" i18n-label label="Submit">
<app-icon-send/>
</feel-button>
</form>
<feel-button *ngIf="listId" class="button" i18n-label label="Submit" [link]='buildLink(listId)'>
<app-icon-send />
</feel-button>
</div>
53 changes: 8 additions & 45 deletions src/app/core/mailing-list/mailing-list.component.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
import {Component, Input} from '@angular/core';
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms'
import {CardComponent} from "../card/card.component";
import {CommonModule} from "@angular/common";
import {MailingListService} from "../../api/mailing-list.service";
import {ButtonComponent, FormErrorComponent, TextFieldComponent} from "@feel/form";
import {IconSendComponent} from "../../icons/icon-send/icon-send.component";
import {NotificationService} from "@feel/notification";
import { Component, Input } from '@angular/core';
import { CardComponent } from "../card/card.component";
import { CommonModule } from "@angular/common";
import { ButtonComponent } from "@feel/form";
import { IconSendComponent } from "../../icons/icon-send/icon-send.component";

@Component({
selector: 'app-mailing-list',
templateUrl: './mailing-list.component.html',
styleUrls: ['./mailing-list.component.scss'],
imports: [
CommonModule,
ReactiveFormsModule,
CardComponent,
TextFieldComponent,
ButtonComponent,
FormErrorComponent,
IconSendComponent,
],
standalone: true
Expand All @@ -27,40 +21,9 @@ export class MailingListComponent {
@Input()
public listName: string | null = null;
@Input()
public listId: number | null = null;
protected form = new FormGroup({
email: new FormControl(null, [Validators.required, Validators.email]),
});
protected working = false;
public listId: string | null = null;

constructor(
private readonly mailingListService: MailingListService,
private readonly notificationService: NotificationService,
) {
}

protected submit(): void {
if (!Number.isFinite(this.listId)) {
throw new Error("Mailing list not defined");
}

if (this.working || !this.form.valid) {
return;
}

const value = this.form.value;

this.working = true;
this.mailingListService.subscribe(this.listId!, value.email!)
.subscribe({
next: () => {
this.notificationService.success($localize`Successfully subscribed to mailing list.`);
},
error: err => {
console.error(err);
this.notificationService.error($localize`Failed to subscribe to mailing list.`);
},
complete: () => this.working = false,
});
protected buildLink(listId: string): string {
return `https://lists.dd-ix.net/postorius/lists/${listId}.lists.dd-ix.net/`;
}
}
12 changes: 0 additions & 12 deletions src/app/pages/blog/blog-subscribe/blog-subscribe.component.html

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions src/app/pages/blog/blog-subscribe/blog-subscribe.component.spec.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/app/pages/blog/blog-subscribe/blog-subscribe.component.ts

This file was deleted.

6 changes: 1 addition & 5 deletions src/app/pages/blog/blog.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ export const routes: Routes = [
path: '',
loadComponent: () => import("./blog-list/blog-list.component").then(c => c.BlogListComponent),
},
{
path: 'subscribe',
loadComponent: () => import("./blog-subscribe/blog-subscribe.component").then(c => c.BlogSubscribeComponent)
},
{
{
path: ':slug',
loadComponent: () => import("./blog-post/blog-post.component").then(c => c.BlogPostComponent)
},
Expand Down

0 comments on commit 2bb06c0

Please sign in to comment.