Skip to content

Commit

Permalink
Merge pull request #2021 from candela97/refactor-communityutils
Browse files Browse the repository at this point in the history
Export `CommunityUtils` as default export; remove unused method
  • Loading branch information
tfedor authored Aug 23, 2024
2 parents 2d75125 + 237e101 commit cf827e5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/js/Content/Features/Community/Badges/CBadges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FCardExchangeLinks from "../FCardExchangeLinks";
import FBadgeSortAndFilter from "./FBadgeSortAndFilter";
import FBadgeCalculations from "./FBadgeCalculations";
import ContextType from "@Content/Modules/Context/ContextType";
import {CommunityUtils} from "@Content/Modules/Community/CommunityUtils";
import CommunityUtils from "@Content/Modules/Community/CommunityUtils";
import DOMHelper from "@Content/Modules/DOMHelper";
import RequestData from "@Content/Modules/RequestData";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FGroupsManageButton from "./FGroupsManageButton";
import FGroupsSort from "./FGroupsSort";
import FFriendsAppendNickname from "./FFriendsAppendNickname";
import ContextType from "@Content/Modules/Context/ContextType";
import {CommunityUtils} from "@Content/Modules/Community/CommunityUtils";
import CommunityUtils from "@Content/Modules/Community/CommunityUtils";
import HTML from "@Core/Html/Html";
import DOMHelper from "@Content/Modules/DOMHelper";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import CurrencyManager from "@Content/Modules/Currency/CurrencyManager";
import AugmentedSteamApiFacade from "@Content/Modules/Facades/AugmentedSteamApiFacade";
import Price from "@Content/Modules/Currency/Price";
import HTML from "@Core/Html/Html";
import {CommunityUtils} from "@Content/Modules/Community/CommunityUtils";
import CommunityUtils from "@Content/Modules/Community/CommunityUtils";
import DOMHelper from "@Content/Modules/DOMHelper";

export default class FCardMarketLinks extends Feature<CGameCard> {
Expand Down
2 changes: 1 addition & 1 deletion src/js/Content/Features/Community/Inventory/CInventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import FShowMarketOverview from "./FShowMarketOverview";
import FInventoryGoTo from "./FInventoryGoTo";
import FPriceHistoryZoomYear from "../FPriceHistoryZoomYear";
import ContextType from "@Content/Modules/Context/ContextType";
import {CommunityUtils} from "@Content/Modules/Community/CommunityUtils";
import CommunityUtils from "@Content/Modules/Community/CommunityUtils";
import DOMHelper from "@Content/Modules/DOMHelper";
import ASEventHandler from "@Content/Modules/ASEventHandler";

Expand Down
19 changes: 2 additions & 17 deletions src/js/Content/Modules/Community/CommunityUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import User from "../User";

export class CommunityUtils {
export default class CommunityUtils {

static currentUserIsOwner(): boolean {
if (!User.isSignedIn) {
Expand All @@ -12,26 +12,11 @@ export class CommunityUtils {
return false;
}

let profileLink = profileLinkNode.href
let profileLink = profileLinkNode.href;
if (!profileLink.endsWith("/")) {
profileLink += "/";
}

return profileLink === User.profileUrl;
}

static makeProfileLink(id: string, link: string, name: string, iconType: string, iconUrl: string): string {
const mainType = iconUrl ? "none" : iconType;
let html = `<div class="es_profile_link profile_count_link">
<a class="es_sites_icons es_${id}_icon es_${mainType}" href="${link}" target="_blank">`;

if (iconType !== "none" && iconUrl) {
html += `<i class="es_sites_custom_icon es_${iconType}" style="background-image: url('${iconUrl}');"></i>`;
}

html += `<span class="count_link_label">${name}</span>
<span class="profile_count_link_total">&nbsp;</span></a></div>`; // Steam spacing

return html;
}
}

0 comments on commit cf827e5

Please sign in to comment.