Update dependencies, eslint, fix formatting, etc

This commit is contained in:
Bill 2024-06-20 21:13:06 -04:00
parent 2cd999b614
commit 0db9e4ad45
552 changed files with 1600 additions and 1603 deletions

View File

@ -7,7 +7,7 @@
"start": "vite", "start": "vite",
"build": "vite build", "build": "vite build",
"build:prod": "npx browserslist@latest --update-db && yarn build", "build:prod": "npx browserslist@latest --update-db && yarn build",
"eslint": "eslint src --ext .ts,.tsx" "eslint": "eslint ./src"
}, },
"dependencies": { "dependencies": {
"@tanstack/react-virtual": "3.5.1", "@tanstack/react-virtual": "3.5.1",
@ -16,6 +16,7 @@
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-icons": "^5.2.1", "react-icons": "^5.2.1",
"react-slider": "^2.0.6", "react-slider": "^2.0.6",
"react-transition-group": "^4.4.5",
"react-youtube": "^7.13.1", "react-youtube": "^7.13.1",
"use-between": "^1.3.5" "use-between": "^1.3.5"
}, },

View File

@ -85,11 +85,11 @@ export const App: FC<{}> = props =>
{ {
NitroLogger.error(err); NitroLogger.error(err);
} }
} };
prepare(window.innerWidth, window.innerHeight); prepare(window.innerWidth, window.innerHeight);
}, []); }, []);
return ( return (
<Base fit overflow="hidden" className={ !(window.devicePixelRatio % 1) && 'image-rendering-pixelated' }> <Base fit overflow="hidden" className={ !(window.devicePixelRatio % 1) && 'image-rendering-pixelated' }>
{ !isReady && { !isReady &&
@ -98,4 +98,4 @@ export const App: FC<{}> = props =>
<Base id="draggable-windows-container" /> <Base id="draggable-windows-container" />
</Base> </Base>
); );
} };

View File

@ -7,91 +7,91 @@ export class AchievementUtilities
public static getAchievementBadgeCode(achievement: AchievementData): string public static getAchievementBadgeCode(achievement: AchievementData): string
{ {
if(!achievement) return null; if(!achievement) return null;
let badgeId = achievement.badgeId; let badgeId = achievement.badgeId;
if(!achievement.finalLevel) badgeId = GetLocalizationManager().getPreviousLevelBadgeId(badgeId); if(!achievement.finalLevel) badgeId = GetLocalizationManager().getPreviousLevelBadgeId(badgeId);
return badgeId; return badgeId;
} }
public static getAchievementCategoryImageUrl(category: IAchievementCategory, progress: number = null, icon: boolean = false): string public static getAchievementCategoryImageUrl(category: IAchievementCategory, progress: number = null, icon: boolean = false): string
{ {
const imageUrl = GetConfigurationValue<string>('achievements.images.url'); const imageUrl = GetConfigurationValue<string>('achievements.images.url');
let imageName = icon ? 'achicon_' : 'achcategory_'; let imageName = icon ? 'achicon_' : 'achcategory_';
imageName += category.code; imageName += category.code;
if(progress !== null) imageName += `_${ ((progress > 0) ? 'active' : 'inactive') }`; if(progress !== null) imageName += `_${ ((progress > 0) ? 'active' : 'inactive') }`;
return imageUrl.replace('%image%', imageName); return imageUrl.replace('%image%', imageName);
} }
public static getAchievementCategoryMaxProgress(category: IAchievementCategory): number public static getAchievementCategoryMaxProgress(category: IAchievementCategory): number
{ {
if(!category) return 0; if(!category) return 0;
let progress = 0; let progress = 0;
for(const achievement of category.achievements) for(const achievement of category.achievements)
{ {
progress += achievement.levelCount; progress += achievement.levelCount;
} }
return progress; return progress;
} }
public static getAchievementCategoryProgress(category: IAchievementCategory): number public static getAchievementCategoryProgress(category: IAchievementCategory): number
{ {
if(!category) return 0; if(!category) return 0;
let progress = 0; let progress = 0;
for(const achievement of category.achievements) progress += (achievement.finalLevel ? achievement.level : (achievement.level - 1)); for(const achievement of category.achievements) progress += (achievement.finalLevel ? achievement.level : (achievement.level - 1));
return progress; return progress;
} }
public static getAchievementCategoryTotalUnseen(category: IAchievementCategory): number public static getAchievementCategoryTotalUnseen(category: IAchievementCategory): number
{ {
if(!category) return 0; if(!category) return 0;
let unseen = 0; let unseen = 0;
for(const achievement of category.achievements) ((achievement.unseen > 0) && unseen++); for(const achievement of category.achievements) ((achievement.unseen > 0) && unseen++);
return unseen; return unseen;
} }
public static getAchievementHasStarted(achievement: AchievementData): boolean public static getAchievementHasStarted(achievement: AchievementData): boolean
{ {
if(!achievement) return false; if(!achievement) return false;
if(achievement.finalLevel || ((achievement.level - 1) > 0)) return true; if(achievement.finalLevel || ((achievement.level - 1) > 0)) return true;
return false; return false;
} }
public static getAchievementIsIgnored(achievement: AchievementData): boolean public static getAchievementIsIgnored(achievement: AchievementData): boolean
{ {
if(!achievement) return false; if(!achievement) return false;
const ignored = GetConfigurationValue<string[]>('achievements.unseen.ignored'); const ignored = GetConfigurationValue<string[]>('achievements.unseen.ignored');
const value = achievement.badgeId.replace(/[0-9]/g, ''); const value = achievement.badgeId.replace(/[0-9]/g, '');
const index = ignored.indexOf(value); const index = ignored.indexOf(value);
if(index >= 0) return true; if(index >= 0) return true;
return false; return false;
} }
public static getAchievementLevel(achievement: AchievementData): number public static getAchievementLevel(achievement: AchievementData): number
{ {
if(!achievement) return 0; if(!achievement) return 0;
if(achievement.finalLevel) return achievement.level; if(achievement.finalLevel) return achievement.level;
return (achievement.level - 1); return (achievement.level - 1);
} }
} }

View File

@ -14,4 +14,4 @@ export const AvatarEditorColorSorter = (a: IPartColor, b: IPartColor) =>
if(a.index > b.index) return 1; if(a.index > b.index) return 1;
return 0; return 0;
} };

View File

@ -31,5 +31,5 @@ export const AvatarEditorPartSorter = (hcFirst: boolean) =>
if(a.partSet.id > b.partSet.id) return 1; if(a.partSet.id > b.partSet.id) return 1;
return 0; return 0;
} };
} };

View File

@ -104,7 +104,7 @@ export class AvatarEditorThumbnailsHelper
} }
return container; return container;
} };
return new Promise(async (resolve, reject) => return new Promise(async (resolve, reject) =>
{ {
@ -116,7 +116,7 @@ export class AvatarEditorThumbnailsHelper
AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl); AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl);
resolve(imageUrl); resolve(imageUrl);
} };
const figureContainer = GetAvatarRenderManager().createFigureContainer(`${ setType }-${ part.partSet.id }`); const figureContainer = GetAvatarRenderManager().createFigureContainer(`${ setType }-${ part.partSet.id }`);
@ -164,11 +164,11 @@ export class AvatarEditorThumbnailsHelper
sprite.destroy(); sprite.destroy();
avatarImage.dispose(); avatarImage.dispose();
AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl); AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl);
resolve(imageUrl); resolve(imageUrl);
} };
resetFigure(figureString); resetFigure(figureString);
}); });

View File

@ -4,6 +4,6 @@ export class CameraPicture
{ {
constructor( constructor(
public texture: NitroTexture, public texture: NitroTexture,
public imageUrl: string) public imageUrl: string)
{} {}
} }

View File

@ -2,6 +2,6 @@ export class CameraPictureThumbnail
{ {
constructor( constructor(
public effectName: string, public effectName: string,
public thumbnailUrl: string) public thumbnailUrl: string)
{} {}
} }

View File

@ -1,7 +1,7 @@
import { NodeData } from '@nitrots/nitro-renderer'; import { NodeData } from '@nitrots/nitro-renderer';
import { ICatalogNode } from './ICatalogNode'; import { ICatalogNode } from './ICatalogNode';
export class CatalogNode implements ICatalogNode export class CatalogNode implements ICatalogNode
{ {
private _depth: number = 0; private _depth: number = 0;
private _localization: string = ''; private _localization: string = '';

View File

@ -1,4 +1,4 @@
export class CatalogPageName export class CatalogPageName
{ {
public static DUCKET_INFO: string = 'ducket_info'; public static DUCKET_INFO: string = 'ducket_info';
public static CREDITS: string = 'credits'; public static CREDITS: string = 'credits';

View File

@ -5,6 +5,6 @@ export class CatalogPetPalette
constructor( constructor(
public readonly breed: string, public readonly breed: string,
public readonly palettes: SellablePetPaletteData[] public readonly palettes: SellablePetPaletteData[]
) )
{} {}
} }

View File

@ -4,12 +4,12 @@ import { ICatalogNode } from './ICatalogNode';
export const GetPixelEffectIcon = (id: number) => export const GetPixelEffectIcon = (id: number) =>
{ {
return ''; return '';
} };
export const GetSubscriptionProductIcon = (id: number) => export const GetSubscriptionProductIcon = (id: number) =>
{ {
return ''; return '';
} };
export const GetOfferNodes = (offerNodes: Map<number, ICatalogNode[]>, offerId: number) => export const GetOfferNodes = (offerNodes: Map<number, ICatalogNode[]>, offerId: number) =>
{ {
@ -21,20 +21,20 @@ export const GetOfferNodes = (offerNodes: Map<number, ICatalogNode[]>, offerId:
for(const node of nodes) for(const node of nodes)
{ {
if(!node.isVisible) continue; if(!node.isVisible) continue;
allowedNodes.push(node); allowedNodes.push(node);
} }
} }
return allowedNodes; return allowedNodes;
} };
export const FilterCatalogNode = (search: string, furniLines: string[], node: ICatalogNode, nodes: ICatalogNode[]) => export const FilterCatalogNode = (search: string, furniLines: string[], node: ICatalogNode, nodes: ICatalogNode[]) =>
{ {
if(node.isVisible && (node.pageId > 0)) if(node.isVisible && (node.pageId > 0))
{ {
let nodeAdded = false; let nodeAdded = false;
const hayStack = [ node.pageName, node.localization ].join(' ').toLowerCase().replace(/ /gi, ''); const hayStack = [ node.pageName, node.localization ].join(' ').toLowerCase().replace(/ /gi, '');
if(hayStack.indexOf(search) > -1) if(hayStack.indexOf(search) > -1)
@ -59,7 +59,7 @@ export const FilterCatalogNode = (search: string, furniLines: string[], node: IC
} }
for(const child of node.children) FilterCatalogNode(search, furniLines, child, nodes); for(const child of node.children) FilterCatalogNode(search, furniLines, child, nodes);
} };
export function GetPetIndexFromLocalization(localization: string) export function GetPetIndexFromLocalization(localization: string)
{ {

View File

@ -16,4 +16,4 @@ export const GetImageIconUrlForProduct = (productType: string, productClassId: n
} }
return imageUrl; return imageUrl;
} };

View File

@ -1,4 +1,4 @@
export interface ICatalogNode export interface ICatalogNode
{ {
activate(): void; activate(): void;
deactivate(): void; deactivate(): void;

View File

@ -1,4 +1,4 @@
export class MarketPlaceOfferState export class MarketPlaceOfferState
{ {
public static readonly ONGOING = 1; public static readonly ONGOING = 1;
public static readonly ONGOING_OWN = 1; public static readonly ONGOING_OWN = 1;

View File

@ -60,7 +60,7 @@ export class Offer implements IPurchasableOffer
public activate(): void public activate(): void
{ {
} }
public get clubLevel(): number public get clubLevel(): number
@ -228,7 +228,7 @@ export class Offer implements IPurchasableOffer
{ {
const products: IProduct[] = []; const products: IProduct[] = [];
const productData = GetProductDataForLocalization(this.localizationId); const productData = GetProductDataForLocalization(this.localizationId);
for(const product of this._products) for(const product of this._products)
{ {
const furnitureData = GetFurnitureData(product.productClassId, product.productType); const furnitureData = GetFurnitureData(product.productClassId, product.productType);

View File

@ -4,7 +4,7 @@ import { IPageLocalization } from './IPageLocalization';
export class PageLocalization implements IPageLocalization export class PageLocalization implements IPageLocalization
{ {
private _images: string[]; private _images: string[];
private _texts: string[] private _texts: string[];
constructor(images: string[], texts: string[]) constructor(images: string[], texts: string[])
{ {

View File

@ -11,7 +11,7 @@ export class PlacedObjectPurchaseData
public readonly x: number, public readonly x: number,
public readonly y: number, public readonly y: number,
public readonly direction: number, public readonly direction: number,
public readonly offer: IPurchasableOffer) public readonly offer: IPurchasableOffer)
{} {}
public get offerId(): number public get offerId(): number

View File

@ -1,4 +1,4 @@
export class RequestedPage export class RequestedPage
{ {
public static REQUEST_TYPE_NONE: number = 0; public static REQUEST_TYPE_NONE: number = 0;
public static REQUEST_TYPE_ID: number = 1; public static REQUEST_TYPE_ID: number = 1;

View File

@ -6,6 +6,6 @@ export class SearchResult
constructor( constructor(
public readonly searchValue: string, public readonly searchValue: string,
public readonly offers: IPurchasableOffer[], public readonly offers: IPurchasableOffer[],
public readonly filteredNodes: ICatalogNode[]) public readonly filteredNodes: ICatalogNode[])
{} {}
} }

View File

@ -3,4 +3,4 @@ export const ChatHistoryCurrentDate = () =>
const currentTime = new Date(); const currentTime = new Date();
return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`; return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`;
} };

View File

@ -1,6 +1,6 @@
export const MessengerHistoryCurrentDate = (secondsSinceNow: number = 0) => export const MessengerHistoryCurrentDate = (secondsSinceNow: number = 0) =>
{ {
const currentTime = secondsSinceNow ? new Date(Date.now() - secondsSinceNow * 1000) : new Date(); const currentTime = secondsSinceNow ? new Date(Date.now() - secondsSinceNow * 1000) : new Date();
return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`; return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`;
} };

View File

@ -3,11 +3,11 @@ import { IGroupChatData } from './IGroupChatData';
export const GetGroupChatData = (extraData: string) => export const GetGroupChatData = (extraData: string) =>
{ {
if(!extraData || !extraData.length) return null; if(!extraData || !extraData.length) return null;
const splitData = extraData.split('/'); const splitData = extraData.split('/');
const username = splitData[0]; const username = splitData[0];
const figure = splitData[1]; const figure = splitData[1];
const userId = parseInt(splitData[2]); const userId = parseInt(splitData[2]);
return ({ username: username, figure: figure, userId: userId } as IGroupChatData); return ({ username: username, figure: figure, userId: userId } as IGroupChatData);
} };

View File

@ -6,6 +6,6 @@ export class MessengerSettings
public userFriendLimit: number = 0, public userFriendLimit: number = 0,
public normalFriendLimit: number = 0, public normalFriendLimit: number = 0,
public extendedFriendLimit: number = 0, public extendedFriendLimit: number = 0,
public categories: FriendCategoryData[] = []) public categories: FriendCategoryData[] = [])
{} {}
} }

View File

@ -40,7 +40,7 @@ export class MessengerThread
group.addChat(chat); group.addChat(chat);
this._lastUpdated = new Date(); this._lastUpdated = new Date();
this._unreadCount++; this._unreadCount++;
return chat; return chat;

View File

@ -19,7 +19,7 @@ export class GroupBadgePart
public get code(): string public get code(): string
{ {
if((this.key === 0) && (this.type !== GroupBadgePart.BASE)) return null; if((this.key === 0) && (this.type !== GroupBadgePart.BASE)) return null;
return GroupBadgePart.getCode(this.type, this.key, this.color, this.position); return GroupBadgePart.getCode(this.type, this.key, this.color, this.position);
} }

View File

@ -1,4 +1,4 @@
export class GroupType export class GroupType
{ {
public static REGULAR: number = 0; public static REGULAR: number = 0;
public static EXCLUSIVE: number = 1; public static EXCLUSIVE: number = 1;

View File

@ -4,4 +4,4 @@ import { SendMessageComposer } from '../nitro';
export const ToggleFavoriteGroup = (group: HabboGroupEntryData) => export const ToggleFavoriteGroup = (group: HabboGroupEntryData) =>
{ {
SendMessageComposer(group.favourite ? new GroupUnfavoriteComposer(group.groupId) : new GroupFavoriteComposer(group.groupId)); SendMessageComposer(group.favourite ? new GroupUnfavoriteComposer(group.groupId) : new GroupFavoriteComposer(group.groupId));
} };

View File

@ -2,7 +2,7 @@ export class GuideToolMessage
{ {
private _message: string; private _message: string;
private _roomId: number; private _roomId: number;
constructor(message: string, roomId?: number) constructor(message: string, roomId?: number)
{ {
this._message = message; this._message = message;

View File

@ -1,4 +1,4 @@
export class ClubStatus export class ClubStatus
{ {
public static ACTIVE: string = 'active'; public static ACTIVE: string = 'active';
public static NONE: string = 'none'; public static NONE: string = 'none';

View File

@ -8,4 +8,4 @@ export const GetClubBadge = (badgeCodes: string[]) =>
BADGES.forEach(badge => ((badgeCodes.indexOf(badge) > -1) && (badgeCode = badge))); BADGES.forEach(badge => ((badgeCodes.indexOf(badge) > -1) && (badgeCode = badge)));
return (badgeCode || DEFAULT_BADGE); return (badgeCode || DEFAULT_BADGE);
} };

View File

@ -5,4 +5,4 @@ export const GetCloseReasonKey = (code: number) =>
if(code === 2) return 'abusive'; if(code === 2) return 'abusive';
return 'resolved'; return 'resolved';
} };

View File

@ -29,7 +29,7 @@ export class FurnitureItem implements IFurnitureItem
constructor(parser: IFurnitureItemData) constructor(parser: IFurnitureItemData)
{ {
if(!parser) return; if(!parser) return;
this._locked = false; this._locked = false;
this._id = parser.itemId; this._id = parser.itemId;
this._type = parser.spriteId; this._type = parser.spriteId;

View File

@ -35,7 +35,7 @@ const addSingleFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: b
} }
return groupItem; return groupItem;
} };
const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: boolean) => const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: boolean) =>
{ {
@ -85,7 +85,7 @@ const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen
const index = set.indexOf(existingGroup); const index = set.indexOf(existingGroup);
if(index >= 0) set.splice(index, 1); if(index >= 0) set.splice(index, 1);
set.unshift(existingGroup); set.unshift(existingGroup);
} }
@ -108,7 +108,7 @@ const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen
} }
return existingGroup; return existingGroup;
} };
export const addFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: boolean) => export const addFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: boolean) =>
{ {
@ -120,7 +120,7 @@ export const addFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen:
{ {
addGroupableFurnitureItem(set, item, unseen); addGroupableFurnitureItem(set, item, unseen);
} }
} };
export const mergeFurniFragments = (fragment: Map<number, FurnitureListItemParser>, totalFragments: number, fragmentNumber: number, fragments: Map<number, FurnitureListItemParser>[]) => export const mergeFurniFragments = (fragment: Map<number, FurnitureListItemParser>, totalFragments: number, fragmentNumber: number, fragments: Map<number, FurnitureListItemParser>[]) =>
{ {
@ -145,7 +145,7 @@ export const mergeFurniFragments = (fragment: Map<number, FurnitureListItemParse
fragments = null; fragments = null;
return merged; return merged;
} };
export const getAllItemIds = (groupItems: GroupItem[]) => export const getAllItemIds = (groupItems: GroupItem[]) =>
{ {
@ -168,4 +168,4 @@ export const getAllItemIds = (groupItems: GroupItem[]) =>
} }
return itemIds; return itemIds;
} };

View File

@ -19,12 +19,12 @@ export const setPlacingItemId = (id: number) => (itemIdInPlacing = id);
export const cancelRoomObjectPlacement = () => export const cancelRoomObjectPlacement = () =>
{ {
if(getPlacingItemId() === -1) return; if(getPlacingItemId() === -1) return;
GetRoomEngine().cancelRoomObjectPlacement(); GetRoomEngine().cancelRoomObjectPlacement();
setPlacingItemId(-1); setPlacingItemId(-1);
setObjectMoverRequested(false); setObjectMoverRequested(false);
} };
export const attemptPetPlacement = (petItem: IPetItem, flag: boolean = false) => export const attemptPetPlacement = (petItem: IPetItem, flag: boolean = false) =>
{ {
@ -47,7 +47,7 @@ export const attemptPetPlacement = (petItem: IPetItem, flag: boolean = false) =>
} }
return true; return true;
} };
export const attemptItemPlacement = (groupItem: GroupItem, flag: boolean = false) => export const attemptItemPlacement = (groupItem: GroupItem, flag: boolean = false) =>
{ {
@ -92,7 +92,7 @@ export const attemptItemPlacement = (groupItem: GroupItem, flag: boolean = false
} }
return true; return true;
} };
export const attemptBotPlacement = (botItem: IBotItem, flag: boolean = false) => export const attemptBotPlacement = (botItem: IBotItem, flag: boolean = false) =>
@ -114,4 +114,4 @@ export const attemptBotPlacement = (botItem: IBotItem, flag: boolean = false) =>
} }
return true; return true;
} };

View File

