현재접속자 - 로그아웃버튼

This commit is contained in:
이담 정 2022-08-20 09:28:52 +00:00
parent 644940de26
commit aa2b2f6d6f
5 changed files with 141 additions and 1 deletions

View File

@ -150,6 +150,7 @@
mat-flat-button mat-flat-button
class="bet-mat-small-8" class="bet-mat-small-8"
[color]="'primary'" [color]="'primary'"
(click)="__onClickSignout($event)"
> >
로그아웃 로그아웃
</button> </button>

View File

@ -35,6 +35,7 @@ import { CurrentUserService } from '../services/current-user.service';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { MessageComposeComponent } from '../compose/message-compose.component'; import { MessageComposeComponent } from '../compose/message-compose.component';
import { SignoutComposeComponent } from '../compose/signout-compose.component';
@Component({ @Component({
selector: 'current-user-list', selector: 'current-user-list',
@ -242,6 +243,15 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
data: { price: '', memo: '' }, data: { price: '', memo: '' },
}); });
dialogRef.afterClosed().subscribe((result) => {
console.log('Compose dialog was closed!');
});
}
__onClickSignout(event: MouseEvent): void {
const dialogRef = this._matDialog.open(SignoutComposeComponent, {
data: { price: '', memo: '' },
});
dialogRef.afterClosed().subscribe((result) => { dialogRef.afterClosed().subscribe((result) => {
console.log('Compose dialog was closed!'); console.log('Compose dialog was closed!');
}); });

View File

@ -1,3 +1,4 @@
import { MessageComposeComponent } from './message-compose.component'; import { MessageComposeComponent } from './message-compose.component';
import { SignoutComposeComponent } from './signout-compose.component';
export const COMPOSE = [MessageComposeComponent]; export const COMPOSE = [MessageComposeComponent, SignoutComposeComponent];

View File

@ -0,0 +1,34 @@
<div class="flex flex-col max-w-240 md:min-w-160 max-h-screen -m-6">
<!-- Header -->
<div
class="flex flex-0 items-center justify-between h-16 pr-3 sm:pr-5 pl-6 sm:pl-8 bg-primary text-on-primary"
>
<div class="text-lg font-medium">알림</div>
<button mat-icon-button (click)="saveAndClose()" [tabIndex]="-1">
<mat-icon
class="text-current"
[svgIcon]="'heroicons_outline:x'"
></mat-icon>
</button>
</div>
<!-- Compose form -->
<form
class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto"
[formGroup]="composeForm"
>
<div>
<span class="font-semibold mb-2">로그아웃되었습니다.</span>
</div>
<div
class="flex flex-col sm:flex-row sm:items-center justify-between mt-4 sm:mt-6"
>
<div class="flex items-center mt-4 sm:mt-0">
<!-- Save as draft -->
<button class="sm:mx-3" mat-stroked-button (click)="saveAsDraft()">
<span>OK</span>
</button>
</div>
</div>
</form>
</div>

View File

@ -0,0 +1,94 @@
import {
ChangeDetectorRef,
Component,
Inject,
OnInit,
ViewEncapsulation,
} from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { SiteService } from 'app/modules/polyglot/site/services/site.service';
import { IdentityService } from 'app/modules/polyglot/identity/services/identity.service';
import { Site } from 'app/modules/proto/models/site_pb';
export interface SignoutComposeData {
price: string;
memo: string;
}
export interface SignoutComposeResult {
price: string;
memo: string;
}
@Component({
selector: 'app-signout-compose',
templateUrl: './signout-compose.component.html',
encapsulation: ViewEncapsulation.None,
})
export class SignoutComposeComponent implements OnInit {
composeForm!: FormGroup;
sites: any[] = [];
// quillModules: any = {
// toolbar: [
// ['bold', 'italic', 'underline'],
// [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
// ['clean'],
// ],
// };
/**
* Constructor
*/
constructor(
public matDialogRef: MatDialogRef<SignoutComposeComponent>,
@Inject(MAT_DIALOG_DATA) public data: SignoutComposeData,
private _formBuilder: FormBuilder,
private _identityService: IdentityService,
private _changeDetectorRef: ChangeDetectorRef
) {}
// -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks
// -----------------------------------------------------------------------------------------------------
/**
* On init
*/
ngOnInit(): void {
// Create the form
this.composeForm = this._formBuilder.group({
price: ['', [Validators.required]],
memo: ['', [Validators.required]],
});
}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Save and close
*/
saveAndClose(): void {
// Save the message as a draft
this.saveAsDraft();
// Close the dialog
this.matDialogRef.close();
}
/**
* Discard the message
*/
discard(): void {}
/**
* Save the message as a draft
*/
saveAsDraft(): void {}
/**
* Send the message
*/
send(): void {}
}