mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-18 13:26:27 +01:00
Update dependencies, eslint, fix formatting, etc
This commit is contained in:
parent
2cd999b614
commit
0db9e4ad45
@ -7,7 +7,7 @@
|
||||
"start": "vite",
|
||||
"build": "vite build",
|
||||
"build:prod": "npx browserslist@latest --update-db && yarn build",
|
||||
"eslint": "eslint src --ext .ts,.tsx"
|
||||
"eslint": "eslint ./src"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/react-virtual": "3.5.1",
|
||||
@ -16,6 +16,7 @@
|
||||
"react-dom": "^18.3.1",
|
||||
"react-icons": "^5.2.1",
|
||||
"react-slider": "^2.0.6",
|
||||
"react-transition-group": "^4.4.5",
|
||||
"react-youtube": "^7.13.1",
|
||||
"use-between": "^1.3.5"
|
||||
},
|
||||
|
@ -85,11 +85,11 @@ export const App: FC<{}> = props =>
|
||||
{
|
||||
NitroLogger.error(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
prepare(window.innerWidth, window.innerHeight);
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<Base fit overflow="hidden" className={ !(window.devicePixelRatio % 1) && 'image-rendering-pixelated' }>
|
||||
{ !isReady &&
|
||||
@ -98,4 +98,4 @@ export const App: FC<{}> = props =>
|
||||
<Base id="draggable-windows-container" />
|
||||
</Base>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -7,91 +7,91 @@ export class AchievementUtilities
|
||||
public static getAchievementBadgeCode(achievement: AchievementData): string
|
||||
{
|
||||
if(!achievement) return null;
|
||||
|
||||
|
||||
let badgeId = achievement.badgeId;
|
||||
|
||||
|
||||
if(!achievement.finalLevel) badgeId = GetLocalizationManager().getPreviousLevelBadgeId(badgeId);
|
||||
|
||||
|
||||
return badgeId;
|
||||
}
|
||||
|
||||
public static getAchievementCategoryImageUrl(category: IAchievementCategory, progress: number = null, icon: boolean = false): string
|
||||
{
|
||||
const imageUrl = GetConfigurationValue<string>('achievements.images.url');
|
||||
|
||||
|
||||
let imageName = icon ? 'achicon_' : 'achcategory_';
|
||||
|
||||
|
||||
imageName += category.code;
|
||||
|
||||
|
||||
if(progress !== null) imageName += `_${ ((progress > 0) ? 'active' : 'inactive') }`;
|
||||
|
||||
|
||||
return imageUrl.replace('%image%', imageName);
|
||||
}
|
||||
|
||||
public static getAchievementCategoryMaxProgress(category: IAchievementCategory): number
|
||||
{
|
||||
if(!category) return 0;
|
||||
|
||||
|
||||
let progress = 0;
|
||||
|
||||
|
||||
for(const achievement of category.achievements)
|
||||
{
|
||||
progress += achievement.levelCount;
|
||||
}
|
||||
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
public static getAchievementCategoryProgress(category: IAchievementCategory): number
|
||||
{
|
||||
if(!category) return 0;
|
||||
|
||||
|
||||
let progress = 0;
|
||||
|
||||
|
||||
for(const achievement of category.achievements) progress += (achievement.finalLevel ? achievement.level : (achievement.level - 1));
|
||||
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
public static getAchievementCategoryTotalUnseen(category: IAchievementCategory): number
|
||||
{
|
||||
if(!category) return 0;
|
||||
|
||||
|
||||
let unseen = 0;
|
||||
|
||||
|
||||
for(const achievement of category.achievements) ((achievement.unseen > 0) && unseen++);
|
||||
|
||||
|
||||
return unseen;
|
||||
}
|
||||
|
||||
public static getAchievementHasStarted(achievement: AchievementData): boolean
|
||||
{
|
||||
if(!achievement) return false;
|
||||
|
||||
|
||||
if(achievement.finalLevel || ((achievement.level - 1) > 0)) return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static getAchievementIsIgnored(achievement: AchievementData): boolean
|
||||
{
|
||||
if(!achievement) return false;
|
||||
|
||||
|
||||
const ignored = GetConfigurationValue<string[]>('achievements.unseen.ignored');
|
||||
const value = achievement.badgeId.replace(/[0-9]/g, '');
|
||||
const index = ignored.indexOf(value);
|
||||
|
||||
|
||||
if(index >= 0) return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static getAchievementLevel(achievement: AchievementData): number
|
||||
{
|
||||
if(!achievement) return 0;
|
||||
|
||||
|
||||
if(achievement.finalLevel) return achievement.level;
|
||||
|
||||
|
||||
return (achievement.level - 1);
|
||||
}
|
||||
}
|
||||
|
@ -14,4 +14,4 @@ export const AvatarEditorColorSorter = (a: IPartColor, b: IPartColor) =>
|
||||
if(a.index > b.index) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
@ -31,5 +31,5 @@ export const AvatarEditorPartSorter = (hcFirst: boolean) =>
|
||||
if(a.partSet.id > b.partSet.id) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -104,7 +104,7 @@ export class AvatarEditorThumbnailsHelper
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
};
|
||||
|
||||
return new Promise(async (resolve, reject) =>
|
||||
{
|
||||
@ -116,7 +116,7 @@ export class AvatarEditorThumbnailsHelper
|
||||
AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl);
|
||||
|
||||
resolve(imageUrl);
|
||||
}
|
||||
};
|
||||
|
||||
const figureContainer = GetAvatarRenderManager().createFigureContainer(`${ setType }-${ part.partSet.id }`);
|
||||
|
||||
@ -164,11 +164,11 @@ export class AvatarEditorThumbnailsHelper
|
||||
|
||||
sprite.destroy();
|
||||
avatarImage.dispose();
|
||||
|
||||
|
||||
AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl);
|
||||
|
||||
resolve(imageUrl);
|
||||
}
|
||||
};
|
||||
|
||||
resetFigure(figureString);
|
||||
});
|
||||
|
@ -4,6 +4,6 @@ export class CameraPicture
|
||||
{
|
||||
constructor(
|
||||
public texture: NitroTexture,
|
||||
public imageUrl: string)
|
||||
public imageUrl: string)
|
||||
{}
|
||||
}
|
||||
|
@ -2,6 +2,6 @@ export class CameraPictureThumbnail
|
||||
{
|
||||
constructor(
|
||||
public effectName: string,
|
||||
public thumbnailUrl: string)
|
||||
public thumbnailUrl: string)
|
||||
{}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { NodeData } from '@nitrots/nitro-renderer';
|
||||
import { ICatalogNode } from './ICatalogNode';
|
||||
|
||||
export class CatalogNode implements ICatalogNode
|
||||
export class CatalogNode implements ICatalogNode
|
||||
{
|
||||
private _depth: number = 0;
|
||||
private _localization: string = '';
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class CatalogPageName
|
||||
export class CatalogPageName
|
||||
{
|
||||
public static DUCKET_INFO: string = 'ducket_info';
|
||||
public static CREDITS: string = 'credits';
|
||||
|
@ -5,6 +5,6 @@ export class CatalogPetPalette
|
||||
constructor(
|
||||
public readonly breed: string,
|
||||
public readonly palettes: SellablePetPaletteData[]
|
||||
)
|
||||
)
|
||||
{}
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import { ICatalogNode } from './ICatalogNode';
|
||||
export const GetPixelEffectIcon = (id: number) =>
|
||||
{
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
export const GetSubscriptionProductIcon = (id: number) =>
|
||||
{
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
if(!node.isVisible) continue;
|
||||
|
||||
|
||||
allowedNodes.push(node);
|
||||
}
|
||||
}
|
||||
|
||||
return allowedNodes;
|
||||
}
|
||||
};
|
||||
|
||||
export const FilterCatalogNode = (search: string, furniLines: string[], node: ICatalogNode, nodes: ICatalogNode[]) =>
|
||||
{
|
||||
if(node.isVisible && (node.pageId > 0))
|
||||
{
|
||||
let nodeAdded = false;
|
||||
|
||||
|
||||
const hayStack = [ node.pageName, node.localization ].join(' ').toLowerCase().replace(/ /gi, '');
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
export function GetPetIndexFromLocalization(localization: string)
|
||||
{
|
||||
|
@ -16,4 +16,4 @@ export const GetImageIconUrlForProduct = (productType: string, productClassId: n
|
||||
}
|
||||
|
||||
return imageUrl;
|
||||
}
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
export interface ICatalogNode
|
||||
export interface ICatalogNode
|
||||
{
|
||||
activate(): void;
|
||||
deactivate(): void;
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class MarketPlaceOfferState
|
||||
export class MarketPlaceOfferState
|
||||
{
|
||||
public static readonly ONGOING = 1;
|
||||
public static readonly ONGOING_OWN = 1;
|
||||
|
@ -60,7 +60,7 @@ export class Offer implements IPurchasableOffer
|
||||
|
||||
public activate(): void
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public get clubLevel(): number
|
||||
@ -228,7 +228,7 @@ export class Offer implements IPurchasableOffer
|
||||
{
|
||||
const products: IProduct[] = [];
|
||||
const productData = GetProductDataForLocalization(this.localizationId);
|
||||
|
||||
|
||||
for(const product of this._products)
|
||||
{
|
||||
const furnitureData = GetFurnitureData(product.productClassId, product.productType);
|
||||
|
@ -4,7 +4,7 @@ import { IPageLocalization } from './IPageLocalization';
|
||||
export class PageLocalization implements IPageLocalization
|
||||
{
|
||||
private _images: string[];
|
||||
private _texts: string[]
|
||||
private _texts: string[];
|
||||
|
||||
constructor(images: string[], texts: string[])
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ export class PlacedObjectPurchaseData
|
||||
public readonly x: number,
|
||||
public readonly y: number,
|
||||
public readonly direction: number,
|
||||
public readonly offer: IPurchasableOffer)
|
||||
public readonly offer: IPurchasableOffer)
|
||||
{}
|
||||
|
||||
public get offerId(): number
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class RequestedPage
|
||||
export class RequestedPage
|
||||
{
|
||||
public static REQUEST_TYPE_NONE: number = 0;
|
||||
public static REQUEST_TYPE_ID: number = 1;
|
||||
|
@ -6,6 +6,6 @@ export class SearchResult
|
||||
constructor(
|
||||
public readonly searchValue: string,
|
||||
public readonly offers: IPurchasableOffer[],
|
||||
public readonly filteredNodes: ICatalogNode[])
|
||||
public readonly filteredNodes: ICatalogNode[])
|
||||
{}
|
||||
}
|
||||
|
@ -3,4 +3,4 @@ export const ChatHistoryCurrentDate = () =>
|
||||
const currentTime = new Date();
|
||||
|
||||
return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`;
|
||||
}
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
export const MessengerHistoryCurrentDate = (secondsSinceNow: number = 0) =>
|
||||
{
|
||||
const currentTime = secondsSinceNow ? new Date(Date.now() - secondsSinceNow * 1000) : new Date();
|
||||
|
||||
|
||||
return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`;
|
||||
}
|
||||
};
|
||||
|
@ -3,11 +3,11 @@ import { IGroupChatData } from './IGroupChatData';
|
||||
export const GetGroupChatData = (extraData: string) =>
|
||||
{
|
||||
if(!extraData || !extraData.length) return null;
|
||||
|
||||
|
||||
const splitData = extraData.split('/');
|
||||
const username = splitData[0];
|
||||
const figure = splitData[1];
|
||||
const userId = parseInt(splitData[2]);
|
||||
|
||||
return ({ username: username, figure: figure, userId: userId } as IGroupChatData);
|
||||
}
|
||||
};
|
||||
|
@ -6,6 +6,6 @@ export class MessengerSettings
|
||||
public userFriendLimit: number = 0,
|
||||
public normalFriendLimit: number = 0,
|
||||
public extendedFriendLimit: number = 0,
|
||||
public categories: FriendCategoryData[] = [])
|
||||
public categories: FriendCategoryData[] = [])
|
||||
{}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ export class MessengerThread
|
||||
group.addChat(chat);
|
||||
|
||||
this._lastUpdated = new Date();
|
||||
|
||||
|
||||
this._unreadCount++;
|
||||
|
||||
return chat;
|
||||
|
@ -19,7 +19,7 @@ export class GroupBadgePart
|
||||
public get code(): string
|
||||
{
|
||||
if((this.key === 0) && (this.type !== GroupBadgePart.BASE)) return null;
|
||||
|
||||
|
||||
return GroupBadgePart.getCode(this.type, this.key, this.color, this.position);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class GroupType
|
||||
export class GroupType
|
||||
{
|
||||
public static REGULAR: number = 0;
|
||||
public static EXCLUSIVE: number = 1;
|
||||
|
@ -4,4 +4,4 @@ import { SendMessageComposer } from '../nitro';
|
||||
export const ToggleFavoriteGroup = (group: HabboGroupEntryData) =>
|
||||
{
|
||||
SendMessageComposer(group.favourite ? new GroupUnfavoriteComposer(group.groupId) : new GroupFavoriteComposer(group.groupId));
|
||||
}
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ export class GuideToolMessage
|
||||
{
|
||||
private _message: string;
|
||||
private _roomId: number;
|
||||
|
||||
|
||||
constructor(message: string, roomId?: number)
|
||||
{
|
||||
this._message = message;
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class ClubStatus
|
||||
export class ClubStatus
|
||||
{
|
||||
public static ACTIVE: string = 'active';
|
||||
public static NONE: string = 'none';
|
||||
|
@ -8,4 +8,4 @@ export const GetClubBadge = (badgeCodes: string[]) =>
|
||||
BADGES.forEach(badge => ((badgeCodes.indexOf(badge) > -1) && (badgeCode = badge)));
|
||||
|
||||
return (badgeCode || DEFAULT_BADGE);
|
||||
}
|
||||
};
|
||||
|
@ -5,4 +5,4 @@ export const GetCloseReasonKey = (code: number) =>
|
||||
if(code === 2) return 'abusive';
|
||||
|
||||
return 'resolved';
|
||||
}
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ export class FurnitureItem implements IFurnitureItem
|
||||
constructor(parser: IFurnitureItemData)
|
||||
{
|
||||
if(!parser) return;
|
||||
|
||||
|
||||
this._locked = false;
|
||||
this._id = parser.itemId;
|
||||
this._type = parser.spriteId;
|
||||
|
@ -35,7 +35,7 @@ const addSingleFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: b
|
||||
}
|
||||
|
||||
return groupItem;
|
||||
}
|
||||
};
|
||||
|
||||
const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: boolean) =>
|
||||
{
|
||||
@ -85,7 +85,7 @@ const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen
|
||||
const index = set.indexOf(existingGroup);
|
||||
|
||||
if(index >= 0) set.splice(index, 1);
|
||||
|
||||
|
||||
set.unshift(existingGroup);
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen
|
||||
}
|
||||
|
||||
return existingGroup;
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
return merged;
|
||||
}
|
||||
};
|
||||
|
||||
export const getAllItemIds = (groupItems: GroupItem[]) =>
|
||||
{
|
||||
@ -168,4 +168,4 @@ export const getAllItemIds = (groupItems: GroupItem[]) =>
|
||||
}
|
||||
|
||||
return itemIds;
|
||||
}
|
||||
};
|
||||
|
@ -19,12 +19,12 @@ export const setPlacingItemId = (id: number) => (itemIdInPlacing = id);
|
||||
export const cancelRoomObjectPlacement = () =>
|
||||
{
|
||||
if(getPlacingItemId() === -1) return;
|
||||
|
||||
|
||||
GetRoomEngine().cancelRoomObjectPlacement();
|
||||
|
||||
setPlacingItemId(-1);
|
||||
setObjectMoverRequested(false);
|
||||
}
|
||||
};
|
||||
|
||||
export const attemptPetPlacement = (petItem: IPetItem, flag: boolean = false) =>
|
||||
{
|
||||
@ -47,7 +47,7 @@ export const attemptPetPlacement = (petItem: IPetItem, flag: boolean = false) =>
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
export const attemptItemPlacement = (groupItem: GroupItem, flag: boolean = false) =>
|
||||
{
|
||||
@ -92,7 +92,7 @@ export const attemptItemPlacement = (groupItem: GroupItem, flag: boolean = false
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const attemptBotPlacement = (botItem: IBotItem, flag: boolean = false) =>
|
||||
@ -114,4 +114,4 @@ export const attemptBotPlacement = (botItem: IBotItem, flag: boolean = false) =>
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ export const addSinglePetItem = (petData: PetData, set: IPetItem[], unseen: bool
|
||||
if(unseen)
|
||||
{
|
||||
//petItem.isUnseen = true;
|
||||
|
||||
|
||||
set.unshift(petItem);
|
||||
}
|
||||
else
|
||||
@ -21,7 +21,7 @@ export const addSinglePetItem = (petData: PetData, set: IPetItem[], unseen: bool
|
||||
}
|
||||
|
||||
return petItem;
|
||||
}
|
||||
};
|
||||
|
||||
export const removePetItemById = (id: number, set: IPetItem[]) =>
|
||||
{
|
||||
@ -39,7 +39,7 @@ export const removePetItemById = (id: number, set: IPetItem[]) =>
|
||||
|
||||
CreateLinkEvent('inventory/open');
|
||||
}
|
||||
|
||||
|
||||
set.splice(index, 1);
|
||||
|
||||
return petItem;
|
||||
@ -49,7 +49,7 @@ export const removePetItemById = (id: number, set: IPetItem[]) =>
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
return merged;
|
||||
}
|
||||
};
|
||||
|
@ -10,6 +10,6 @@ export class TradeUserData
|
||||
public itemCount: number = 0,
|
||||
public creditsCount: number = 0,
|
||||
public accepts: boolean = false,
|
||||
public canTrade: boolean = false)
|
||||
public canTrade: boolean = false)
|
||||
{}
|
||||
}
|
||||
|
@ -17,39 +17,39 @@ export const parseTradeItems = (items: ItemDataStructure[]) =>
|
||||
{
|
||||
const spriteId = item.spriteId;
|
||||
const category = item.category;
|
||||
|
||||
|
||||
let name = (item.furniType + spriteId);
|
||||
|
||||
|
||||
if(!item.isGroupable || isExternalImage(spriteId))
|
||||
{
|
||||
name = ('itemid' + item.itemId);
|
||||
}
|
||||
|
||||
|
||||
if(item.category === FurniCategory.POSTER)
|
||||
{
|
||||
name = (item.itemId + 'poster' + item.stuffData.getLegacyString());
|
||||
}
|
||||
|
||||
|
||||
else if(item.category === FurniCategory.GUILD_FURNI)
|
||||
{
|
||||
name = '';
|
||||
}
|
||||
|
||||
|
||||
let groupItem = ((item.isGroupable && !isExternalImage(item.spriteId)) ? existingItems.getValue(name) : null);
|
||||
|
||||
|
||||
if(!groupItem)
|
||||
{
|
||||
groupItem = createGroupItem(spriteId, category, item.stuffData);
|
||||
|
||||
|
||||
existingItems.add(name, groupItem);
|
||||
}
|
||||
|
||||
|
||||
groupItem.push(new FurnitureItem(item));
|
||||
}
|
||||
}
|
||||
|
||||
return existingItems;
|
||||
}
|
||||
};
|
||||
|
||||
export const getGuildFurniType = (spriteId: number, stuffData: IObjectData) =>
|
||||
{
|
||||
@ -67,4 +67,4 @@ export const getGuildFurniType = (spriteId: number, stuffData: IObjectData) =>
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
};
|
||||
|
@ -32,4 +32,4 @@ export const GetIssueCategoryName = (categoryId: number) =>
|
||||
}
|
||||
|
||||
return 'Unknown';
|
||||
}
|
||||
};
|
||||
|
@ -5,6 +5,6 @@ const BuildMaxVisitorsList = () =>
|
||||
for(let i = 10; i <= 100; i = i + 10) list.push(i);
|
||||
|
||||
return list;
|
||||
}
|
||||
};
|
||||
|
||||
export const GetMaxVisitorsList = BuildMaxVisitorsList();
|
||||
|
@ -1,6 +1,6 @@
|
||||
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);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { CreateLinkEvent, HabboWebTools } from '@nitrots/nitro-renderer';
|
||||
export const OpenUrl = (url: string) =>
|
||||
{
|
||||
if(!url || !url.length) return;
|
||||
|
||||
|
||||
if(url.startsWith('http'))
|
||||
{
|
||||
HabboWebTools.openWebPage(url);
|
||||
@ -12,4 +12,4 @@ export const OpenUrl = (url: string) =>
|
||||
{
|
||||
CreateLinkEvent(url);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -49,6 +49,6 @@ export const DispatchMouseEvent = (event: MouseEvent, canvasId: number = 1) =>
|
||||
break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
|
||||
GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, event.altKey, (event.ctrlKey || event.metaKey), event.shiftKey, false);
|
||||
}
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ export const DispatchTouchEvent = (event: TouchEvent, canvasId: number = 1, long
|
||||
x = event.changedTouches[0].clientX;
|
||||
y = event.changedTouches[0].clientY;
|
||||
}
|
||||
|
||||
|
||||
let eventType = event.type;
|
||||
|
||||
if(longTouch) eventType = TouchEventType.TOUCH_LONG;
|
||||
@ -53,7 +53,7 @@ export const DispatchTouchEvent = (event: TouchEvent, canvasId: number = 1, long
|
||||
break;
|
||||
case MouseEventType.DOUBLE_CLICK:
|
||||
break;
|
||||
case TouchEventType.TOUCH_START:
|
||||
case TouchEventType.TOUCH_START:
|
||||
eventType = MouseEventType.MOUSE_DOWN;
|
||||
|
||||
didMouseMove = false;
|
||||
@ -72,10 +72,10 @@ export const DispatchTouchEvent = (event: TouchEvent, canvasId: number = 1, long
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
@ -10,4 +10,4 @@ export const GetRoomObjectBounds = (roomId: number, objectId: number, category:
|
||||
rectangle.y = Math.round(rectangle.y);
|
||||
|
||||
return rectangle;
|
||||
}
|
||||
};
|
||||
|
@ -10,4 +10,4 @@ export const GetRoomObjectScreenLocation = (roomId: number, objectId: number, ca
|
||||
point.y = Math.round(point.y);
|
||||
|
||||
return point;
|
||||
}
|
||||
};
|
||||
|
@ -6,4 +6,4 @@ export const InitializeRoomInstanceRenderingCanvas = (width: number, height: num
|
||||
const roomId = roomEngine.activeRoomId;
|
||||
|
||||
roomEngine.initializeRoomInstanceRenderingCanvas(roomId, canvasId, width, height);
|
||||
}
|
||||
};
|
||||
|
@ -6,8 +6,8 @@ export function GetCanStandUp(): string
|
||||
const roomObject = GetOwnRoomObject();
|
||||
|
||||
if(!roomObject) return AvatarAction.POSTURE_STAND;
|
||||
|
||||
|
||||
const model = roomObject.model;
|
||||
|
||||
|
||||
return model.getValue<string>(RoomObjectVariable.FIGURE_CAN_STAND_UP);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ export function GetCanUseExpression(): boolean
|
||||
const roomObject = GetOwnRoomObject();
|
||||
|
||||
if(!roomObject) return false;
|
||||
|
||||
|
||||
const model = roomObject.model;
|
||||
const effectId = model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT);
|
||||
|
||||
|
@ -4,6 +4,6 @@ import { GetConfigurationValue } from '../GetConfigurationValue';
|
||||
export function GetClubMemberLevel(): number
|
||||
{
|
||||
if(GetConfigurationValue<boolean>('hc.disabled', false)) return HabboClubLevelEnum.VIP;
|
||||
|
||||
|
||||
return GetSessionDataManager().clubLevel;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ export function GetFurnitureDataForProductOffer(offer: CatalogPageMessageProduct
|
||||
|
||||
let furniData: IFurnitureData = null;
|
||||
|
||||
switch((offer.productType.toUpperCase()))
|
||||
switch(offer.productType)
|
||||
{
|
||||
case FurnitureType.FLOOR:
|
||||
furniData = GetSessionDataManager().getFloorItemData(offer.furniClassId);
|
||||
|
@ -6,8 +6,8 @@ export function GetOwnPosture(): string
|
||||
const roomObject = GetOwnRoomObject();
|
||||
|
||||
if(!roomObject) return AvatarAction.POSTURE_STAND;
|
||||
|
||||
|
||||
const model = roomObject.model;
|
||||
|
||||
|
||||
return model.getValue<string>(RoomObjectVariable.FIGURE_POSTURE);
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ export function IsRidingHorse(): boolean
|
||||
const roomObject = GetOwnRoomObject();
|
||||
|
||||
if(!roomObject) return false;
|
||||
|
||||
|
||||
const model = roomObject.model;
|
||||
const effectId = model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT);
|
||||
|
||||
|
||||
return (effectId === 77);
|
||||
}
|
||||
|
@ -8,4 +8,4 @@ export const VisitDesktop = () =>
|
||||
|
||||
GoToDesktop();
|
||||
GetRoomSessionManager().removeSession(-1);
|
||||
}
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class NotificationBubbleType
|
||||
export class NotificationBubbleType
|
||||
{
|
||||
public static FRIENDOFFLINE: string = 'friendoffline';
|
||||
public static FRIENDONLINE: string = 'friendonline';
|
||||
|
@ -39,7 +39,7 @@ export class AvatarInfoUser implements IAvatarInfo
|
||||
public targetRoomControllerLevel: number = 0;
|
||||
public isAmbassador: boolean = false;
|
||||
|
||||
constructor(public readonly type: string)
|
||||
constructor(public readonly type: string)
|
||||
{}
|
||||
|
||||
public get isOwnUser(): boolean
|
||||
|
@ -398,7 +398,7 @@ export class AvatarInfoUtilities
|
||||
default:
|
||||
return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return this.isValidSetting(userInfo, checkSetting);
|
||||
}
|
||||
@ -416,7 +416,7 @@ export class AvatarInfoUtilities
|
||||
default:
|
||||
return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return this.isValidSetting(userInfo, checkSetting);
|
||||
}
|
||||
@ -432,7 +432,7 @@ export class AvatarInfoUtilities
|
||||
default:
|
||||
return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return this.isValidSetting(userInfo, checkSetting);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ export class ChatBubbleMessage
|
||||
|
||||
private _top: number = 0;
|
||||
private _left: number = 0;
|
||||
|
||||
|
||||
constructor(
|
||||
public senderId: number = -1,
|
||||
public senderCategory: number = -1,
|
||||
@ -23,7 +23,7 @@ export class ChatBubbleMessage
|
||||
public styleId: number = 0,
|
||||
public imageUrl: string = null,
|
||||
public color: string = null
|
||||
)
|
||||
)
|
||||
{
|
||||
this.id = ++ChatBubbleMessage.BUBBLE_COUNTER;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ export class ChatBubbleUtilities
|
||||
{
|
||||
const avatarImage = GetAvatarRenderManager().createAvatarImage(figure, AvatarScaleType.LARGE, null, {
|
||||
resetFigure: figure => this.setFigureImage(figure),
|
||||
dispose: () =>
|
||||
dispose: () =>
|
||||
{},
|
||||
disposed: false
|
||||
});
|
||||
|
@ -4,6 +4,6 @@ export class DimmerFurnitureWidgetPresetItem
|
||||
public id: number = 0,
|
||||
public type: number = 0,
|
||||
public color: number = 0,
|
||||
public light: number = 0)
|
||||
public light: number = 0)
|
||||
{}
|
||||
}
|
||||
|
@ -3,5 +3,4 @@ import { ChatBubbleMessage } from './ChatBubbleMessage';
|
||||
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)));
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -34,4 +34,4 @@ export const GetDiskColor = (name: string) =>
|
||||
b = ((b % DISK_COLOR_BLUE_RANGE) + DISK_COLOR_BLUE_MIN);
|
||||
|
||||
return `rgb(${ r },${ g },${ b })`;
|
||||
}
|
||||
};
|
||||
|
@ -29,10 +29,10 @@ export class MannequinUtilities
|
||||
for(const part of figureContainer.getPartTypeIds())
|
||||
{
|
||||
if(this.MANNEQUIN_CLOTHING_PART_TYPES.indexOf(part) >= 0) continue;
|
||||
|
||||
|
||||
figureContainer.removePart(part);
|
||||
}
|
||||
|
||||
|
||||
figureContainer.updatePart((this.MANNEQUIN_FIGURE[0] as string), (this.MANNEQUIN_FIGURE[1] as number), (this.MANNEQUIN_FIGURE[2] as number[]));
|
||||
};
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class YoutubeVideoPlaybackStateEnum
|
||||
export class YoutubeVideoPlaybackStateEnum
|
||||
{
|
||||
public static readonly UNSTARTED = -1;
|
||||
public static readonly ENDED = 0;
|
||||
|
@ -11,4 +11,4 @@ export const CloneObject = <T>(object: T): T =>
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
};
|
||||
|
@ -30,7 +30,7 @@ export class ColorUtils
|
||||
*/
|
||||
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 val3 = ((value >> 8) & 0xFF);
|
||||
const val4 = (value & 0xFF);
|
||||
|
@ -6,4 +6,4 @@ export const ConvertSeconds = (seconds: number) =>
|
||||
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');
|
||||
}
|
||||
};
|
||||
|
@ -2,10 +2,10 @@ export const GetLocalStorage = <T>(key: string) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
JSON.parse(window.localStorage.getItem(key)) as T ?? null
|
||||
JSON.parse(window.localStorage.getItem(key)) as T ?? null;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -7,4 +7,4 @@ export const LocalizeBadgeDescription = (key: string) =>
|
||||
if(!badgeDesc || !badgeDesc.length) badgeDesc = `badge_desc_${ key }`;
|
||||
|
||||
return badgeDesc;
|
||||
}
|
||||
};
|
||||
|
@ -7,4 +7,4 @@ export const LocalizeBadgeName = (key: string) =>
|
||||
if(!badgeName || !badgeName.length) badgeName = `badge_name_${ key }`;
|
||||
|
||||
return badgeName;
|
||||
}
|
||||
};
|
||||
|
@ -8,7 +8,7 @@ export const PlaySound = (sampleCode: string) =>
|
||||
if(!canPlaySound) return;
|
||||
|
||||
DispatchMainEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sampleCode));
|
||||
}
|
||||
};
|
||||
|
||||
const eventTypes = [ MouseEventType.MOUSE_CLICK ];
|
||||
|
||||
@ -19,6 +19,6 @@ const startListening = () =>
|
||||
const onEvent = (event: Event) => ((canPlaySound = true) && stopListening());
|
||||
|
||||
eventTypes.forEach(type => window.addEventListener(type, onEvent));
|
||||
}
|
||||
};
|
||||
|
||||
startListening();
|
||||
|
@ -1,19 +1,19 @@
|
||||
import { CatalogPageMessageProductData, GetRoomEngine } from '@nitrots/nitro-renderer';
|
||||
import { FurnitureType, GetRoomEngine } from '@nitrots/nitro-renderer';
|
||||
import { FurniCategory } from '../inventory';
|
||||
|
||||
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;
|
||||
|
||||
switch(productType)
|
||||
{
|
||||
case CatalogPageMessageProductData.S:
|
||||
case FurnitureType.FLOOR:
|
||||
imageUrl = GetRoomEngine().getFurnitureFloorIconUrl(furniClassId);
|
||||
break;
|
||||
case CatalogPageMessageProductData.I:
|
||||
const productCategory = this.getProductCategory(CatalogPageMessageProductData.I, furniClassId);
|
||||
case FurnitureType.WALL:
|
||||
const productCategory = this.getProductCategory(FurnitureType.WALL, furniClassId);
|
||||
|
||||
if(productCategory === 1)
|
||||
{
|
||||
@ -32,7 +32,7 @@ export class ProductImageUtility
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CatalogPageMessageProductData.E:
|
||||
case FurnitureType.EFFECT:
|
||||
// fx_icon_furniClassId_png
|
||||
break;
|
||||
}
|
||||
@ -40,11 +40,11 @@ export class ProductImageUtility
|
||||
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;
|
||||
|
||||
|
@ -35,7 +35,7 @@ const encodeHTML = (str: string) =>
|
||||
|
||||
return full;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const RoomChatFormatter = (content: string) =>
|
||||
{
|
||||
@ -72,4 +72,4 @@ export const RoomChatFormatter = (content: string) =>
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
@ -5,4 +5,4 @@ export const GetWiredTimeLocale = (value: number) =>
|
||||
if(!(value % 2)) return time.toString();
|
||||
|
||||
return (time + 0.5).toString();
|
||||
}
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ export const AutoGrid: FC<AutoGridProps> = props =>
|
||||
let newStyle: CSSProperties = {};
|
||||
|
||||
newStyle['--nitro-grid-column-min-height'] = (columnMinHeight + 'px');
|
||||
|
||||
|
||||
if(columnCount > 1) newStyle.gridTemplateColumns = `repeat(auto-fill, minmax(${ columnMinWidth }px, 1fr))`;
|
||||
|
||||
if(Object.keys(style).length) newStyle = { ...newStyle, ...style };
|
||||
@ -25,4 +25,4 @@ export const AutoGrid: FC<AutoGridProps> = props =>
|
||||
}, [ columnMinWidth, columnMinHeight, columnCount, style ]);
|
||||
|
||||
return <Grid columnCount={ columnCount } fullHeight={ fullHeight } overflow={ overflow } style={ getStyle } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
@ -75,10 +75,10 @@ export const Base: FC<BaseProps<HTMLDivElement>> = props =>
|
||||
|
||||
return newStyle;
|
||||
}, [ style ]);
|
||||
|
||||
|
||||
return (
|
||||
<div ref={ innerRef } className={ getClassName } style={ getStyle } { ...rest }>
|
||||
{ children }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -32,4 +32,4 @@ export const Button: FC<ButtonProps> = props =>
|
||||
}, [ variant, size, active, disabled, classNames ]);
|
||||
|
||||
return <Flex center classNames={ getClassNames } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
@ -19,4 +19,4 @@ export const ButtonGroup: FC<ButtonGroupProps> = props =>
|
||||
}, [ classNames ]);
|
||||
|
||||
return <Base classNames={ getClassNames } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
@ -43,4 +43,4 @@ export const Column: FC<ColumnProps> = props =>
|
||||
}, [ size, offset, isCssGrid, classNames ]);
|
||||
|
||||
return <Flex classNames={ getClassNames } column={ column } gap={ gap } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
@ -47,4 +47,4 @@ export const Flex: FC<FlexProps> = props =>
|
||||
}, [ column, reverse, gap, center, alignSelf, alignItems, justifyContent, classNames ]);
|
||||
|
||||
return <Base display={ display } classNames={ getClassNames } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
@ -19,4 +19,4 @@ export const FormGroup: FC<FormGroupProps> = props =>
|
||||
}, [ classNames ]);
|
||||
|
||||
return <Flex classNames={ getClassNames } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
@ -60,4 +60,4 @@ export const Grid: FC<GridProps> = props =>
|
||||
<Base fullHeight={ fullHeight } classNames={ getClassNames } style={ getStyle } { ...rest } />
|
||||
</GridContextProvider>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ const GridContext = createContext<IGridContext>({
|
||||
|
||||
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);
|
||||
|
@ -35,4 +35,4 @@ export const HorizontalRule: FC<HorizontalRuleProps> = props =>
|
||||
}, [ height, style ]);
|
||||
|
||||
return <Base classNames={ getClassNames } style={ getStyle } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
@ -62,7 +62,7 @@ export const InfiniteGrid: FC<InfiniteGridProps> = props =>
|
||||
minHeight: virtualRow.index === 0 ? estimateSize : virtualRow.size,
|
||||
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)];
|
||||
|
||||
@ -81,4 +81,4 @@ export const InfiniteGrid: FC<InfiniteGridProps> = props =>
|
||||
</div>
|
||||
</Base>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -52,4 +52,4 @@ export const InfiniteScroll: FC<InfiniteScrollProps> = props =>
|
||||
</div>
|
||||
</Base>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -60,4 +60,4 @@ export const Text: FC<TextProps> = props =>
|
||||
}, [ variant, fontWeight, fontSize, align, bold, underline, italics, truncate, center, textEnd, small, wrap, noWrap, textBreak ]);
|
||||
|
||||
return <Base classNames={ getClassNames } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
@ -15,4 +15,4 @@ export const NitroCardContentView: FC<ColumnProps> = props =>
|
||||
}, [ classNames ]);
|
||||
|
||||
return <Column classNames={ getClassNames } overflow={ overflow } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ const NitroCardContext = createContext<INitroCardContext>({
|
||||
|
||||
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);
|
||||
|
@ -28,7 +28,7 @@ export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
|
||||
{
|
||||
event.stopPropagation();
|
||||
event.nativeEvent.stopImmediatePropagation();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Column center position="relative" classNames={ getClassNames } { ...rest }>
|
||||
@ -45,4 +45,4 @@ export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
|
||||
</Flex>
|
||||
</Column>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -20,4 +20,4 @@ export const NitroCardSubHeaderView: FC<NitroCardSubHeaderProps> = props =>
|
||||
}, [ classNames, variant ]);
|
||||
|
||||
return <Flex justifyContent={ justifyContent } classNames={ getClassNames } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
@ -31,4 +31,4 @@ export const NitroCardView: FC<NitroCardViewProps> = props =>
|
||||
</DraggableWindow>
|
||||
</NitroCardContextProvider>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -16,6 +16,6 @@ const NitroCardAccordionContext = createContext<INitroCardAccordionContext>({
|
||||
export const NitroCardAccordionContextProvider: FC<ProviderProps<INitroCardAccordionContext>> = props =>
|
||||
{
|
||||
return <NitroCardAccordionContext.Provider { ...props } />;
|
||||
}
|
||||
};
|
||||
|
||||
export const useNitroCardAccordionContext = () => useContext(NitroCardAccordionContext);
|
||||
|
@ -15,4 +15,4 @@ export const NitroCardAccordionItemView: FC<NitroCardAccordionItemViewProps> = p
|
||||
{ children }
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -18,9 +18,9 @@ export const NitroCardAccordionSetView: FC<NitroCardAccordionSetViewProps> = pro
|
||||
const onClick = () =>
|
||||
{
|
||||
closeAll();
|
||||
|
||||
|
||||
setIsOpen(prevValue => !prevValue);
|
||||
}
|
||||
};
|
||||
|
||||
const onClose = useCallback(() => setIsOpen(false), []);
|
||||
|
||||
@ -62,10 +62,10 @@ export const NitroCardAccordionSetView: FC<NitroCardAccordionSetViewProps> = pro
|
||||
const index = newClosers.indexOf(closeFunction);
|
||||
|
||||
if(index >= 0) newClosers.splice(index, 1);
|
||||
|
||||
|
||||
return newClosers;
|
||||
});
|
||||
}
|
||||
};
|
||||
}, [ onClose, setClosers ]);
|
||||
|
||||
return (
|
||||
@ -81,4 +81,4 @@ export const NitroCardAccordionSetView: FC<NitroCardAccordionSetViewProps> = pro
|
||||
</Column> }
|
||||
</Column>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -4,7 +4,7 @@ import { NitroCardAccordionContextProvider } from './NitroCardAccordionContext';
|
||||
|
||||
interface NitroCardAccordionViewProps extends ColumnProps
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
export const NitroCardAccordionView: FC<NitroCardAccordionViewProps> = props =>
|
||||
@ -22,4 +22,4 @@ export const NitroCardAccordionView: FC<NitroCardAccordionViewProps> = props =>
|
||||
<Column gap={ 0 } { ...rest } />
|
||||
</NitroCardAccordionContextProvider>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -32,4 +32,4 @@ export const NitroCardTabsItemView: FC<NitroCardTabsItemViewProps> = props =>
|
||||
<LayoutItemCountView count={ count } /> }
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -19,4 +19,4 @@ export const NitroCardTabsView: FC<FlexProps> = props =>
|
||||
{ children }
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -107,7 +107,7 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
|
||||
const completeDrag = useCallback(() =>
|
||||
{
|
||||
if(!elementRef.current || !dragHandler) return;
|
||||
|
||||
|
||||
let offsetX = (offset.x + delta.x);
|
||||
let offsetY = (offset.y + delta.y);
|
||||
|
||||
@ -170,7 +170,7 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
|
||||
|
||||
if(!disableDrag)
|
||||
{
|
||||
const handle = (element.querySelector(handleSelector) as HTMLElement);
|
||||
const handle = (element.querySelector(handleSelector));
|
||||
|
||||
if(handle) setDragHandler(handle);
|
||||
}
|
||||
@ -202,13 +202,13 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
|
||||
const index = CURRENT_WINDOWS.indexOf(element);
|
||||
|
||||
if(index >= 0) CURRENT_WINDOWS.splice(index, 1);
|
||||
}
|
||||
};
|
||||
}, [ handleSelector, windowPosition, uniqueKey, disableDrag, offsetLeft, offsetTop, bringToTop ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!offset && !delta) return;
|
||||
|
||||
|
||||
const element = (elementRef.current as HTMLElement);
|
||||
|
||||
if(!element) return;
|
||||
@ -228,7 +228,7 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
|
||||
{
|
||||
dragHandler.removeEventListener(MouseEventType.MOUSE_DOWN, onDragMouseDown);
|
||||
dragHandler.removeEventListener(TouchEventType.TOUCH_START, onTouchDown);
|
||||
}
|
||||
};
|
||||
}, [ dragHandler, onDragMouseDown, onTouchDown ]);
|
||||
|
||||
useEffect(() =>
|
||||
@ -246,7 +246,7 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
|
||||
document.removeEventListener(TouchEventType.TOUCH_END, onDragTouchUp);
|
||||
document.removeEventListener(MouseEventType.MOUSE_MOVE, onDragMouseMove);
|
||||
document.removeEventListener(TouchEventType.TOUCH_MOVE, onDragTouchMove);
|
||||
}
|
||||
};
|
||||
}, [ isDragging, onDragMouseUp, onDragMouseMove, onDragTouchUp, onDragTouchMove ]);
|
||||
|
||||
useEffect(() =>
|
||||
@ -267,4 +267,4 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
|
||||
{ children }
|
||||
</Base>, document.getElementById('draggable-windows-container'))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -62,7 +62,7 @@ export const LayoutAvatarImageView: FC<LayoutAvatarImageViewProps> = props =>
|
||||
const resetFigure = (_figure: string) =>
|
||||
{
|
||||
if(isDisposed.current) return;
|
||||
|
||||
|
||||
const avatarImage = GetAvatarRenderManager().createAvatarImage(_figure, AvatarScaleType.LARGE, gender, { resetFigure: (figure: string) => resetFigure(figure), dispose: null, disposed: false });
|
||||
|
||||
let setType = AvatarSetType.FULL;
|
||||
@ -80,8 +80,8 @@ export const LayoutAvatarImageView: FC<LayoutAvatarImageViewProps> = props =>
|
||||
setAvatarUrl(imageUrl);
|
||||
}
|
||||
|
||||
avatarImage.dispose(true);
|
||||
}
|
||||
avatarImage.dispose();
|
||||
};
|
||||
|
||||
resetFigure(figure);
|
||||
}
|
||||
@ -90,14 +90,14 @@ export const LayoutAvatarImageView: FC<LayoutAvatarImageViewProps> = props =>
|
||||
useEffect(() =>
|
||||
{
|
||||
isDisposed.current = false;
|
||||
|
||||
|
||||
setIsReady(true);
|
||||
|
||||
return () =>
|
||||
{
|
||||
isDisposed.current = true;
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
return <Base classNames={ getClassNames } style={ getStyle } { ...rest } />;
|
||||
}
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user