mirror of
https://github.com/WowUp/WowUp.git
synced 2026-05-24 22:46:45 -04:00
Hook the tabs to the enable controls global
Fix the get-addons breaking bug
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "wowup",
|
||||
"productName": "WowUp",
|
||||
"version": "2.6.1-beta.1",
|
||||
"version": "2.6.1-beta.2",
|
||||
"description": "World of Warcraft addon updater",
|
||||
"homepage": "https://wowup.io",
|
||||
"author": {
|
||||
|
||||
@@ -30,7 +30,7 @@ export class GetAddonListItem {
|
||||
this.downloadCount = this.searchResult.downloadCount || 0;
|
||||
this.canonicalName = this.name.toLowerCase();
|
||||
|
||||
if (defaultAddonChannel) {
|
||||
if (defaultAddonChannel !== undefined) {
|
||||
const latestFile = SearchResults.getLatestFile(searchResult, defaultAddonChannel);
|
||||
this.latestAddonChannel = latestFile?.channelType ?? AddonChannelType.Stable;
|
||||
|
||||
|
||||
@@ -64,9 +64,10 @@ export class VerticalTabsComponent implements OnInit, OnDestroy {
|
||||
tooltipKey: "PAGES.HOME.MY_ADDONS_TAB_TITLE",
|
||||
icon: "fas:dice-d6",
|
||||
isSelected$: this.sessionService.selectedHomeTab$.pipe(map((result) => result === TAB_INDEX_MY_ADDONS)),
|
||||
isDisabled$: this._warcraftInstallationService.wowInstallations$.pipe(
|
||||
map((installations) => installations.length === 0)
|
||||
),
|
||||
isDisabled$: combineLatest([
|
||||
this._warcraftInstallationService.wowInstallations$,
|
||||
this.sessionService.enableControls$,
|
||||
]).pipe(map(([installations, enableControls]) => !enableControls || installations.length === 0)),
|
||||
onClick: (): void => {
|
||||
this.sessionService.selectedHomeTab = TAB_INDEX_MY_ADDONS;
|
||||
},
|
||||
@@ -77,9 +78,10 @@ export class VerticalTabsComponent implements OnInit, OnDestroy {
|
||||
tooltipKey: "PAGES.HOME.GET_ADDONS_TAB_TITLE",
|
||||
icon: "fas:search",
|
||||
isSelected$: this.sessionService.selectedHomeTab$.pipe(map((result) => result === TAB_INDEX_GET_ADDONS)),
|
||||
isDisabled$: this._warcraftInstallationService.wowInstallations$.pipe(
|
||||
map((installations) => installations.length === 0)
|
||||
),
|
||||
isDisabled$: combineLatest([
|
||||
this._warcraftInstallationService.wowInstallations$,
|
||||
this.sessionService.enableControls$,
|
||||
]).pipe(map(([installations, enableControls]) => !enableControls || installations.length === 0)),
|
||||
onClick: (): void => {
|
||||
this.sessionService.selectedHomeTab = TAB_INDEX_GET_ADDONS;
|
||||
},
|
||||
@@ -90,7 +92,7 @@ export class VerticalTabsComponent implements OnInit, OnDestroy {
|
||||
tooltipKey: "PAGES.HOME.ACCOUNT_TAB_TITLE",
|
||||
icon: "fas:user-circle",
|
||||
isSelected$: this.sessionService.selectedHomeTab$.pipe(map((result) => result === TAB_INDEX_ABOUT)),
|
||||
isDisabled$: of(false),
|
||||
isDisabled$: this.sessionService.enableControls$.pipe(map((enabled) => !enabled)),
|
||||
onClick: (): void => {
|
||||
this.sessionService.selectedHomeTab = TAB_INDEX_ABOUT;
|
||||
},
|
||||
@@ -102,7 +104,7 @@ export class VerticalTabsComponent implements OnInit, OnDestroy {
|
||||
icon: "fas:newspaper",
|
||||
badge: true,
|
||||
isSelected$: this.sessionService.selectedHomeTab$.pipe(map((result) => result === TAB_INDEX_NEWS)),
|
||||
isDisabled$: of(false),
|
||||
isDisabled$: this.sessionService.enableControls$.pipe(map((enabled) => !enabled)),
|
||||
onClick: (): void => {
|
||||
this.sessionService.selectedHomeTab = TAB_INDEX_NEWS;
|
||||
},
|
||||
@@ -113,7 +115,7 @@ export class VerticalTabsComponent implements OnInit, OnDestroy {
|
||||
tooltipKey: "PAGES.HOME.OPTIONS_TAB_TITLE",
|
||||
icon: "fas:cog",
|
||||
isSelected$: this.sessionService.selectedHomeTab$.pipe(map((result) => result === TAB_INDEX_SETTINGS)),
|
||||
isDisabled$: of(false),
|
||||
isDisabled$: this.sessionService.enableControls$.pipe(map((enabled) => !enabled)),
|
||||
onClick: (): void => {
|
||||
this.sessionService.selectedHomeTab = TAB_INDEX_SETTINGS;
|
||||
},
|
||||
|
||||
@@ -109,7 +109,8 @@ export class GetAddonsComponent implements OnInit, OnDestroy {
|
||||
];
|
||||
|
||||
public get defaultAddonChannel(): AddonChannelType | undefined {
|
||||
return this._sessionService.getSelectedWowInstallation()?.defaultAddonChannelType;
|
||||
const installation = this._sessionService.getSelectedWowInstallation();
|
||||
return installation?.defaultAddonChannelType ?? undefined;
|
||||
}
|
||||
|
||||
public query = "";
|
||||
@@ -290,7 +291,7 @@ export class GetAddonsComponent implements OnInit, OnDestroy {
|
||||
|
||||
public onRowDoubleClicked(evt: RowDoubleClickedEvent): void {
|
||||
const defaultChannel = this.defaultAddonChannel;
|
||||
if (!defaultChannel) {
|
||||
if (defaultChannel === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -580,7 +581,6 @@ export class GetAddonsComponent implements OnInit, OnDestroy {
|
||||
})
|
||||
)
|
||||
.subscribe((addons) => {
|
||||
console.debug(`Loaded ${addons?.length ?? 0} addons`);
|
||||
const listItems = this.formatAddons(addons);
|
||||
this._rowDataSrc.next(listItems);
|
||||
this._showTableSrc.next(true);
|
||||
|
||||
@@ -9,6 +9,9 @@ export class RelativeDurationPipe implements PipeTransform {
|
||||
public constructor(private _translate: TranslateService) {}
|
||||
|
||||
public transform(value: string): string {
|
||||
if (!value) {
|
||||
return "EMPTY";
|
||||
}
|
||||
const [fmt, val] = getRelativeDateFormat(value);
|
||||
return this._translate.instant(fmt, val);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user