@ -12,7 +12,7 @@ export const addSinglePetItem = (petData: PetData, set: IPetItem[], unseen: bool
if(unseen) if(unseen)
{ {
//petItem.isUnseen = true; //petItem.isUnseen = true;
set.unshift(petItem); set.unshift(petItem);
} }
else else
@ -21,7 +21,7 @@ export const addSinglePetItem = (petData: PetData, set: IPetItem[], unseen: bool
} }
return petItem; return petItem;
} };
export const removePetItemById = (id: number, set: IPetItem[]) => export const removePetItemById = (id: number, set: IPetItem[]) =>
{ {
@ -39,7 +39,7 @@ export const removePetItemById = (id: number, set: IPetItem[]) =>
CreateLinkEvent('inventory/open'); CreateLinkEvent('inventory/open');
} }
set.splice(index, 1); set.splice(index, 1);
return petItem; return petItem;
@ -49,7 +49,7 @@ export const removePetItemById = (id: number, set: IPetItem[]) =>
} }
return null; return null;
} };
export const processPetFragment = (set: IPetItem[], fragment: Map<number, PetData>, isUnseen: (category: number, itemId: number) => boolean) => export const processPetFragment = (set: IPetItem[], fragment: Map<number, PetData>, isUnseen: (category: number, itemId: number) => boolean) =>
{ {
@ -75,7 +75,7 @@ export const processPetFragment = (set: IPetItem[], fragment: Map<number, PetDat
} }
return set; return set;
} };
export const mergePetFragments = (fragment: Map<number, PetData>, totalFragments: number, fragmentNumber: number, fragments: Map<number, PetData>[]) => export const mergePetFragments = (fragment: Map<number, PetData>, totalFragments: number, fragmentNumber: number, fragments: Map<number, PetData>[]) =>
{ {
@ -100,4 +100,4 @@ export const mergePetFragments = (fragment: Map<number, PetData>, totalFragments
fragments = null; fragments = null;
return merged; return merged;
} };

View File

@ -10,6 +10,6 @@ export class TradeUserData
public itemCount: number = 0, public itemCount: number = 0,
public creditsCount: number = 0, public creditsCount: number = 0,
public accepts: boolean = false, public accepts: boolean = false,
public canTrade: boolean = false) public canTrade: boolean = false)
{} {}
} }

View File

@ -17,39 +17,39 @@ export const parseTradeItems = (items: ItemDataStructure[]) =>
{ {
const spriteId = item.spriteId; const spriteId = item.spriteId;
const category = item.category; const category = item.category;
let name = (item.furniType + spriteId); let name = (item.furniType + spriteId);
if(!item.isGroupable || isExternalImage(spriteId)) if(!item.isGroupable || isExternalImage(spriteId))
{ {
name = ('itemid' + item.itemId); name = ('itemid' + item.itemId);
} }
if(item.category === FurniCategory.POSTER) if(item.category === FurniCategory.POSTER)
{ {
name = (item.itemId + 'poster' + item.stuffData.getLegacyString()); name = (item.itemId + 'poster' + item.stuffData.getLegacyString());
} }
else if(item.category === FurniCategory.GUILD_FURNI) else if(item.category === FurniCategory.GUILD_FURNI)
{ {
name = ''; name = '';
} }
let groupItem = ((item.isGroupable && !isExternalImage(item.spriteId)) ? existingItems.getValue(name) : null); let groupItem = ((item.isGroupable && !isExternalImage(item.spriteId)) ? existingItems.getValue(name) : null);
if(!groupItem) if(!groupItem)
{ {
groupItem = createGroupItem(spriteId, category, item.stuffData); groupItem = createGroupItem(spriteId, category, item.stuffData);
existingItems.add(name, groupItem); existingItems.add(name, groupItem);
} }
groupItem.push(new FurnitureItem(item)); groupItem.push(new FurnitureItem(item));
} }
} }
return existingItems; return existingItems;
} };
export const getGuildFurniType = (spriteId: number, stuffData: IObjectData) => export const getGuildFurniType = (spriteId: number, stuffData: IObjectData) =>
{ {
@ -67,4 +67,4 @@ export const getGuildFurniType = (spriteId: number, stuffData: IObjectData) =>
} }
return type; return type;
} };

View File

@ -32,4 +32,4 @@ export const GetIssueCategoryName = (categoryId: number) =>
} }
return 'Unknown'; return 'Unknown';
} };

View File

@ -5,6 +5,6 @@ const BuildMaxVisitorsList = () =>
for(let i = 10; i <= 100; i = i + 10) list.push(i); for(let i = 10; i <= 100; i = i + 10) list.push(i);
return list; return list;
} };
export const GetMaxVisitorsList = BuildMaxVisitorsList(); export const GetMaxVisitorsList = BuildMaxVisitorsList();

View File

@ -1,6 +1,6 @@
import { GetConfiguration } from '@nitrots/nitro-renderer'; import { GetConfiguration } from '@nitrots/nitro-renderer';
export function GetConfigurationValue<T>(key: string, value: T = null): T export function GetConfigurationValue<T = string>(key: string, value: T = null): T
{ {
return GetConfiguration().getValue(key, value); return GetConfiguration().getValue(key, value);
} }

View File

@ -3,7 +3,7 @@ import { CreateLinkEvent, HabboWebTools } from '@nitrots/nitro-renderer';
export const OpenUrl = (url: string) => export const OpenUrl = (url: string) =>
{ {
if(!url || !url.length) return; if(!url || !url.length) return;
if(url.startsWith('http')) if(url.startsWith('http'))
{ {
HabboWebTools.openWebPage(url); HabboWebTools.openWebPage(url);
@ -12,4 +12,4 @@ export const OpenUrl = (url: string) =>
{ {
CreateLinkEvent(url); CreateLinkEvent(url);
} }
} };

View File

@ -49,6 +49,6 @@ export const DispatchMouseEvent = (event: MouseEvent, canvasId: number = 1) =>
break; break;
default: return; default: return;
} }
GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, event.altKey, (event.ctrlKey || event.metaKey), event.shiftKey, false); GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, event.altKey, (event.ctrlKey || event.metaKey), event.shiftKey, false);
} };

View File

@ -20,7 +20,7 @@ export const DispatchTouchEvent = (event: TouchEvent, canvasId: number = 1, long
x = event.changedTouches[0].clientX; x = event.changedTouches[0].clientX;
y = event.changedTouches[0].clientY; y = event.changedTouches[0].clientY;
} }
let eventType = event.type; let eventType = event.type;
if(longTouch) eventType = TouchEventType.TOUCH_LONG; if(longTouch) eventType = TouchEventType.TOUCH_LONG;
@ -53,7 +53,7 @@ export const DispatchTouchEvent = (event: TouchEvent, canvasId: number = 1, long
break; break;
case MouseEventType.DOUBLE_CLICK: case MouseEventType.DOUBLE_CLICK:
break; break;
case TouchEventType.TOUCH_START: case TouchEventType.TOUCH_START:
eventType = MouseEventType.MOUSE_DOWN; eventType = MouseEventType.MOUSE_DOWN;
didMouseMove = false; didMouseMove = false;
@ -72,10 +72,10 @@ export const DispatchTouchEvent = (event: TouchEvent, canvasId: number = 1, long
default: return; default: return;
} }
if (eventType === TouchEventType.TOUCH_START) if (eventType === TouchEventType.TOUCH_START)
{ {
GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, altKey, ctrlKey, shiftKey, false); GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, altKey, ctrlKey, shiftKey, false);
} }
GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, altKey, ctrlKey, shiftKey, false); GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, altKey, ctrlKey, shiftKey, false);
} };

View File

@ -10,4 +10,4 @@ export const GetRoomObjectBounds = (roomId: number, objectId: number, category:
rectangle.y = Math.round(rectangle.y); rectangle.y = Math.round(rectangle.y);
return rectangle; return rectangle;
} };

View File

@ -10,4 +10,4 @@ export const GetRoomObjectScreenLocation = (roomId: number, objectId: number, ca
point.y = Math.round(point.y); point.y = Math.round(point.y);
return point; return point;
} };

View File

@ -6,4 +6,4 @@ export const InitializeRoomInstanceRenderingCanvas = (width: number, height: num
const roomId = roomEngine.activeRoomId; const roomId = roomEngine.activeRoomId;
roomEngine.initializeRoomInstanceRenderingCanvas(roomId, canvasId, width, height); roomEngine.initializeRoomInstanceRenderingCanvas(roomId, canvasId, width, height);
} };

View File

