Commit ccbeb15b authored by Syntax_J's avatar Syntax_J

feat: format code & tweak style

parent 4ceb09eb
Pipeline #15008 canceled with stages
in 33 seconds
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "mycard",
"version": "3.1.0", "version": "3.1.0",
"dependencies": { "dependencies": {
"@electron/remote": "^2.0.1", "@electron/remote": "^2.0.1",
...@@ -305,7 +305,3 @@ form { ...@@ -305,7 +305,3 @@ form {
.btn-sm { .btn-sm {
margin-right: 4px; margin-right: 4px;
} }
#title-filter-username {
margin-left: 6px;
}
...@@ -287,9 +287,11 @@ ...@@ -287,9 +287,11 @@
</div> </div>
</th> </th>
<th class="title"> <th class="title">
<div class="d-flex"> <div class="row">
<span i18n class="align-self-end">游戏标题</span> <span i18n class="col-auto align-self-end">游戏标题</span>
<input i18n-placeholder type="text" class="col-sm-6 form-control form-control-sm" id="title-filter-username" placeholder="支持玩家名称搜索房间" [(ngModel)]="replay_rooms_filter.username" (ngModelChange)="title_username_change_handler($event)" /> <div class="col-sm-6">
<input i18n-placeholder type="text" class="form-control form-control-sm" id="title-filter-username" placeholder="支持玩家名称搜索房间" [(ngModel)]="replay_rooms_filter.username" (ngModelChange)="titleUsernameChangeHandler($event)" />
</div>
</div> </div>
</th> </th>
<th i18n class="users">玩家</th> <th i18n class="users">玩家</th>
......
...@@ -231,7 +231,7 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit, OnChan ...@@ -231,7 +231,7 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit, OnChan
match_interval: Timer | undefined; match_interval: Timer | undefined;
join_password: string; join_password: string;
host_password = (this.loginService.user.external_id ^ 0x54321).toString(); host_password = (this.loginService.user.external_id ^ 0x54321).toString();
title_username_change_handler = _.debounce(this.title_username_change, 500); titleUsernameChangeHandler = _.debounce(this.titleUsernameChange, 500);
@ViewChild('gameListModal') @ViewChild('gameListModal')
gameListModal: ElementRef<HTMLElement>; gameListModal: ElementRef<HTMLElement>;
...@@ -331,31 +331,31 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit, OnChan ...@@ -331,31 +331,31 @@ export class YGOProComponent implements OnInit, OnDestroy, AfterViewInit, OnChan
return a_priority - b_priority; return a_priority - b_priority;
}); });
if (this.replay_rooms_filter.username.length > 0) { if (this.replay_rooms_filter.username.length > 0) {
this.handle_filter_username(); this.handleFilterUsername();
} }
} }
handle_filter_username() { handleFilterUsername() {
const filter_username = this.replay_rooms_filter.username.toLowerCase().trim(); const filterUserName = this.replay_rooms_filter.username.toLowerCase().trim();
if (filter_username === '') return; if (filterUserName === '') return;
let username_filter_rooms: Room[] = []; let usernameFilterRooms: Room[] = [];
this.replay_rooms_show.forEach(room => { this.replay_rooms_show.forEach(room => {
const [user_a, user_b] = room.users!; const [userAlpha, userBeta] = room.users!;
const user_a_name = (user_a && user_a.username.toLowerCase()) || ''; const userAlphaName = (userAlpha && userAlpha.username.toLowerCase()) || '';
const user_b_name = (user_b && user_b.username.toLowerCase()) || ''; const userBetaName = (userBeta && userBeta.username.toLowerCase()) || '';
if (user_a_name !== '' || user_b_name !== '') { if (userAlphaName !== '' || userBetaName !== '') {
const targetStr = `${user_a_name}/${user_b_name}`; const targetStr = `${userAlphaName}/${userBetaName}`;
if (targetStr.includes(filter_username)) { if (targetStr.includes(filterUserName)) {
username_filter_rooms.push(room); usernameFilterRooms.push(room);
} }
} }
}); });
this.replay_rooms_show = username_filter_rooms; this.replay_rooms_show = usernameFilterRooms;
} }
title_username_change(input_value: string) { titleUsernameChange(inputValue: string) {
if (input_value.length) { if (inputValue.length) {
this.handle_filter_username(); this.handleFilterUsername();
} else { } else {
this.refresh_replay_rooms(); this.refresh_replay_rooms();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment