Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SQL query API in item spotlight page #179

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions src/app/objects/whats-cool-items/whats-cool-items.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,38 @@
</ul>
<section>
<h2>What's cool: Item Spotlight</h2>
<section *ngIf="$list | async; let list; else loading">
<lux-gate-version-toc [list]="list | paramset:'gate_version' | as_array"></lux-gate-version-toc>
<section *ngIf="'
select
gate_version,
itemID,
icon_asset,
description_en_US as description
from
WhatsCoolItemSpotlight w
join ComponentsRegistry c on c.id = w.itemID
join RenderComponent r on r.id = c.component_id
where
component_type = 2
order by w.id
' | query | group:'gate_version';
let groups;
else loading">
<lux-gate-version-toc [list]="groups | keyset | as_array"></lux-gate-version-toc>

<section [id]="v.key | toc:'fg'" *ngFor="let v of list | group:'gate_version' | keys">
<section [id]="v.key | toc:'fg'" *ngFor="let v of groups | keys">
<h3 *ngIf="v.key === ''">No Feature Gate</h3>
<h3 *ngIf="v.key !== ''">Feature Gate <small><lux-gate-version-tag [gate_version]="v.key"
[float]="false"></lux-gate-version-tag></small>
</h3>
<div class="item" *ngFor="let item of v.value">
<div class="item" *ngFor="let row of v.value">
<span class="left">
<lux-slot [luxFetchItem]="item.itemID"></lux-slot>
<lux-slot link="/objects/{{row.itemID}}" [icon]="row.icon_asset | icon" [luxItemTooltip]="row.itemID"></lux-slot>
</span>
<blockquote class="cool">{{(loc(item.id) | async).description}}</blockquote>
<blockquote class="cool" luxTooltip="description">{{row.description}}</blockquote>
</div>
</section>
</section>
<ng-template #loading>
Loading&ell;
Loading&mldr;
</ng-template>
</section>
</section>
26 changes: 2 additions & 24 deletions src/app/objects/whats-cool-items/whats-cool-items.component.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { DB_WhatsCoolItemSpotlight } from '../../../defs/cdclient';
import { Locale_WhatsCoolItemSpotlight } from '../../../defs/locale';
import { LuCoreDataService } from '../../util/services/lu-core-data.service';
import { Component } from '@angular/core';

@Component({
selector: 'lux-whats-cool-items',
templateUrl: './whats-cool-items.component.html',
styleUrls: ['./whats-cool-items.component.css']
})
export class WhatsCoolItemsComponent implements OnInit {

$list: Observable<DB_WhatsCoolItemSpotlight[]>;
$loc: Observable<{ [key: string]: Locale_WhatsCoolItemSpotlight }>;

constructor(private luCoreData: LuCoreDataService) { }

ngOnInit(): void {
const TABLE = "WhatsCoolItemSpotlight";
this.$list = this.luCoreData.getTableEntry(TABLE, 'all');
this.$loc = this.luCoreData.getLocaleSubtree<Locale_WhatsCoolItemSpotlight>(TABLE);
}

loc(key: number): Observable<Locale_WhatsCoolItemSpotlight> {
return this.$loc.pipe(map(x => { return x[String(key)]; }));
}

}
export class WhatsCoolItemsComponent {}
Loading