@ -6,8 +6,8 @@ export function GetCanStandUp(): string
const roomObject = GetOwnRoomObject(); const roomObject = GetOwnRoomObject();
if(!roomObject) return AvatarAction.POSTURE_STAND; if(!roomObject) return AvatarAction.POSTURE_STAND;
const model = roomObject.model; const model = roomObject.model;
return model.getValue<string>(RoomObjectVariable.FIGURE_CAN_STAND_UP); return model.getValue<string>(RoomObjectVariable.FIGURE_CAN_STAND_UP);
} }

View File

@ -6,7 +6,7 @@ export function GetCanUseExpression(): boolean
const roomObject = GetOwnRoomObject(); const roomObject = GetOwnRoomObject();
if(!roomObject) return false; if(!roomObject) return false;
const model = roomObject.model; const model = roomObject.model;
const effectId = model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT); const effectId = model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT);

View File

@ -4,6 +4,6 @@ import { GetConfigurationValue } from '../GetConfigurationValue';
export function GetClubMemberLevel(): number export function GetClubMemberLevel(): number
{ {
if(GetConfigurationValue<boolean>('hc.disabled', false)) return HabboClubLevelEnum.VIP; if(GetConfigurationValue<boolean>('hc.disabled', false)) return HabboClubLevelEnum.VIP;
return GetSessionDataManager().clubLevel; return GetSessionDataManager().clubLevel;
} }

View File

@ -6,7 +6,7 @@ export function GetFurnitureDataForProductOffer(offer: CatalogPageMessageProduct
let furniData: IFurnitureData = null; let furniData: IFurnitureData = null;
switch((offer.productType.toUpperCase())) switch(offer.productType)
{ {
case FurnitureType.FLOOR: case FurnitureType.FLOOR:
furniData = GetSessionDataManager().getFloorItemData(offer.furniClassId); furniData = GetSessionDataManager().getFloorItemData(offer.furniClassId);

View File

@ -6,8 +6,8 @@ export function GetOwnPosture(): string
const roomObject = GetOwnRoomObject(); const roomObject = GetOwnRoomObject();
if(!roomObject) return AvatarAction.POSTURE_STAND; if(!roomObject) return AvatarAction.POSTURE_STAND;
const model = roomObject.model; const model = roomObject.model;
return model.getValue<string>(RoomObjectVariable.FIGURE_POSTURE); return model.getValue<string>(RoomObjectVariable.FIGURE_POSTURE);
} }

View File

@ -6,9 +6,9 @@ export function IsRidingHorse(): boolean
const roomObject = GetOwnRoomObject(); const roomObject = GetOwnRoomObject();
if(!roomObject) return false; if(!roomObject) return false;
const model = roomObject.model; const model = roomObject.model;
const effectId = model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT); const effectId = model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT);
return (effectId === 77); return (effectId === 77);
} }

View File

@ -8,4 +8,4 @@ export const VisitDesktop = () =>
GoToDesktop(); GoToDesktop();
GetRoomSessionManager().removeSession(-1); GetRoomSessionManager().removeSession(-1);
} };

View File

@ -1,4 +1,4 @@
export class NotificationBubbleType export class NotificationBubbleType
{ {
public static FRIENDOFFLINE: string = 'friendoffline'; public static FRIENDOFFLINE: string = 'friendoffline';
public static FRIENDONLINE: string = 'friendonline'; public static FRIENDONLINE: string = 'friendonline';

View File

@ -39,7 +39,7 @@ export class AvatarInfoUser implements IAvatarInfo
public targetRoomControllerLevel: number = 0; public targetRoomControllerLevel: number = 0;
public isAmbassador: boolean = false; public isAmbassador: boolean = false;
constructor(public readonly type: string) constructor(public readonly type: string)
{} {}
public get isOwnUser(): boolean public get isOwnUser(): boolean

View File

@ -398,7 +398,7 @@ export class AvatarInfoUtilities
default: default:
return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER); return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER);
} }
} };
return this.isValidSetting(userInfo, checkSetting); return this.isValidSetting(userInfo, checkSetting);
} }
@ -416,7 +416,7 @@ export class AvatarInfoUtilities
default: default:
return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER); return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER);
} }
} };
return this.isValidSetting(userInfo, checkSetting); return this.isValidSetting(userInfo, checkSetting);
} }
@ -432,7 +432,7 @@ export class AvatarInfoUtilities
default: default:
return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER); return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER);
} }
} };
return this.isValidSetting(userInfo, checkSetting); return this.isValidSetting(userInfo, checkSetting);
} }

View File

@ -10,7 +10,7 @@ export class ChatBubbleMessage
private _top: number = 0; private _top: number = 0;
private _left: number = 0; private _left: number = 0;
constructor( constructor(
public senderId: number = -1, public senderId: number = -1,
public senderCategory: number = -1, public senderCategory: number = -1,
@ -23,7 +23,7 @@ export class ChatBubbleMessage
public styleId: number = 0, public styleId: number = 0,
public imageUrl: string = null, public imageUrl: string = null,
public color: string = null public color: string = null
) )
{ {
this.id = ++ChatBubbleMessage.BUBBLE_COUNTER; this.id = ++ChatBubbleMessage.BUBBLE_COUNTER;
} }

View File

@ -12,7 +12,7 @@ export class ChatBubbleUtilities
{ {
const avatarImage = GetAvatarRenderManager().createAvatarImage(figure, AvatarScaleType.LARGE, null, { const avatarImage = GetAvatarRenderManager().createAvatarImage(figure, AvatarScaleType.LARGE, null, {
resetFigure: figure => this.setFigureImage(figure), resetFigure: figure => this.setFigureImage(figure),
dispose: () => dispose: () =>
{}, {},
disposed: false disposed: false
}); });

View File

@ -4,6 +4,6 @@ export class DimmerFurnitureWidgetPresetItem
public id: number = 0, public id: number = 0,
public type: number = 0, public type: number = 0,
public color: number = 0, public color: number = 0,
public light: number = 0) public light: number = 0)
{} {}
} }

View File

@ -3,5 +3,4 @@ import { ChatBubbleMessage } from './ChatBubbleMessage';
export const DoChatsOverlap = (a: ChatBubbleMessage, b: ChatBubbleMessage, additionalBTop: number, padding: number = 0) => export const DoChatsOverlap = (a: ChatBubbleMessage, b: ChatBubbleMessage, additionalBTop: number, padding: number = 0) =>
{ {
return !((((a.left + padding) + a.width) < (b.left + padding)) || ((a.left + padding) > ((b.left + padding) + b.width)) || ((a.top + a.height) < (b.top + additionalBTop)) || (a.top > ((b.top + additionalBTop) + b.height))); return !((((a.left + padding) + a.width) < (b.left + padding)) || ((a.left + padding) > ((b.left + padding) + b.width)) || ((a.top + a.height) < (b.top + additionalBTop)) || (a.top > ((b.top + additionalBTop) + b.height)));
} };

View File

@ -34,4 +34,4 @@ export const GetDiskColor = (name: string) =>
b = ((b % DISK_COLOR_BLUE_RANGE) + DISK_COLOR_BLUE_MIN); b = ((b % DISK_COLOR_BLUE_RANGE) + DISK_COLOR_BLUE_MIN);
return `rgb(${ r },${ g },${ b })`; return `rgb(${ r },${ g },${ b })`;
} };

View File

@ -29,10 +29,10 @@ export class MannequinUtilities
for(const part of figureContainer.getPartTypeIds()) for(const part of figureContainer.getPartTypeIds())
{ {
if(this.MANNEQUIN_CLOTHING_PART_TYPES.indexOf(part) >= 0) continue; if(this.MANNEQUIN_CLOTHING_PART_TYPES.indexOf(part) >= 0) continue;
figureContainer.removePart(part); figureContainer.removePart(part);
} }
figureContainer.updatePart((this.MANNEQUIN_FIGURE[0] as string), (this.MANNEQUIN_FIGURE[1] as number), (this.MANNEQUIN_FIGURE[2] as number[])); figureContainer.updatePart((this.MANNEQUIN_FIGURE[0] as string), (this.MANNEQUIN_FIGURE[1] as number), (this.MANNEQUIN_FIGURE[2] as number[]));
}; };
} }

View File

@ -1,4 +1,4 @@
export class YoutubeVideoPlaybackStateEnum export class YoutubeVideoPlaybackStateEnum
{ {
public static readonly UNSTARTED = -1; public static readonly UNSTARTED = -1;
public static readonly ENDED = 0; public static readonly ENDED = 0;

View File

@ -11,4 +11,4 @@ export const CloneObject = <T>(object: T): T =>
} }
return copy; return copy;
} };

View File

@ -30,7 +30,7 @@ export class ColorUtils
*/ */
public static int_to_8BitVals(value: number): [number, number, number, number] public static int_to_8BitVals(value: number): [number, number, number, number]
{ {
const val1 = ((value >> 24) & 0xFF) const val1 = ((value >> 24) & 0xFF);
const val2 = ((value >> 16) & 0xFF); const val2 = ((value >> 16) & 0xFF);
const val3 = ((value >> 8) & 0xFF); const val3 = ((value >> 8) & 0xFF);
const val4 = (value & 0xFF); const val4 = (value & 0xFF);

View File

@ -6,4 +6,4 @@ export const ConvertSeconds = (seconds: number) =>
let numSeconds = ((seconds % 86400) % 3600) % 60; let numSeconds = ((seconds % 86400) % 3600) % 60;
return numDays.toString().padStart(2, '0') + ':' + numHours.toString().padStart(2, '0') + ':' + numMinutes.toString().padStart(2, '0') + ':' + numSeconds.toString().padStart(2, '0'); return numDays.toString().padStart(2, '0') + ':' + numHours.toString().padStart(2, '0') + ':' + numMinutes.toString().padStart(2, '0') + ':' + numSeconds.toString().padStart(2, '0');
} };

View File

@ -2,10 +2,10 @@ export const GetLocalStorage = <T>(key: string) =>
{ {
try try
{ {
JSON.parse(window.localStorage.getItem(key)) as T ?? null JSON.parse(window.localStorage.getItem(key)) as T ?? null;
} }
catch(e) catch(e)
{ {
return null; return null;
} }
} };

View File

@ -7,4 +7,4 @@ export const LocalizeBadgeDescription = (key: string) =>
if(!badgeDesc || !badgeDesc.length) badgeDesc = `badge_desc_${ key }`; if(!badgeDesc || !badgeDesc.length) badgeDesc = `badge_desc_${ key }`;
return badgeDesc; return badgeDesc;
} };

View File

@ -7,4 +7,4 @@ export const LocalizeBadgeName = (key: string) =>
if(!badgeName || !badgeName.length) badgeName = `badge_name_${ key }`; if(!badgeName || !badgeName.length) badgeName = `badge_name_${ key }`;
return badgeName; return badgeName;
} };

View File

@ -8,7 +8,7 @@ export const PlaySound = (sampleCode: string) =>
if(!canPlaySound) return; if(!canPlaySound) return;
DispatchMainEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sampleCode)); DispatchMainEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sampleCode));
} };
const eventTypes = [ MouseEventType.MOUSE_CLICK ]; const eventTypes = [ MouseEventType.MOUSE_CLICK ];
@ -19,6 +19,6 @@ const startListening = () =>
const onEvent = (event: Event) => ((canPlaySound = true) && stopListening()); const onEvent = (event: Event) => ((canPlaySound = true) && stopListening());
eventTypes.forEach(type => window.addEventListener(type, onEvent)); eventTypes.forEach(type => window.addEventListener(type, onEvent));
} };
startListening(); startListening();

View File

@ -1,19 +1,19 @@
import { CatalogPageMessageProductData, GetRoomEngine } from '@nitrots/nitro-renderer'; import { FurnitureType, GetRoomEngine } from '@nitrots/nitro-renderer';
import { FurniCategory } from '../inventory'; import { FurniCategory } from '../inventory';
export class ProductImageUtility export class ProductImageUtility
{ {
public static getProductImageUrl(productType: string, furniClassId: number, extraParam: string): string public static getProductImageUrl(productType: FurnitureType, furniClassId: number, extraParam: string): string
{ {
let imageUrl: string = null; let imageUrl: string = null;
switch(productType) switch(productType)
{ {
case CatalogPageMessageProductData.S: case FurnitureType.FLOOR:
imageUrl = GetRoomEngine().getFurnitureFloorIconUrl(furniClassId); imageUrl = GetRoomEngine().getFurnitureFloorIconUrl(furniClassId);
break; break;
case CatalogPageMessageProductData.I: case FurnitureType.WALL:
const productCategory = this.getProductCategory(CatalogPageMessageProductData.I, furniClassId); const productCategory = this.getProductCategory(FurnitureType.WALL, furniClassId);
if(productCategory === 1) if(productCategory === 1)
{ {
@ -32,7 +32,7 @@ export class ProductImageUtility
} }
} }
break; break;
case CatalogPageMessageProductData.E: case FurnitureType.EFFECT:
// fx_icon_furniClassId_png // fx_icon_furniClassId_png
break; break;
} }
@ -40,11 +40,11 @@ export class ProductImageUtility
return imageUrl; return imageUrl;
} }
public static getProductCategory(productType: string, furniClassId: number): number public static getProductCategory(productType: FurnitureType, furniClassId: number): number
{ {
if(productType === CatalogPageMessageProductData.S) return 1; if(productType === FurnitureType.FLOOR) return 1;
if(productType === CatalogPageMessageProductData.I) if(productType === FurnitureType.WALL)
{ {
if(furniClassId === 3001) return FurniCategory.WALL_PAPER; if(furniClassId === 3001) return FurniCategory.WALL_PAPER;

View File

@ -35,7 +35,7 @@ const encodeHTML = (str: string) =>
return full; return full;
}); });
} };
export const RoomChatFormatter = (content: string) => export const RoomChatFormatter = (content: string) =>
{ {
@ -72,4 +72,4 @@ export const RoomChatFormatter = (content: string) =>
} }
return result; return result;
} };

View File

@ -5,4 +5,4 @@ export const GetWiredTimeLocale = (value: number) =>
if(!(value % 2)) return time.toString(); if(!(value % 2)) return time.toString();
return (time + 0.5).toString(); return (time + 0.5).toString();
} };

View File

@ -16,7 +16,7 @@ export const AutoGrid: FC<AutoGridProps> = props =>
let newStyle: CSSProperties = {}; let newStyle: CSSProperties = {};
newStyle['--nitro-grid-column-min-height'] = (columnMinHeight + 'px'); newStyle['--nitro-grid-column-min-height'] = (columnMinHeight + 'px');
if(columnCount > 1) newStyle.gridTemplateColumns = `repeat(auto-fill, minmax(${ columnMinWidth }px, 1fr))`; if(columnCount > 1) newStyle.gridTemplateColumns = `repeat(auto-fill, minmax(${ columnMinWidth }px, 1fr))`;
if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; if(Object.keys(style).length) newStyle = { ...newStyle, ...style };
@ -25,4 +25,4 @@ export const AutoGrid: FC<AutoGridProps> = props =>
}, [ columnMinWidth, columnMinHeight, columnCount, style ]); }, [ columnMinWidth, columnMinHeight, columnCount, style ]);
return <Grid columnCount={ columnCount } fullHeight={ fullHeight } overflow={ overflow } style={ getStyle } { ...rest } />; return <Grid columnCount={ columnCount } fullHeight={ fullHeight } overflow={ overflow } style={ getStyle } { ...rest } />;
} };

View File

@ -75,10 +75,10 @@ export const Base: FC<BaseProps<HTMLDivElement>> = props =>
return newStyle; return newStyle;
}, [ style ]); }, [ style ]);
return ( return (
<div ref={ innerRef } className={ getClassName } style={ getStyle } { ...rest }> <div ref={ innerRef } className={ getClassName } style={ getStyle } { ...rest }>
{ children } { children }
</div> </div>
); );
} };

View File

@ -32,4 +32,4 @@ export const Button: FC<ButtonProps> = props =>
}, [ variant, size, active, disabled, classNames ]); }, [ variant, size, active, disabled, classNames ]);
return <Flex center classNames={ getClassNames } { ...rest } />; return <Flex center classNames={ getClassNames } { ...rest } />;
} };

View File

@ -19,4 +19,4 @@ export const ButtonGroup: FC<ButtonGroupProps> = props =>
}, [ classNames ]); }, [ classNames ]);
return <Base classNames={ getClassNames } { ...rest } />; return <Base classNames={ getClassNames } { ...rest } />;
} };

View File

@ -43,4 +43,4 @@ export const Column: FC<ColumnProps> = props =>
}, [ size, offset, isCssGrid, classNames ]); }, [ size, offset, isCssGrid, classNames ]);
return <Flex classNames={ getClassNames } column={ column } gap={ gap } { ...rest } />; return <Flex classNames={ getClassNames } column={ column } gap={ gap } { ...rest } />;
} };

View File

@ -47,4 +47,4 @@ export const Flex: FC<FlexProps> = props =>
}, [ column, reverse, gap, center, alignSelf, alignItems, justifyContent, classNames ]); }, [ column, reverse, gap, center, alignSelf, alignItems, justifyContent, classNames ]);
return <Base display={ display } classNames={ getClassNames } { ...rest } />; return <Base display={ display } classNames={ getClassNames } { ...rest } />;
} };

View File

@ -19,4 +19,4 @@ export const FormGroup: FC<FormGroupProps> = props =>
}, [ classNames ]); }, [ classNames ]);
return <Flex classNames={ getClassNames } { ...rest } />; return <Flex classNames={ getClassNames } { ...rest } />;
} };

View File

@ -60,4 +60,4 @@ export const Grid: FC<GridProps> = props =>
<Base fullHeight={ fullHeight } classNames={ getClassNames } style={ getStyle } { ...rest } /> <Base fullHeight={ fullHeight } classNames={ getClassNames } style={ getStyle } { ...rest } />
</GridContextProvider> </GridContextProvider>
); );
} };

View File

@ -11,7 +11,7 @@ const GridContext = createContext<IGridContext>({
export const GridContextProvider: FC<ProviderProps<IGridContext>> = props => export const GridContextProvider: FC<ProviderProps<IGridContext>> = props =>
{ {
return <GridContext.Provider value={ props.value }>{ props.children }</GridContext.Provider> return <GridContext.Provider value={ props.value }>{ props.children }</GridContext.Provider>;
} };
export const useGridContext = () => useContext(GridContext); export const useGridContext = () => useContext(GridContext);

View File

@ -35,4 +35,4 @@ export const HorizontalRule: FC<HorizontalRuleProps> = props =>
}, [ height, style ]); }, [ height, style ]);
return <Base classNames={ getClassNames } style={ getStyle } { ...rest } />; return <Base classNames={ getClassNames } style={ getStyle } { ...rest } />;
} };

View File

@ -62,7 +62,7 @@ export const InfiniteGrid: FC<InfiniteGridProps> = props =>
minHeight: virtualRow.index === 0 ? estimateSize : virtualRow.size, minHeight: virtualRow.index === 0 ? estimateSize : virtualRow.size,
gridTemplateColumns: `repeat(${ columnCount }, 1fr)` gridTemplateColumns: `repeat(${ columnCount }, 1fr)`
} }> } }>
{ Array.from(Array(columnCount)).map((e,i) => { Array.from(Array(columnCount)).map((e,i) =>
{ {
const item = rows[i + (virtualRow.index * columnCount)]; const item = rows[i + (virtualRow.index * columnCount)];
@ -81,4 +81,4 @@ export const InfiniteGrid: FC<InfiniteGridProps> = props =>
</div> </div>
</Base> </Base>
); );
} };

View File

@ -52,4 +52,4 @@ export const InfiniteScroll: FC<InfiniteScrollProps> = props =>
</div> </div>
</Base> </Base>
); );
} };

View File

@ -60,4 +60,4 @@ export const Text: FC<TextProps> = props =>
}, [ variant, fontWeight, fontSize, align, bold, underline, italics, truncate, center, textEnd, small, wrap, noWrap, textBreak ]); }, [ variant, fontWeight, fontSize, align, bold, underline, italics, truncate, center, textEnd, small, wrap, noWrap, textBreak ]);
return <Base classNames={ getClassNames } { ...rest } />; return <Base classNames={ getClassNames } { ...rest } />;
} };

View File

@ -15,4 +15,4 @@ export const NitroCardContentView: FC<ColumnProps> = props =>
}, [ classNames ]); }, [ classNames ]);
return <Column classNames={ getClassNames } overflow={ overflow } { ...rest } />; return <Column classNames={ getClassNames } overflow={ overflow } { ...rest } />;
} };

View File

@ -11,7 +11,7 @@ const NitroCardContext = createContext<INitroCardContext>({
export const NitroCardContextProvider: FC<ProviderProps<INitroCardContext>> = props => export const NitroCardContextProvider: FC<ProviderProps<INitroCardContext>> = props =>
{ {
return <NitroCardContext.Provider value={ props.value }>{ props.children }</NitroCardContext.Provider> return <NitroCardContext.Provider value={ props.value }>{ props.children }</NitroCardContext.Provider>;
} };
export const useNitroCardContext = () => useContext(NitroCardContext); export const useNitroCardContext = () => useContext(NitroCardContext);

View File

@ -28,7 +28,7 @@ export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
{ {
event.stopPropagation(); event.stopPropagation();
event.nativeEvent.stopImmediatePropagation(); event.nativeEvent.stopImmediatePropagation();
} };
return ( return (
<Column center position="relative" classNames={ getClassNames } { ...rest }> <Column center position="relative" classNames={ getClassNames } { ...rest }>
@ -45,4 +45,4 @@ export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
</Flex> </Flex>
</Column> </Column>
); );
} };

View File

@ -20,4 +20,4 @@ export const NitroCardSubHeaderView: FC<NitroCardSubHeaderProps> = props =>
}, [ classNames, variant ]); }, [ classNames, variant ]);
return <Flex justifyContent={ justifyContent } classNames={ getClassNames } { ...rest } />; return <Flex justifyContent={ justifyContent } classNames={ getClassNames } { ...rest } />;
} };

View File

@ -31,4 +31,4 @@ export const NitroCardView: FC<NitroCardViewProps> = props =>
</DraggableWindow> </DraggableWindow>
</NitroCardContextProvider> </NitroCardContextProvider>
); );
} };

View File

@ -16,6 +16,6 @@ const NitroCardAccordionContext = createContext<INitroCardAccordionContext>({
export const NitroCardAccordionContextProvider: FC<ProviderProps<INitroCardAccordionContext>> = props => export const NitroCardAccordionContextProvider: FC<ProviderProps<INitroCardAccordionContext>> = props =>
{ {
return <NitroCardAccordionContext.Provider { ...props } />; return <NitroCardAccordionContext.Provider { ...props } />;
} };
export const useNitroCardAccordionContext = () => useContext(NitroCardAccordionContext); export const useNitroCardAccordionContext = () => useContext(NitroCardAccordionContext);

View File

@ -15,4 +15,4 @@ export const NitroCardAccordionItemView: FC<NitroCardAccordionItemViewProps> = p
{ children } { children }
</Flex> </Flex>
); );
} };

View File

@ -18,9 +18,9 @@ export const NitroCardAccordionSetView: FC<NitroCardAccordionSetViewProps> = pro
const onClick = () => const onClick = () =>
{ {
closeAll(); closeAll();
setIsOpen(prevValue => !prevValue); setIsOpen(prevValue => !prevValue);
} };
const onClose = useCallback(() => setIsOpen(false), []); const onClose = useCallback(() => setIsOpen(false), []);
@ -62,10 +62,10 @@ export const NitroCardAccordionSetView: FC<NitroCardAccordionSetViewProps> = pro
const index = newClosers.indexOf(closeFunction); const index = newClosers.indexOf(closeFunction);
if(index >= 0) newClosers.splice(index, 1); if(index >= 0) newClosers.splice(index, 1);
return newClosers; return newClosers;
}); });
} };
}, [ onClose, setClosers ]); }, [ onClose, setClosers ]);
return ( return (
@ -81,4 +81,4 @@ export const NitroCardAccordionSetView: FC<NitroCardAccordionSetViewProps> = pro
</Column> } </Column> }
</Column> </Column>
); );
} };

View File

@ -4,7 +4,7 @@ import { NitroCardAccordionContextProvider } from './NitroCardAccordionContext';
interface NitroCardAccordionViewProps extends ColumnProps interface NitroCardAccordionViewProps extends ColumnProps
{ {
} }
export const NitroCardAccordionView: FC<NitroCardAccordionViewProps> = props => export const NitroCardAccordionView: FC<NitroCardAccordionViewProps> = props =>
@ -22,4 +22,4 @@ export const NitroCardAccordionView: FC<NitroCardAccordionViewProps> = props =>
<Column gap={ 0 } { ...rest } /> <Column gap={ 0 } { ...rest } />
</NitroCardAccordionContextProvider> </NitroCardAccordionContextProvider>
); );
} };

View File

@ -32,4 +32,4 @@ export const NitroCardTabsItemView: FC<NitroCardTabsItemViewProps> = props =>
<LayoutItemCountView count={ count } /> } <LayoutItemCountView count={ count } /> }
</Flex> </Flex>
); );
} };

View File

@ -19,4 +19,4 @@ export const NitroCardTabsView: FC<FlexProps> = props =>
{ children } { children }
</Flex> </Flex>
); );
} };

View File

@ -107,7 +107,7 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
const completeDrag = useCallback(() => const completeDrag = useCallback(() =>
{ {
if(!elementRef.current || !dragHandler) return; if(!elementRef.current || !dragHandler) return;
let offsetX = (offset.x + delta.x); let offsetX = (offset.x + delta.x);
let offsetY = (offset.y + delta.y); let offsetY = (offset.y + delta.y);
@ -170,7 +170,7 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
if(!disableDrag) if(!disableDrag)
{ {
const handle = (element.querySelector(handleSelector) as HTMLElement); const handle = (element.querySelector(handleSelector));
if(handle) setDragHandler(handle); if(handle) setDragHandler(handle);
} }
@ -202,13 +202,13 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
const index = CURRENT_WINDOWS.indexOf(element); const index = CURRENT_WINDOWS.indexOf(element);
if(index >= 0) CURRENT_WINDOWS.splice(index, 1); if(index >= 0) CURRENT_WINDOWS.splice(index, 1);
} };
}, [ handleSelector, windowPosition, uniqueKey, disableDrag, offsetLeft, offsetTop, bringToTop ]); }, [ handleSelector, windowPosition, uniqueKey, disableDrag, offsetLeft, offsetTop, bringToTop ]);
useEffect(() => useEffect(() =>
{ {
if(!offset && !delta) return; if(!offset && !delta) return;
const element = (elementRef.current as HTMLElement); const element = (elementRef.current as HTMLElement);
if(!element) return; if(!element) return;
@ -228,7 +228,7 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
{ {
dragHandler.removeEventListener(MouseEventType.MOUSE_DOWN, onDragMouseDown); dragHandler.removeEventListener(MouseEventType.MOUSE_DOWN, onDragMouseDown);
dragHandler.removeEventListener(TouchEventType.TOUCH_START, onTouchDown); dragHandler.removeEventListener(TouchEventType.TOUCH_START, onTouchDown);
} };
}, [ dragHandler, onDragMouseDown, onTouchDown ]); }, [ dragHandler, onDragMouseDown, onTouchDown ]);
useEffect(() => useEffect(() =>
@ -246,7 +246,7 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
document.removeEventListener(TouchEventType.TOUCH_END, onDragTouchUp); document.removeEventListener(TouchEventType.TOUCH_END, onDragTouchUp);
document.removeEventListener(MouseEventType.MOUSE_MOVE, onDragMouseMove); document.removeEventListener(MouseEventType.MOUSE_MOVE, onDragMouseMove);
document.removeEventListener(TouchEventType.TOUCH_MOVE, onDragTouchMove); document.removeEventListener(TouchEventType.TOUCH_MOVE, onDragTouchMove);
} };
}, [ isDragging, onDragMouseUp, onDragMouseMove, onDragTouchUp, onDragTouchMove ]); }, [ isDragging, onDragMouseUp, onDragMouseMove, onDragTouchUp, onDragTouchMove ]);
useEffect(() => useEffect(() =>
@ -267,4 +267,4 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
{ children } { children }
</Base>, document.getElementById('draggable-windows-container')) </Base>, document.getElementById('draggable-windows-container'))
); );
} };

View File

@ -62,7 +62,7 @@ export const LayoutAvatarImageView: FC<LayoutAvatarImageViewProps> = props =>
const resetFigure = (_figure: string) => const resetFigure = (_figure: string) =>
{ {
if(isDisposed.current) return; if(isDisposed.current) return;
const avatarImage = GetAvatarRenderManager().createAvatarImage(_figure, AvatarScaleType.LARGE, gender, { resetFigure: (figure: string) => resetFigure(figure), dispose: null, disposed: false }); const avatarImage = GetAvatarRenderManager().createAvatarImage(_figure, AvatarScaleType.LARGE, gender, { resetFigure: (figure: string) => resetFigure(figure), dispose: null, disposed: false });
let setType = AvatarSetType.FULL; let setType = AvatarSetType.FULL;
@ -80,8 +80,8 @@ export const LayoutAvatarImageView: FC<LayoutAvatarImageViewProps> = props =>
setAvatarUrl(imageUrl); setAvatarUrl(imageUrl);
} }
avatarImage.dispose(true); avatarImage.dispose();
} };
resetFigure(figure); resetFigure(figure);
} }
@ -90,14 +90,14 @@ export const LayoutAvatarImageView: FC<LayoutAvatarImageViewProps> = props =>
useEffect(() => useEffect(() =>
{ {
isDisposed.current = false; isDisposed.current = false;
setIsReady(true); setIsReady(true);
return () => return () =>
{ {
isDisposed.current = true; isDisposed.current = true;
} };
}, []); }, []);
return <Base classNames={ getClassNames } style={ getStyle } { ...rest } />; return <Base classNames={ getClassNames } style={ getStyle } { ...rest } />;
} };

Some files were not shown because too many files have changed in this diff Show More