Fix eslint issues

This commit is contained in:
Bill 2024-06-18 18:58:45 -04:00
parent df81cc7f92
commit 5bd351c3dc
570 changed files with 3584 additions and 3609 deletions

View File

@ -1,6 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true
[*] [*]
charset = utf-8 charset = utf-8
insert_final_newline = true
end_of_line = lf
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View File

@ -1,121 +0,0 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"react": {
"pragma": "React",
"version": "18.0.0"
}
},
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended"
],
"plugins": [
"@typescript-eslint",
"react"
],
"rules": {
"linebreak-style": [
"off"
],
"quotes": [
"error",
"single"
],
"@typescript-eslint/indent": [
"error",
4,
{
"SwitchCase": 1
}
],
"array-bracket-spacing": [
"error",
"always"
],
"brace-style": [
"error",
"allman"
],
"template-curly-spacing": [
"error",
"always"
],
"no-multi-spaces": [
"error"
],
"@typescript-eslint/object-curly-spacing": [
"error",
"always",
{
"arraysInObjects": true,
"objectsInObjects": false
}
],
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"String": true,
"Boolean": true,
"Number": true,
"Symbol": true,
"{}": false,
"Object": false,
"object": false,
"Function": false
},
"extendDefaults": true
}
],
"no-switch-case-fall-through": [
"off"
],
"jsx-quotes": [
"error"
],
"react/prop-types": [
"off"
],
"react/jsx-curly-spacing": [
"error",
{
"when": "always",
"children": true
}
],
"react/jsx-equals-spacing": [
"error"
],
"react/jsx-newline": [
"error",
{
"prevent": true
}
],
"react/jsx-sort-props": [
"error",
{
"callbacksLast": true,
"shorthandFirst": true,
"shorthandLast": false,
"ignoreCase": true,
"noSortAlphabetically": false,
"reservedFirst": true
}
]
}
}

22
.vscode/settings.json vendored
View File

@ -6,7 +6,7 @@
"typescript.format.placeOpenBraceOnNewLineForFunctions": true, "typescript.format.placeOpenBraceOnNewLineForFunctions": true,
"editor.wordWrap": "on", "editor.wordWrap": "on",
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit", "source.fixAll.eslint": "always",
"source.fixAll.sortJSON": "never", "source.fixAll.sortJSON": "never",
"source.organizeImports": "always" "source.organizeImports": "always"
}, },
@ -17,10 +17,7 @@
"files.trimFinalNewlines": true, "files.trimFinalNewlines": true,
"emmet.showExpandedAbbreviation": "never", "emmet.showExpandedAbbreviation": "never",
"eslint.format.enable": true, "eslint.format.enable": true,
"eslint.validate": [ "eslint.validate": ["javascript", "typescript"],
"javascript",
"typescript"
],
"eslint.workingDirectories": [ "eslint.workingDirectories": [
{ {
"pattern": "./src" "pattern": "./src"
@ -34,18 +31,9 @@
"css": "css" "css": "css"
}, },
"tailwindCSS.experimental.classRegex": [ "tailwindCSS.experimental.classRegex": [
[ ["classes \\=([^;]*);", "'([^']*)'"],
"classes \\=([^;]*);", ["classes \\=([^;]*);", "\"([^\"]*)\""],
"'([^']*)'" ["classes \\=([^;]*);", "\\`([^\\`]*)\\`"]
],
[
"classes \\=([^;]*);",
"\"([^\"]*)\""
],
[
"classes \\=([^;]*);",
"\\`([^\\`]*)\\`"
]
], ],
"editor.quickSuggestions": { "editor.quickSuggestions": {
"strings": true "strings": true

View File

@ -64,8 +64,6 @@ const generateShades = (colors) =>
} }
} }
console.log(colors)
return colors; return colors;
} }

138
eslint.config.mjs Normal file
View File

@ -0,0 +1,138 @@
import typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
import typescriptEslintParser from "@typescript-eslint/parser";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default [
{
files: ["**/*.jsx", "**/*.js", "**/*.tsx", "**/*.ts"],
plugins: {
react: reactPlugin,
"react-hooks": reactHooksPlugin,
"@typescript-eslint": typescriptEslintPlugin,
},
languageOptions: {
parser: typescriptEslintParser,
ecmaVersion: "latest",
parserOptions: {
sourceType: "module",
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
...typescriptEslintPlugin.configs.recommended.rules,
...typescriptEslintPlugin.configs[
"recommended-requiring-type-checking"
].rules,
'indent': [
'error',
4,
{
'SwitchCase': 1
}
],
'no-multi-spaces': [
'error'
],
'no-trailing-spaces': [
'error',
{
'skipBlankLines': false,
'ignoreComments': true
}
],
'linebreak-style': [
'off'
],
'quotes': [
'error',
'single'
],
'semi': [
'error',
'always'
],
'brace-style': [
'error',
'allman'
],
'object-curly-spacing': [
'error',
'always'
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/explicit-module-boundary-types': [
'off',
{
'allowedNames': [
'getMessageArray'
]
}
],
'@typescript-eslint/unbound-method': [
'off'
],
'@typescript-eslint/ban-ts-comment': [
'off'
],
'@typescript-eslint/no-empty-function': [
'error',
{
'allow': [
'functions',
'arrowFunctions',
'generatorFunctions',
'methods',
'generatorMethods',
'constructors'
]
}
],
'@typescript-eslint/no-unused-vars': [
'off'
],
'@typescript-eslint/ban-types': [
'error',
{
'types':
{
'String': true,
'Boolean': true,
'Number': true,
'Symbol': true,
'{}': false,
'Object': false,
'object': false,
'Function': false
},
'extendDefaults': true
}
],
'react/react-in-jsx-scope': 'off'
},
settings: {
react: {
version: "18.3.1",
},
},
},
];

View File

@ -1,50 +1,47 @@
{ {
"name": "nitro-react", "name": "nitro-react",
"version": "2.2", "version": "2.2",
"homepage": ".", "homepage": ".",
"private": true, "private": true,
"scripts": { "scripts": {
"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.2.0", "@tanstack/react-virtual": "3.2.0",
"@types/react-transition-group": "^4.4.10", "@types/react-transition-group": "^4.4.10",
"dompurify": "^3.1.0", "dompurify": "^3.1.5",
"react": "^18.2.0", "react": "^18.3.1",
"react-dom": "^18.2.0", "react-dom": "^18.3.1",
"react-icons": "^5.0.1", "react-icons": "^5.2.1",
"react-slider": "^2.0.6", "react-slider": "^2.0.6",
"react-tiny-popover": "^8.0.4", "react-tiny-popover": "^8.0.4",
"react-transition-group": "^4.4.5", "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"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/forms": "^0.5.7", "@tailwindcss/forms": "^0.5.7",
"@types/node": "^20.11.30", "@types/node": "^20.11.30",
"@types/react": "^18.2.67", "@types/react": "^18.3.3",
"@types/react-dom": "^18.2.22", "@types/react-dom": "^18.3.0",
"@types/react-slider": "^1.3.6", "@types/react-slider": "^1.3.6",
"@typescript-eslint/eslint-plugin": "^7.3.1", "@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.3.1", "@typescript-eslint/parser": "^7.13.1",
"@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.19",
"eslint": "^8.57.0", "eslint": "^9.5.0",
"eslint-plugin-import": "^2.29.1", "eslint-plugin-react": "^7.34.2",
"eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-react-hooks": "^5.1.0-rc-1434af3d22-20240618",
"eslint-plugin-react": "^7.34.1", "postcss": "^8.4.38",
"eslint-plugin-react-hooks": "^4.6.0", "postcss-nested": "^6.0.1",
"postcss": "^8.4.38", "sass": "^1.77.4",
"postcss-nested": "^6.0.1", "tailwindcss": "^3.4.4",
"prettier": "^3.2.5", "typescript": "^5.4.5",
"prettier-plugin-tailwindcss": "^0.5.13", "typescript-eslint": "^7.13.1",
"sass": "^1.72.0", "vite": "^5.2.13",
"tailwindcss": "^3.4.3", "vite-tsconfig-paths": "^4.3.2"
"typescript": "^5.4.2", }
"vite": "^5.1.6",
"vite-tsconfig-paths": "^4.3.2"
}
} }

View File

@ -1,7 +0,0 @@
/** @type {import("prettier").Config} */
module.exports = {
plugins: [
'prettier-plugin-tailwindcss'
]
}

View File

@ -1,4 +1,25 @@
import { GetAssetManager, GetAvatarRenderManager, GetCommunication, GetConfiguration, GetLocalizationManager, GetRoomCameraWidgetManager, GetRoomEngine, GetRoomSessionManager, GetSessionDataManager, GetSoundManager, GetStage, GetTexturePool, GetTicker, HabboWebTools, LegacyExternalInterface, LoadGameUrlEvent, NitroLogger, NitroVersion, PrepareRenderer } from '@nitrots/nitro-renderer'; import
{
GetAssetManager,
GetAvatarRenderManager,
GetCommunication,
GetConfiguration,
GetLocalizationManager,
GetRoomCameraWidgetManager,
GetRoomEngine,
GetRoomSessionManager,
GetSessionDataManager,
GetSoundManager,
GetStage,
GetTexturePool,
GetTicker,
HabboWebTools,
LegacyExternalInterface,
LoadGameUrlEvent,
NitroLogger,
NitroVersion,
PrepareRenderer,
} from '@nitrots/nitro-renderer';
import { FC, useEffect, useState } from 'react'; import { FC, useEffect, useState } from 'react';
import { GetUIVersion } from './api'; import { GetUIVersion } from './api';
import { MainView } from './components/MainView'; import { MainView } from './components/MainView';
@ -8,15 +29,15 @@ import { classNames } from './layout';
NitroVersion.UI_VERSION = GetUIVersion(); NitroVersion.UI_VERSION = GetUIVersion();
export const App: FC<{}> = props => export const App: FC<{}> = (props) =>
{ {
const [ isReady, setIsReady ] = useState(false); const [isReady, setIsReady] = useState(false);
useMessageEvent<LoadGameUrlEvent>(LoadGameUrlEvent, event => useMessageEvent<LoadGameUrlEvent>(LoadGameUrlEvent, (event) =>
{ {
const parser = event.getParser(); const parser = event.getParser();
if (!parser) return; if(!parser) return;
LegacyExternalInterface.callGame('showGame', parser.url); LegacyExternalInterface.callGame('showGame', parser.url);
}); });
@ -27,78 +48,108 @@ export const App: FC<{}> = props =>
{ {
try try
{ {
if (!window.NitroConfig) throw new Error('NitroConfig is not defined!'); if(!window.NitroConfig)
throw new Error('NitroConfig is not defined!');
const renderer = await PrepareRenderer({ const renderer = await PrepareRenderer({
width, width,
height, height,
resolution: window.devicePixelRatio,
autoDensity: true, autoDensity: true,
backgroundAlpha: 0, backgroundAlpha: 0,
preference: 'webgl', preference: 'webgl',
eventMode: 'none', eventMode: 'none',
failIfMajorPerformanceCaveat: false failIfMajorPerformanceCaveat: false,
}); });
await GetConfiguration().init(); await GetConfiguration().init();
GetTicker().maxFPS = GetConfiguration().getValue<number>('system.fps.max', 24); GetTicker().maxFPS = GetConfiguration().getValue<number>(
NitroLogger.LOG_DEBUG = GetConfiguration().getValue<boolean>('system.log.debug', true); 'system.fps.max',
NitroLogger.LOG_WARN = GetConfiguration().getValue<boolean>('system.log.warn', false); 24,
NitroLogger.LOG_ERROR = GetConfiguration().getValue<boolean>('system.log.error', false);
NitroLogger.LOG_EVENTS = GetConfiguration().getValue<boolean>('system.log.events', false);
NitroLogger.LOG_PACKETS = GetConfiguration().getValue<boolean>('system.log.packets', false);
const assetUrls = GetConfiguration().getValue<string[]>('preload.assets.urls').map(url => GetConfiguration().interpolate(url)) ?? [];
await Promise.all(
[
GetRoomCameraWidgetManager().init(),
GetAssetManager().downloadAssets(assetUrls),
GetLocalizationManager().init(),
GetAvatarRenderManager().init(),
GetSoundManager().init(),
GetSessionDataManager().init(),
GetRoomSessionManager().init(),
GetCommunication().init(),
]
); );
NitroLogger.LOG_DEBUG = GetConfiguration().getValue<boolean>(
'system.log.debug',
true,
);
NitroLogger.LOG_WARN = GetConfiguration().getValue<boolean>(
'system.log.warn',
false,
);
NitroLogger.LOG_ERROR = GetConfiguration().getValue<boolean>(
'system.log.error',
false,
);
NitroLogger.LOG_EVENTS = GetConfiguration().getValue<boolean>(
'system.log.events',
false,
);
NitroLogger.LOG_PACKETS = GetConfiguration().getValue<boolean>(
'system.log.packets',
false,
);
const assetUrls =
GetConfiguration()
.getValue<string[]>('preload.assets.urls')
.map((url) => GetConfiguration().interpolate(url)) ??
[];
await Promise.all([
GetRoomCameraWidgetManager().init(),
GetAssetManager().downloadAssets(assetUrls),
GetLocalizationManager().init(),
GetAvatarRenderManager().init(),
GetSoundManager().init(),
GetSessionDataManager().init(),
GetRoomSessionManager().init(),
GetCommunication().init(),
]);
await GetRoomEngine().init(); await GetRoomEngine().init();
// new GameMessageHandler(); // new GameMessageHandler();
if (LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []); if(LegacyExternalInterface.available)
LegacyExternalInterface.call(
'legacyTrack',
'authentication',
'authok',
[],
);
HabboWebTools.sendHeartBeat(); HabboWebTools.sendHeartBeat();
setInterval(() => HabboWebTools.sendHeartBeat(), 10000); setInterval(() => HabboWebTools.sendHeartBeat(), 10000);
GetTicker().add(ticker => GetRoomEngine().update(ticker)); GetTicker().add((ticker) => GetRoomEngine().update(ticker));
GetTicker().add(ticker => renderer.render(GetStage())); GetTicker().add((ticker) => renderer.render(GetStage()));
GetTicker().add(ticker => GetTexturePool().run()); GetTicker().add((ticker) => GetTexturePool().run());
setIsReady(true); setIsReady(true);
// handle socket close // handle socket close
//canvas.addEventListener('webglcontextlost', () => instance.events.dispatchEvent(new NitroEvent(Nitro.WEBGL_CONTEXT_LOST))); //canvas.addEventListener('webglcontextlost', () => instance.events.dispatchEvent(new NitroEvent(Nitro.WEBGL_CONTEXT_LOST)));
} }
catch (err) catch (err)
{ {
NitroLogger.error(err); NitroLogger.error(err);
} }
} };
prepare(window.innerWidth, window.innerHeight); prepare(window.innerWidth, window.innerHeight);
}, []); }, []);
return ( return (
<div className={ classNames('w-full h-full overflow-hidden text-base', !(window.devicePixelRatio % 1) && '[image-rendering:pixelated]') }> <div
{ !isReady && className={classNames(
<LoadingView /> } 'w-full h-full overflow-hidden text-base',
{ isReady && <MainView /> } !(window.devicePixelRatio % 1) && '[image-rendering:pixelated]',
)}
>
{!isReady && <LoadingView />}
{isReady && <MainView />}
<div id="draggable-windows-container" /> <div id="draggable-windows-container" />
</div> </div>
); );
} };

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

@ -108,7 +108,7 @@ export class AvatarEditorThumbnailsHelper
} }
return container; return container;
} };
return new Promise(async (resolve, reject) => return new Promise(async (resolve, reject) =>
{ {
@ -120,7 +120,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 }`);
@ -172,7 +172,7 @@ export class AvatarEditorThumbnailsHelper
AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl); AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl);
resolve(imageUrl); resolve(imageUrl);
} };
resetFigure(figureString); resetFigure(figureString);
}); });

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) =>
{ {
@ -27,7 +27,7 @@ export const GetOfferNodes = (offerNodes: Map<number, ICatalogNode[]>, offerId:
} }
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[]) =>
{ {
@ -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

@ -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

@ -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

@ -3,4 +3,4 @@ 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

@ -10,4 +10,4 @@ export const GetGroupChatData = (extraData: string) =>
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

@ -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

@ -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

@ -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) =>
{ {
@ -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

@ -24,7 +24,7 @@ export const 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

@ -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[]) =>
{ {
@ -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

@ -49,7 +49,7 @@ export const parseTradeItems = (items: ItemDataStructure[]) =>
} }
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

@ -12,4 +12,4 @@ export const OpenUrl = (url: string) =>
{ {
CreateLinkEvent(url); CreateLinkEvent(url);
} }
} };

View File

@ -51,4 +51,4 @@ export const DispatchMouseEvent = (event: MouseEvent, canvasId: number = 1) =>
} }
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

@ -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

@ -2,11 +2,11 @@ import { CatalogPageMessageProductData, FurnitureType, GetSessionDataManager, IF
export function GetFurnitureDataForProductOffer(offer: CatalogPageMessageProductData): IFurnitureData export function GetFurnitureDataForProductOffer(offer: CatalogPageMessageProductData): IFurnitureData
{ {
if(!offer) return null; if (!offer) return null;
let furniData: IFurnitureData = null; let furniData: IFurnitureData = null;
switch((offer.productType.toUpperCase())) switch ((offer.productType.toUpperCase()) as FurnitureType)
{ {
case FurnitureType.FLOOR: case FurnitureType.FLOOR:
furniData = GetSessionDataManager().getFloorItemData(offer.furniClassId); furniData = GetSessionDataManager().getFloorItemData(offer.furniClassId);

View File

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

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

@ -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

@ -12,9 +12,9 @@ export const GetDiskColor = (name: string) =>
let b: number = 0; let b: number = 0;
let index: number = 0; let index: number = 0;
while (index < name.length) while(index < name.length)
{ {
switch ((index % 3)) switch((index % 3))
{ {
case 0: case 0:
r = (r + ( name.charCodeAt(index) * 37) ); r = (r + ( name.charCodeAt(index) * 37) );
@ -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

@ -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

@ -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

@ -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

@ -29,31 +29,31 @@ export const Base: FC<BaseProps<HTMLDivElement>> = props =>
{ {
const newClassNames: string[] = []; const newClassNames: string[] = [];
if (display && display.length) newClassNames.push(display); if(display && display.length) newClassNames.push(display);
if (fit || fullWidth) newClassNames.push('w-full'); if(fit || fullWidth) newClassNames.push('w-full');
if (fit || fullHeight) newClassNames.push('h-full'); if(fit || fullHeight) newClassNames.push('h-full');
if (fitV) newClassNames.push('vw-full', 'vh-full'); if(fitV) newClassNames.push('vw-full', 'vh-full');
if (grow) newClassNames.push('!flex-grow'); if(grow) newClassNames.push('!flex-grow');
if (shrink) newClassNames.push('!flex-shrink-0'); if(shrink) newClassNames.push('!flex-shrink-0');
if (overflow) newClassNames.push('overflow-' + overflow); if(overflow) newClassNames.push('overflow-' + overflow);
if (position) newClassNames.push(position); if(position) newClassNames.push(position);
if (float) newClassNames.push('float-' + float); if(float) newClassNames.push('float-' + float);
if (pointer) newClassNames.push('cursor-pointer'); if(pointer) newClassNames.push('cursor-pointer');
if (visible !== null) newClassNames.push(visible ? 'visible' : 'invisible'); if(visible !== null) newClassNames.push(visible ? 'visible' : 'invisible');
if (textColor) newClassNames.push('text-' + textColor); if(textColor) newClassNames.push('text-' + textColor);
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ display, fit, fitV, grow, shrink, fullWidth, fullHeight, overflow, position, float, pointer, visible, textColor, classNames ]); }, [ display, fit, fitV, grow, shrink, fullWidth, fullHeight, overflow, position, float, pointer, visible, textColor, classNames ]);
@ -62,7 +62,7 @@ export const Base: FC<BaseProps<HTMLDivElement>> = props =>
{ {
let newClassName = getClassNames.join(' '); let newClassName = getClassNames.join(' ');
if (className.length) newClassName += (' ' + className); if(className.length) newClassName += (' ' + className);
return newClassName.trim(); return newClassName.trim();
}, [ getClassNames, className ]); }, [ getClassNames, className ]);
@ -71,7 +71,7 @@ export const Base: FC<BaseProps<HTMLDivElement>> = props =>
{ {
let newStyle: CSSProperties = {}; let newStyle: CSSProperties = {};
if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; if(Object.keys(style).length) newStyle = { ...newStyle, ...style };
return newStyle; return newStyle;
}, [ style ]); }, [ style ]);
@ -81,4 +81,4 @@ export const Base: FC<BaseProps<HTMLDivElement>> = props =>
{ children } { children }
</div> </div>
); );
} };

View File

@ -21,48 +21,48 @@ export const Button: FC<ButtonProps> = props =>
const newClassNames: string[] = [ 'pointer-events-auto inline-block font-normal leading-normal text-[#fff] text-center no-underline align-middle cursor-pointer select-none border-[1px] border-[solid] border-[transparent] px-[.75rem] py-[.375rem] text-[.9rem] rounded-[.25rem] [transition:color_.15s_ease-in-out,_background-color_.15s_ease-in-out,_border-color_.15s_ease-in-out,_box-shadow_.15s_ease-in-out]' ]; const newClassNames: string[] = [ 'pointer-events-auto inline-block font-normal leading-normal text-[#fff] text-center no-underline align-middle cursor-pointer select-none border-[1px] border-[solid] border-[transparent] px-[.75rem] py-[.375rem] text-[.9rem] rounded-[.25rem] [transition:color_.15s_ease-in-out,_background-color_.15s_ease-in-out,_border-color_.15s_ease-in-out,_box-shadow_.15s_ease-in-out]' ];
if (variant) if(variant)
{ {
if (variant == 'primary') if(variant == 'primary')
newClassNames.push('text-white bg-[#1e7295] border-[#1e7295] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#1a617f] hover:border-[#185b77]'); newClassNames.push('text-white bg-[#1e7295] border-[#1e7295] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#1a617f] hover:border-[#185b77]');
if (variant == 'success') if(variant == 'success')
newClassNames.push('text-white bg-[#00800b] border-[#00800b] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#006d09] hover:border-[#006609]'); newClassNames.push('text-white bg-[#00800b] border-[#00800b] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#006d09] hover:border-[#006609]');
if (variant == 'danger') if(variant == 'danger')
newClassNames.push('text-white bg-[#a81a12] border-[#a81a12] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#8f160f] hover:border-[#86150e]'); newClassNames.push('text-white bg-[#a81a12] border-[#a81a12] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#8f160f] hover:border-[#86150e]');
if (variant == 'warning') if(variant == 'warning')
newClassNames.push('text-white bg-[#ffc107] border-[#ffc107] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-[#000] hover:bg-[#ffca2c] hover:border-[#ffc720]'); newClassNames.push('text-white bg-[#ffc107] border-[#ffc107] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-[#000] hover:bg-[#ffca2c] hover:border-[#ffc720]');
if (variant == 'black') if(variant == 'black')
newClassNames.push('text-white bg-[#000] border-[#000] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#000] hover:border-[#000]') newClassNames.push('text-white bg-[#000] border-[#000] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#000] hover:border-[#000]');
if (variant == 'secondary') if(variant == 'secondary')
newClassNames.push('text-white bg-[#185d79] border-[#185d79] [box-shadow:inset_0_2px_#ffffff26,_inset_0_-2px_#0000001a,_0_1px_#0000001a] hover:text-white hover:bg-[#144f67] hover:border-[#134a61]') newClassNames.push('text-white bg-[#185d79] border-[#185d79] [box-shadow:inset_0_2px_#ffffff26,_inset_0_-2px_#0000001a,_0_1px_#0000001a] hover:text-white hover:bg-[#144f67] hover:border-[#134a61]');
if (variant == 'dark') if(variant == 'dark')
newClassNames.push('text-white bg-dark [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#18181bfb] hover:border-[#161619fb]') newClassNames.push('text-white bg-dark [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#18181bfb] hover:border-[#161619fb]');
} }
if (size) if(size)
{ {
if (size == 'sm') if(size == 'sm')
{ {
newClassNames.push('!px-[.5rem] !py-[.25rem] !text-[.7875rem] !rounded-[.2rem] !min-h-[28px]'); newClassNames.push('!px-[.5rem] !py-[.25rem] !text-[.7875rem] !rounded-[.2rem] !min-h-[28px]');
} }
} }
if (active) newClassNames.push('active'); if(active) newClassNames.push('active');
if (disabled) newClassNames.push('pointer-events-none opacity-[.65] [box-shadow:none]'); if(disabled) newClassNames.push('pointer-events-none opacity-[.65] [box-shadow:none]');
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ 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,28 +19,28 @@ export const Column: FC<ColumnProps> = props =>
{ {
const newClassNames: string[] = []; const newClassNames: string[] = [];
if (size) if(size)
{ {
let colClassName = `col-span-${ size }`; let colClassName = `col-span-${ size }`;
if (isCssGrid) colClassName = `${ colClassName }`; if(isCssGrid) colClassName = `${ colClassName }`;
newClassNames.push(colClassName); newClassNames.push(colClassName);
} }
if (offset) if(offset)
{ {
let colClassName = `offset-${ offset }`; let colClassName = `offset-${ offset }`;
if (isCssGrid) colClassName = `g-start-${ offset }`; if(isCssGrid) colClassName = `g-start-${ offset }`;
newClassNames.push(colClassName); newClassNames.push(colClassName);
} }
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ 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

@ -21,30 +21,30 @@ export const Flex: FC<FlexProps> = props =>
{ {
const newClassNames: string[] = []; const newClassNames: string[] = [];
if (column) if(column)
{ {
if (reverse) newClassNames.push('flex-col-span-reverse'); if(reverse) newClassNames.push('flex-col-span-reverse');
else newClassNames.push('flex-col'); else newClassNames.push('flex-col');
} }
else else
{ {
if (reverse) newClassNames.push('flex-row-reverse'); if(reverse) newClassNames.push('flex-row-reverse');
} }
if (gap) newClassNames.push('gap-' + gap); if(gap) newClassNames.push('gap-' + gap);
if (alignSelf) newClassNames.push('self-' + alignSelf); if(alignSelf) newClassNames.push('self-' + alignSelf);
if (alignItems) newClassNames.push('items-' + alignItems); if(alignItems) newClassNames.push('items-' + alignItems);
if (justifyContent) newClassNames.push('justify-' + justifyContent); if(justifyContent) newClassNames.push('justify-' + justifyContent);
if (!alignItems && !justifyContent && center) newClassNames.push('items-center', 'justify-center'); if(!alignItems && !justifyContent && center) newClassNames.push('items-center', 'justify-center');
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ column, reverse, gap, center, alignSelf, alignItems, justifyContent, classNames ]); }, [ column, reverse, gap, center, alignSelf, alignItems, justifyContent, classNames ]);
return <Base classNames={ getClassNames } display={ display } { ...rest } />; return <Base classNames={ getClassNames } display={ display } { ...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

@ -24,23 +24,23 @@ export const Grid: FC<GridProps> = props =>
const newClassNames: string[] = []; const newClassNames: string[] = [];
if (inline) newClassNames.push('inline-grid'); if(inline) newClassNames.push('inline-grid');
else newClassNames.push('grid grid-rows-[repeat(var(--bs-rows,_1),_1fr)] grid-cols-[repeat(var(--bs-columns,_12),_1fr)]'); else newClassNames.push('grid grid-rows-[repeat(var(--bs-rows,_1),_1fr)] grid-cols-[repeat(var(--bs-columns,_12),_1fr)]');
if (gap) newClassNames.push('gap-' + gap); if(gap) newClassNames.push('gap-' + gap);
else if (gap === 0) newClassNames.push('gap-0'); else if(gap === 0) newClassNames.push('gap-0');
if (maxContent) newClassNames.push('[flex-basis:max-content]'); if(maxContent) newClassNames.push('[flex-basis:max-content]');
if (alignSelf) newClassNames.push('self-' + alignSelf); if(alignSelf) newClassNames.push('self-' + alignSelf);
if (alignItems) newClassNames.push('items-' + alignItems); if(alignItems) newClassNames.push('items-' + alignItems);
if (justifyContent) newClassNames.push('justify-' + justifyContent); if(justifyContent) newClassNames.push('justify-' + justifyContent);
if (!alignItems && !justifyContent && center) newClassNames.push('items-center', 'justify-center'); if(!alignItems && !justifyContent && center) newClassNames.push('items-center', 'justify-center');
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ inline, gap, maxContent, alignSelf, alignItems, justifyContent, center, classNames ]); }, [ inline, gap, maxContent, alignSelf, alignItems, justifyContent, center, classNames ]);
@ -49,9 +49,9 @@ export const Grid: FC<GridProps> = props =>
{ {
let newStyle: CSSProperties = {}; let newStyle: CSSProperties = {};
if (columnCount) newStyle['--bs-columns'] = columnCount.toString(); if(columnCount) newStyle['--bs-columns'] = columnCount.toString();
if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; if(Object.keys(style).length) newStyle = { ...newStyle, ...style };
return newStyle; return newStyle;
}, [ columnCount, style ]); }, [ columnCount, style ]);
@ -61,4 +61,4 @@ export const Grid: FC<GridProps> = props =>
<Base classNames={ getClassNames } fullHeight={ fullHeight } style={ getStyle } { ...rest } /> <Base classNames={ getClassNames } fullHeight={ fullHeight } 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

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

View File

@ -1,58 +1,40 @@
// @flow strict import { FC, PropsWithChildren, useEffect, useRef, useState } from 'react';
'use client'
import { useEffect, useRef, useState } from 'react';
function ReactPopover({ export const ReactPopover: FC<PropsWithChildren<{
children, content: JSX.Element;
content, trigger?: 'click' | 'hover';
trigger = 'click' }>> = props =>
})
{ {
const { content = null, trigger = null, children = null } = props;
const [ show, setShow ] = useState(false); const [ show, setShow ] = useState(false);
const wrapperRef = useRef(null); const wrapperRef = useRef(null);
const handleMouseOver = () => const handleMouseOver = () => (trigger === 'hover') && setShow(true);
{
if (trigger === 'hover')
{
setShow(true);
};
};
const handleMouseLeft = () => const handleMouseLeft = () => (trigger === 'hover') && setShow(false);
{
if (trigger === 'hover')
{
setShow(false);
};
};
useEffect(() => useEffect(() =>
{ {
function handleClickOutside(event) if(!show) return;
{
if (wrapperRef.current && !wrapperRef.current.contains(event.target))
{
setShow(false);
}
}
if (show) const handleClickOutside = (event: MouseEvent) =>
{ {
// Bind the event listener if(wrapperRef.current && !wrapperRef.current.contains(event.target)) setShow(false);
document.addEventListener('mousedown', handleClickOutside); };
return () =>
{ document.addEventListener('mousedown', handleClickOutside);
// Unbind the event listener on clean up
document.removeEventListener('mousedown', handleClickOutside); return () =>
}; {
} // Unbind the event listener on clean up
document.removeEventListener('mousedown', handleClickOutside);
};
}, [ show, wrapperRef ]); }, [ show, wrapperRef ]);
return ( return (
<div <div
ref={ wrapperRef } ref={ wrapperRef }
className="w-fit h-fit relative flex justify-center" className="relative flex justify-center w-fit h-fit"
onMouseEnter={ handleMouseOver } onMouseEnter={ handleMouseOver }
onMouseLeave={ handleMouseLeft }> onMouseLeave={ handleMouseLeft }>
<div <div
@ -70,5 +52,3 @@ function ReactPopover({
</div> </div>
); );
}; };
export default ReactPopover;

View File

@ -28,36 +28,36 @@ export const Text: FC<TextProps> = props =>
{ {
const newClassNames: string[] = [ 'inline' ]; const newClassNames: string[] = [ 'inline' ];
if (variant) newClassNames.push('text-' + variant); if(variant) newClassNames.push('text-' + variant);
if (bold) newClassNames.push('font-bold '); if(bold) newClassNames.push('font-bold ');
if (fontWeight) newClassNames.push('font-' + fontWeight); if(fontWeight) newClassNames.push('font-' + fontWeight);
if (fontSize) newClassNames.push('fs-' + fontSize); if(fontSize) newClassNames.push('fs-' + fontSize);
if (align) newClassNames.push('text-' + align); if(align) newClassNames.push('text-' + align);
if (underline) newClassNames.push('underline'); if(underline) newClassNames.push('underline');
if (italics) newClassNames.push('italic'); if(italics) newClassNames.push('italic');
if (truncate) newClassNames.push('text-truncate'); if(truncate) newClassNames.push('text-truncate');
if (center) newClassNames.push('text-center'); if(center) newClassNames.push('text-center');
if (textEnd) newClassNames.push('text-end'); if(textEnd) newClassNames.push('text-end');
if (small) newClassNames.push('text-sm'); if(small) newClassNames.push('text-sm');
if (wrap) newClassNames.push('text-wrap'); if(wrap) newClassNames.push('text-wrap');
if (noWrap) newClassNames.push('text-nowrap'); if(noWrap) newClassNames.push('text-nowrap');
if (textBreak) newClassNames.push('text-break'); if(textBreak) newClassNames.push('text-break');
return newClassNames; return newClassNames;
}, [ 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

@ -10,10 +10,10 @@ export const NitroCardContentView: FC<ColumnProps> = props =>
// Theme Changer // Theme Changer
const newClassNames: string[] = [ 'container-fluid', 'h-full p-[8px] overflow-auto', 'bg-light' ]; const newClassNames: string[] = [ 'container-fluid', 'h-full p-[8px] overflow-auto', 'bg-light' ];
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ 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

@ -21,7 +21,7 @@ export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
{ {
event.stopPropagation(); event.stopPropagation();
event.nativeEvent.stopImmediatePropagation(); event.nativeEvent.stopImmediatePropagation();
} };
return ( return (
<Column center className={ 'relative flex items-center justify-center flex-col drag-handler min-h-card-header max-h-card-header bg-card-header' } { ...rest }> <Column center className={ 'relative flex items-center justify-center flex-col drag-handler min-h-card-header max-h-card-header bg-card-header' } { ...rest }>
@ -38,4 +38,4 @@ export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
</Flex> </Flex>
</Column> </Column>
); );
} };

View File

@ -22,7 +22,7 @@ export const NitroCardView: FC<NitroCardViewProps> = props =>
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames ]); }, [ classNames ]);
@ -34,4 +34,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

@ -20,7 +20,7 @@ export const NitroCardAccordionSetView: FC<NitroCardAccordionSetViewProps> = pro
closeAll(); closeAll();
setIsOpen(prevValue => !prevValue); setIsOpen(prevValue => !prevValue);
} };
const onClose = useCallback(() => setIsOpen(false), []); const onClose = useCallback(() => setIsOpen(false), []);
@ -65,7 +65,7 @@ export const NitroCardAccordionSetView: FC<NitroCardAccordionSetViewProps> = pro
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

@ -22,4 +22,4 @@ export const NitroCardAccordionView: FC<NitroCardAccordionViewProps> = props =>
<Column gap={ 0 } { ...rest } /> <Column gap={ 0 } { ...rest } />
</NitroCardAccordionContextProvider> </NitroCardAccordionContextProvider>
); );
} };

View File

@ -19,7 +19,7 @@ export const NitroCardTabsItemView: FC<NitroCardTabsItemViewProps> = props =>
//if (isActive) newClassNames.push('bg-[#dfdfdf] border-b-[1px_solid_black]'); //if (isActive) newClassNames.push('bg-[#dfdfdf] border-b-[1px_solid_black]');
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ isActive, classNames ]); }, [ isActive, classNames ]);
@ -33,4 +33,4 @@ export const NitroCardTabsItemView: FC<NitroCardTabsItemViewProps> = props =>
<LayoutItemCountView count={ count } /> } <LayoutItemCountView count={ count } /> }
</Flex> </Flex>
); );
} };

View File

@ -9,7 +9,7 @@ export const NitroCardTabsView: FC<FlexProps> = props =>
{ {
const newClassNames: string[] = [ 'justify-center gap-0.5 flex bg-card-tabs min-h-card-tabs max-h-card-tabs pt-1 border-b border-card-border px-2' ]; const newClassNames: string[] = [ 'justify-center gap-0.5 flex bg-card-tabs min-h-card-tabs max-h-card-tabs pt-1 border-b border-card-border px-2' ];
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames ]); }, [ classNames ]);
@ -19,4 +19,4 @@ export const NitroCardTabsView: FC<FlexProps> = props =>
{ children } { children }
</Flex> </Flex>
); );
} };

View File

@ -169,7 +169,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);
} }
@ -201,7 +201,7 @@ 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(() =>
@ -227,7 +227,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(() =>
@ -245,7 +245,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(() =>
@ -266,4 +266,4 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
{ children } { children }
</div>, document.getElementById('draggable-windows-container')) </div>, document.getElementById('draggable-windows-container'))
); );
} };

View File

@ -24,7 +24,7 @@ export const LayoutAvatarImageView: FC<LayoutAvatarImageViewProps> = props =>
{ {
const newClassNames: string[] = [ 'avatar-image relative w-[90px] h-[130px] bg-no-repeat bg-[center_-8px] pointer-events-none' ]; const newClassNames: string[] = [ 'avatar-image relative w-[90px] h-[130px] bg-no-repeat bg-[center_-8px] pointer-events-none' ];
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames ]); }, [ classNames ]);
@ -33,27 +33,27 @@ export const LayoutAvatarImageView: FC<LayoutAvatarImageViewProps> = props =>
{ {
let newStyle: CSSProperties = {}; let newStyle: CSSProperties = {};
if (avatarUrl && avatarUrl.length) newStyle.backgroundImage = `url('${ avatarUrl }')`; if(avatarUrl && avatarUrl.length) newStyle.backgroundImage = `url('${ avatarUrl }')`;
if (scale !== 1) if(scale !== 1)
{ {
newStyle.transform = `scale(${ scale })`; newStyle.transform = `scale(${ scale })`;
if (!(scale % 1)) newStyle.imageRendering = 'pixelated'; if(!(scale % 1)) newStyle.imageRendering = 'pixelated';
} }
if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; if(Object.keys(style).length) newStyle = { ...newStyle, ...style };
return newStyle; return newStyle;
}, [ avatarUrl, scale, style ]); }, [ avatarUrl, scale, style ]);
useEffect(() => useEffect(() =>
{ {
if (!isReady) return; if(!isReady) return;
const figureKey = [ figure, gender, direction, headOnly ].join('-'); const figureKey = [ figure, gender, direction, headOnly ].join('-');
if (AVATAR_IMAGE_CACHE.has(figureKey)) if(AVATAR_IMAGE_CACHE.has(figureKey))
{ {
setAvatarUrl(AVATAR_IMAGE_CACHE.get(figureKey)); setAvatarUrl(AVATAR_IMAGE_CACHE.get(figureKey));
} }
@ -61,27 +61,27 @@ 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;
if (headOnly) setType = AvatarSetType.HEAD; if(headOnly) setType = AvatarSetType.HEAD;
avatarImage.setDirection(setType, direction); avatarImage.setDirection(setType, direction);
const imageUrl = avatarImage.processAsImageUrl(setType); const imageUrl = avatarImage.processAsImageUrl(setType);
if (imageUrl && !isDisposed.current) if(imageUrl && !isDisposed.current)
{ {
if (!avatarImage.isPlaceholder()) AVATAR_IMAGE_CACHE.set(figureKey, imageUrl); if(!avatarImage.isPlaceholder()) AVATAR_IMAGE_CACHE.set(figureKey, imageUrl);
setAvatarUrl(imageUrl); setAvatarUrl(imageUrl);
} }
avatarImage.dispose(true); avatarImage.dispose(true);
} };
resetFigure(figure); resetFigure(figure);
} }
@ -96,8 +96,8 @@ export const LayoutAvatarImageView: FC<LayoutAvatarImageViewProps> = props =>
return () => return () =>
{ {
isDisposed.current = true; isDisposed.current = true;
} };
}, []); }, []);
return <Base classNames={ getClassNames } style={ getStyle } { ...rest } />; return <Base classNames={ getClassNames } style={ getStyle } { ...rest } />;
} };

View File

@ -20,4 +20,4 @@ export const LayoutBackgroundImage: FC<LayoutBackgroundImageProps> = props =>
}, [ style, imageUrl ]); }, [ style, imageUrl ]);
return <Base fit={ fit } style={ getStyle } { ...rest } />; return <Base fit={ fit } style={ getStyle } { ...rest } />;
} };

View File

@ -22,11 +22,11 @@ export const LayoutBadgeImageView: FC<LayoutBadgeImageViewProps> = props =>
{ {
const newClassNames: string[] = [ 'relative w-[40px] h-[40px] bg-no-repeat bg-center' ]; const newClassNames: string[] = [ 'relative w-[40px] h-[40px] bg-no-repeat bg-center' ];
if (isGroup) newClassNames.push('group-badge'); if(isGroup) newClassNames.push('group-badge');
if (isGrayscale) newClassNames.push('grayscale'); if(isGrayscale) newClassNames.push('grayscale');
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames, isGroup, isGrayscale ]); }, [ classNames, isGroup, isGrayscale ]);
@ -35,37 +35,37 @@ export const LayoutBadgeImageView: FC<LayoutBadgeImageViewProps> = props =>
{ {
let newStyle: CSSProperties = {}; let newStyle: CSSProperties = {};
if (imageElement) if(imageElement)
{ {
newStyle.backgroundImage = `url(${ (isGroup) ? imageElement.src : GetConfigurationValue<string>('badge.asset.url').replace('%badgename%', badgeCode.toString()) })`; newStyle.backgroundImage = `url(${ (isGroup) ? imageElement.src : GetConfigurationValue<string>('badge.asset.url').replace('%badgename%', badgeCode.toString()) })`;
newStyle.width = imageElement.width; newStyle.width = imageElement.width;
newStyle.height = imageElement.height; newStyle.height = imageElement.height;
if (scale !== 1) if(scale !== 1)
{ {
newStyle.transform = `scale(${ scale })`; newStyle.transform = `scale(${ scale })`;
if (!(scale % 1)) newStyle.imageRendering = 'pixelated'; if(!(scale % 1)) newStyle.imageRendering = 'pixelated';
newStyle.width = (imageElement.width * scale); newStyle.width = (imageElement.width * scale);
newStyle.height = (imageElement.height * scale); newStyle.height = (imageElement.height * scale);
} }
} }
if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; if(Object.keys(style).length) newStyle = { ...newStyle, ...style };
return newStyle; return newStyle;
}, [ badgeCode, isGroup, imageElement, scale, style ]); }, [ badgeCode, isGroup, imageElement, scale, style ]);
useEffect(() => useEffect(() =>
{ {
if (!badgeCode || !badgeCode.length) return; if(!badgeCode || !badgeCode.length) return;
let didSetBadge = false; let didSetBadge = false;
const onBadgeImageReadyEvent = async (event: BadgeImageReadyEvent) => const onBadgeImageReadyEvent = async (event: BadgeImageReadyEvent) =>
{ {
if (event.badgeId !== badgeCode) return; if(event.badgeId !== badgeCode) return;
const element = await TextureUtils.generateImage(new NitroSprite(event.image)); const element = await TextureUtils.generateImage(new NitroSprite(event.image));
@ -74,13 +74,13 @@ export const LayoutBadgeImageView: FC<LayoutBadgeImageViewProps> = props =>
didSetBadge = true; didSetBadge = true;
GetEventDispatcher().removeEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent); GetEventDispatcher().removeEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent);
} };
GetEventDispatcher().addEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent); GetEventDispatcher().addEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent);
const texture = isGroup ? GetSessionDataManager().getGroupBadgeImage(badgeCode) : GetSessionDataManager().getBadgeImage(badgeCode); const texture = isGroup ? GetSessionDataManager().getGroupBadgeImage(badgeCode) : GetSessionDataManager().getBadgeImage(badgeCode);
if (texture && !didSetBadge) if(texture && !didSetBadge)
{ {
(async () => (async () =>
{ {
@ -103,4 +103,4 @@ export const LayoutBadgeImageView: FC<LayoutBadgeImageViewProps> = props =>
{ children } { children }
</Base> </Base>
); );
} };

View File

@ -39,4 +39,4 @@ export const LayoutCounterTimeView: FC<LayoutCounterTimeViewProps> = props =>
{ children } { children }
</div> </div>
); );
} };

View File

@ -15,7 +15,7 @@ export const LayoutCurrencyIcon: FC<CurrencyIconProps> = props =>
{ {
const newClassNames: string[] = [ 'nitro-currency-icon', 'bg-center bg-no-repeat w-[15px] h-[15px]' ]; const newClassNames: string[] = [ 'nitro-currency-icon', 'bg-center bg-no-repeat w-[15px] h-[15px]' ];
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames ]); }, [ classNames ]);
@ -35,10 +35,10 @@ export const LayoutCurrencyIcon: FC<CurrencyIconProps> = props =>
newStyle.backgroundImage = urlString; newStyle.backgroundImage = urlString;
if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; if(Object.keys(style).length) newStyle = { ...newStyle, ...style };
return newStyle; return newStyle;
}, [ style, urlString ]); }, [ style, urlString ]);
return <Base classNames={ getClassNames } style={ getStyle } { ...rest } /> return <Base classNames={ getClassNames } style={ getStyle } { ...rest } />;
} };

View File

@ -14,4 +14,4 @@ export const LayoutFurniIconImageView: FC<LayoutFurniIconImageViewProps> = props
const { productType = 's', productClassId = -1, extraData = '', ...rest } = props; const { productType = 's', productClassId = -1, extraData = '', ...rest } = props;
return <LayoutImage className="furni-image" imageUrl={ GetImageIconUrlForProduct(productType, productClassId, extraData) } { ...rest } />; return <LayoutImage className="furni-image" imageUrl={ GetImageIconUrlForProduct(productType, productClassId, extraData) } { ...rest } />;
} };

View File

@ -67,4 +67,4 @@ export const LayoutFurniImageView: FC<LayoutFurniImageViewProps> = props =>
if(!imageElement) return null; if(!imageElement) return null;
return <Base classNames={ [ 'furni-image' ] } style={ getStyle } { ...rest } />; return <Base classNames={ [ 'furni-image' ] } style={ getStyle } { ...rest } />;
} };

View File

@ -27,21 +27,21 @@ export const LayoutGridItem: FC<LayoutGridItemProps> = props =>
const newClassNames: string[] = [ 'layout-grid-item', 'border', 'border-2', 'border-muted', 'rounded' ]; const newClassNames: string[] = [ 'layout-grid-item', 'border', 'border-2', 'border-muted', 'rounded' ];
if (itemActive) newClassNames.push('!bg-[#ececec] !border-[#fff]'); if(itemActive) newClassNames.push('!bg-[#ececec] !border-[#fff]');
if (itemUniqueSoldout || (itemUniqueNumber > 0)) newClassNames.push('unique-item'); if(itemUniqueSoldout || (itemUniqueNumber > 0)) newClassNames.push('unique-item');
if (itemUniqueSoldout) newClassNames.push('sold-out'); if(itemUniqueSoldout) newClassNames.push('sold-out');
if (itemUnseen) newClassNames.push('unseen'); if(itemUnseen) newClassNames.push('unseen');
if (itemHighlight) newClassNames.push('has-highlight'); if(itemHighlight) newClassNames.push('has-highlight');
if (disabled) newClassNames.push('disabled') if(disabled) newClassNames.push('disabled');
if (itemImage === null) newClassNames.push('icon', 'loading-icon'); if(itemImage === null) newClassNames.push('icon', 'loading-icon');
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ itemActive, itemUniqueSoldout, itemUniqueNumber, itemUnseen, itemHighlight, disabled, itemImage, classNames ]); }, [ itemActive, itemUniqueSoldout, itemUniqueNumber, itemUnseen, itemHighlight, disabled, itemImage, classNames ]);
@ -50,11 +50,11 @@ export const LayoutGridItem: FC<LayoutGridItemProps> = props =>
{ {
let newStyle = { ...style }; let newStyle = { ...style };
if (itemImage && !(itemUniqueSoldout || (itemUniqueNumber > 0))) newStyle.backgroundImage = `url(${ itemImage })`; if(itemImage && !(itemUniqueSoldout || (itemUniqueNumber > 0))) newStyle.backgroundImage = `url(${ itemImage })`;
if (itemColor) newStyle.backgroundColor = itemColor; if(itemColor) newStyle.backgroundColor = itemColor;
if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; if(Object.keys(style).length) newStyle = { ...newStyle, ...style };
return newStyle; return newStyle;
}, [ style, itemImage, itemColor, itemUniqueSoldout, itemUniqueNumber ]); }, [ style, itemImage, itemColor, itemUniqueSoldout, itemUniqueNumber ]);
@ -73,4 +73,4 @@ export const LayoutGridItem: FC<LayoutGridItemProps> = props =>
{ children } { children }
</Column> </Column>
); );
} };

View File

@ -10,4 +10,4 @@ export const LayoutImage: FC<LayoutImageProps> = props =>
const { imageUrl = null, className = '', ...rest } = props; const { imageUrl = null, className = '', ...rest } = props;
return <img alt="" className={ 'no-select ' + className } src={ imageUrl } { ...rest } />; return <img alt="" className={ 'no-select ' + className } src={ imageUrl } { ...rest } />;
} };

View File

@ -14,7 +14,7 @@ export const LayoutItemCountView: FC<LayoutItemCountViewProps> = props =>
{ {
const newClassNames: string[] = [ 'inline-block px-[.65em] py-[.35em] text-[.75em] font-bold leading-none text-[#fff] text-center whitespace-nowrap align-baseline rounded-[.25rem]', '!border-[1px] !border-[solid] !border-[#283F5D]', 'border-black', 'bg-danger', 'px-1', 'top-[2px] right-[2px] text-[9.5px] px-[3px] py-[2px] ' ]; const newClassNames: string[] = [ 'inline-block px-[.65em] py-[.35em] text-[.75em] font-bold leading-none text-[#fff] text-center whitespace-nowrap align-baseline rounded-[.25rem]', '!border-[1px] !border-[solid] !border-[#283F5D]', 'border-black', 'bg-danger', 'px-1', 'top-[2px] right-[2px] text-[9.5px] px-[3px] py-[2px] ' ];
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames ]); }, [ classNames ]);
@ -25,4 +25,4 @@ export const LayoutItemCountView: FC<LayoutItemCountViewProps> = props =>
{ children } { children }
</Base> </Base>
); );
} };

View File

@ -12,4 +12,4 @@ export const LayoutLoadingSpinnerView: FC<BaseProps<HTMLDivElement>> = props =>
<Base className="spinner" /> <Base className="spinner" />
</Base> </Base>
); );
} };

View File

@ -17,18 +17,18 @@ export const LayoutMiniCameraView: FC<LayoutMiniCameraViewProps> = props =>
const getCameraBounds = () => const getCameraBounds = () =>
{ {
if (!elementRef || !elementRef.current) return null; if(!elementRef || !elementRef.current) return null;
const frameBounds = elementRef.current.getBoundingClientRect(); const frameBounds = elementRef.current.getBoundingClientRect();
return new NitroRectangle(Math.floor(frameBounds.x), Math.floor(frameBounds.y), Math.floor(frameBounds.width), Math.floor(frameBounds.height)); return new NitroRectangle(Math.floor(frameBounds.x), Math.floor(frameBounds.y), Math.floor(frameBounds.width), Math.floor(frameBounds.height));
} };
const takePicture = () => const takePicture = () =>
{ {
PlaySound(SoundNames.CAMERA_SHUTTER); PlaySound(SoundNames.CAMERA_SHUTTER);
textureReceiver(GetRoomEngine().createTextureFromRoom(roomId, 1, getCameraBounds())); textureReceiver(GetRoomEngine().createTextureFromRoom(roomId, 1, getCameraBounds()));
} };
return ( return (
<DraggableWindow handleSelector=".nitro-room-thumbnail-camera"> <DraggableWindow handleSelector=".nitro-room-thumbnail-camera">

View File

@ -32,4 +32,4 @@ export const LayoutNotificationAlertView: FC<LayoutNotificationAlertViewProps> =
</NitroCardContentView> </NitroCardContentView>
</NitroCardView> </NitroCardView>
); );
} };

View File

@ -18,7 +18,7 @@ export const LayoutNotificationBubbleView: FC<LayoutNotificationBubbleViewProps>
{ {
const newClassNames: string[] = [ 'text-sm bg-[#1c1c20f2] px-[5px] py-[6px] [box-shadow:inset_0_5px_#22222799,_inset_0_-4px_#12121599] ', 'rounded' ]; const newClassNames: string[] = [ 'text-sm bg-[#1c1c20f2] px-[5px] py-[6px] [box-shadow:inset_0_5px_#22222799,_inset_0_-4px_#12121599] ', 'rounded' ];
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames ]); }, [ classNames ]);
@ -32,7 +32,7 @@ export const LayoutNotificationBubbleView: FC<LayoutNotificationBubbleViewProps>
useEffect(() => useEffect(() =>
{ {
if (!fadesOut) return; if(!fadesOut) return;
const timeout = setTimeout(() => const timeout = setTimeout(() =>
{ {
@ -49,4 +49,4 @@ export const LayoutNotificationBubbleView: FC<LayoutNotificationBubbleViewProps>
<Flex classNames={ getClassNames } overflow={ overflow } onClick={ onClose } { ...rest } /> <Flex classNames={ getClassNames } overflow={ overflow } onClick={ onClose } { ...rest } />
</TransitionAnimation> </TransitionAnimation>
); );
} };

View File

@ -114,10 +114,10 @@ export const LayoutPetImageView: FC<LayoutPetImageViewProps> = props =>
return () => return () =>
{ {
isDisposed.current = true; isDisposed.current = true;
} };
}, []); }, []);
const url = `url('${ petUrl }')`; const url = `url('${ petUrl }')`;
return <Base classNames={ [ 'pet-image' ] } style={ getStyle } { ...rest } />; return <Base classNames={ [ 'pet-image' ] } style={ getStyle } { ...rest } />;
} };

View File

@ -19,12 +19,12 @@ export const LayoutPrizeProductImageView: FC<LayoutPrizeProductImageViewProps> =
{ {
case ProductTypeEnum.WALL: case ProductTypeEnum.WALL:
case ProductTypeEnum.FLOOR: case ProductTypeEnum.FLOOR:
return <LayoutFurniImageView productClassId={ classId } productType={ productType } /> return <LayoutFurniImageView productClassId={ classId } productType={ productType } />;
case ProductTypeEnum.BADGE: case ProductTypeEnum.BADGE:
return <LayoutBadgeImageView badgeCode={ extraParam }/> return <LayoutBadgeImageView badgeCode={ extraParam }/>;
case ProductTypeEnum.HABBO_CLUB: case ProductTypeEnum.HABBO_CLUB:
return <LayoutCurrencyIcon type="hc" /> return <LayoutCurrencyIcon type="hc" />;
} }
return null; return null;
} };

View File

@ -16,7 +16,7 @@ export const LayoutProgressBar: FC<LayoutProgressBarProps> = props =>
{ {
const newClassNames: string[] = [ 'border-[1px] border-[solid] border-[#fff] p-[2px] h-[20px] rounded-[.25rem] overflow-hidden bg-[#1E7295] ', 'text-white' ]; const newClassNames: string[] = [ 'border-[1px] border-[solid] border-[#fff] p-[2px] h-[20px] rounded-[.25rem] overflow-hidden bg-[#1E7295] ', 'text-white' ];
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames ]); }, [ classNames ]);
@ -29,4 +29,4 @@ export const LayoutProgressBar: FC<LayoutProgressBarProps> = props =>
{ children } { children }
</Column> </Column>
); );
} };

View File

@ -25,4 +25,4 @@ export const LayoutRarityLevelView: FC<LayoutRarityLevelViewProps> = props =>
{ children } { children }
</Base> </Base>
); );
} };

View File

@ -56,4 +56,4 @@ export const LayoutRoomObjectImageView: FC<LayoutRoomObjectImageViewProps> = pro
if(!imageElement) return null; if(!imageElement) return null;
return <Base classNames={ [ 'furni-image' ] } style={ getStyle } { ...rest } />; return <Base classNames={ [ 'furni-image' ] } style={ getStyle } { ...rest } />;
} };

View File

@ -15,7 +15,7 @@ export const LayoutRoomPreviewerView: FC<{
if(event.shiftKey) roomPreviewer.changeRoomObjectDirection(); if(event.shiftKey) roomPreviewer.changeRoomObjectDirection();
else roomPreviewer.changeRoomObjectState(); else roomPreviewer.changeRoomObjectState();
} };
useEffect(() => useEffect(() =>
{ {
@ -46,7 +46,7 @@ export const LayoutRoomPreviewerView: FC<{
canvas = null; canvas = null;
elementRef.current.style.backgroundImage = `url(${ base64 })`; elementRef.current.style.backgroundImage = `url(${ base64 })`;
} };
GetTicker().add(update); GetTicker().add(update);
@ -72,7 +72,7 @@ export const LayoutRoomPreviewerView: FC<{
resizeObserver.disconnect(); resizeObserver.disconnect();
texture.destroy(true); texture.destroy(true);
} };
}, [ roomPreviewer, elementRef, height ]); }, [ roomPreviewer, elementRef, height ]);
return ( return (
@ -86,4 +86,4 @@ export const LayoutRoomPreviewerView: FC<{
} } } }
onClick={ onClick } /> onClick={ onClick } />
); );
} };

View File

@ -16,14 +16,14 @@ export const LayoutRoomThumbnailView: FC<LayoutRoomThumbnailViewProps> = props =
{ {
const newClassNames: string[] = [ 'relative w-[110px] h-[110px] bg-[url("@/assets/images/navigator/thumbnail_placeholder.png")] bg-no-repeat bg-center', 'rounded', '!border-[1px] !border-[solid] !border-[#283F5D]' ]; const newClassNames: string[] = [ 'relative w-[110px] h-[110px] bg-[url("@/assets/images/navigator/thumbnail_placeholder.png")] bg-no-repeat bg-center', 'rounded', '!border-[1px] !border-[solid] !border-[#283F5D]' ];
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames ]); }, [ classNames ]);
const getImageUrl = useMemo(() => const getImageUrl = useMemo(() =>
{ {
if (customUrl && customUrl.length) return (GetConfigurationValue<string>('image.library.url') + customUrl); if(customUrl && customUrl.length) return (GetConfigurationValue<string>('image.library.url') + customUrl);
return (GetConfigurationValue<string>('thumbnails.url').replace('%thumbnail%', roomId.toString())); return (GetConfigurationValue<string>('thumbnails.url').replace('%thumbnail%', roomId.toString()));
}, [ customUrl, roomId ]); }, [ customUrl, roomId ]);
@ -34,4 +34,4 @@ export const LayoutRoomThumbnailView: FC<LayoutRoomThumbnailViewProps> = props =
{ children } { children }
</Base> </Base>
); );
} };

View File

@ -39,4 +39,4 @@ export const LayoutTrophyView: FC<LayoutTrophyViewProps> = props =>
</Column> </Column>
</DraggableWindow> </DraggableWindow>
); );
} };

View File

@ -16,7 +16,7 @@ export const UserProfileIconView: FC<UserProfileIconViewProps> = props =>
{ {
const newClassNames: string[] = [ 'bg-[url("@/assets/images/friends/friends-spritesheet.png")]', 'w-[13px] h-[11px] bg-[-51px_-91px]' ]; const newClassNames: string[] = [ 'bg-[url("@/assets/images/friends/friends-spritesheet.png")]', 'w-[13px] h-[11px] bg-[-51px_-91px]' ];
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames ]); }, [ classNames ]);
@ -26,4 +26,4 @@ export const UserProfileIconView: FC<UserProfileIconViewProps> = props =>
{ children } { children }
</Base> </Base>
); );
} };

View File

@ -32,4 +32,4 @@ export const LayoutLimitedEditionCompactPlateView: FC<LayoutLimitedEditionCompac
{ children } { children }
</Base> </Base>
); );
} };

View File

@ -18,7 +18,7 @@ export const LayoutLimitedEditionCompletePlateView: FC<LayoutLimitedEditionCompl
{ {
const newClassNames: string[] = [ 'unique-complete-plate' ]; const newClassNames: string[] = [ 'unique-complete-plate' ];
if (classNames.length) newClassNames.push(...classNames); if(classNames.length) newClassNames.push(...classNames);
return newClassNames; return newClassNames;
}, [ classNames ]); }, [ classNames ]);
@ -37,4 +37,4 @@ export const LayoutLimitedEditionCompletePlateView: FC<LayoutLimitedEditionCompl
</Column> </Column>
</Base> </Base>
); );
} };

View File

@ -15,4 +15,4 @@ export const LayoutLimitedEditionStyledNumberView: FC<LayoutLimitedEditionStyled
{ numbers.map((number, index) => <i key={ index } className={ 'limited-edition-number n-' + number } />) } { numbers.map((number, index) => <i key={ index } className={ 'limited-edition-number n-' + number } />) }
</> </>
); );
} };

View File

@ -37,7 +37,7 @@ export const TransitionAnimation: FC<TransitionAnimationProps> = props =>
return () => return () =>
{ {
if(timeoutData) clearTimeout(timeoutData); if(timeoutData) clearTimeout(timeoutData);
} };
}, [ inProp, timeout ]); }, [ inProp, timeout ]);
return ( return (
@ -49,4 +49,4 @@ export const TransitionAnimation: FC<TransitionAnimationProps> = props =>
) } ) }
</Transition> </Transition>
); );
} };

View File

@ -5,130 +5,130 @@ import { TransitionAnimationTypes } from './TransitionAnimationTypes';
export function getTransitionAnimationStyle(type: string, transition: TransitionStatus, timeout: number = 300): Partial<CSSProperties> export function getTransitionAnimationStyle(type: string, transition: TransitionStatus, timeout: number = 300): Partial<CSSProperties>
{ {
switch (type) switch(type)
{ {
case TransitionAnimationTypes.BOUNCE: case TransitionAnimationTypes.BOUNCE:
switch (transition) switch(transition)
{ {
default: default:
return {} return {};
case ENTERING: case ENTERING:
return { return {
animationName: 'bounceIn', animationName: 'bounceIn',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
case EXITING: case EXITING:
return { return {
animationName: 'bounceOut', animationName: 'bounceOut',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
} }
case TransitionAnimationTypes.SLIDE_LEFT: case TransitionAnimationTypes.SLIDE_LEFT:
switch (transition) switch(transition)
{ {
default: default:
return {} return {};
case ENTERING: case ENTERING:
return { return {
animationName: 'slideInLeft', animationName: 'slideInLeft',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
case EXITING: case EXITING:
return { return {
animationName: 'slideOutLeft', animationName: 'slideOutLeft',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
} }
case TransitionAnimationTypes.SLIDE_RIGHT: case TransitionAnimationTypes.SLIDE_RIGHT:
switch (transition) switch(transition)
{ {
default: default:
return {} return {};
case ENTERING: case ENTERING:
return { return {
animationName: 'slideInRight', animationName: 'slideInRight',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
case EXITING: case EXITING:
return { return {
animationName: 'slideOutRight', animationName: 'slideOutRight',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
} }
case TransitionAnimationTypes.FLIP_X: case TransitionAnimationTypes.FLIP_X:
switch (transition) switch(transition)
{ {
default: default:
return {} return {};
case ENTERING: case ENTERING:
return { return {
animationName: 'flipInX', animationName: 'flipInX',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
case EXITING: case EXITING:
return { return {
animationName: 'flipOutX', animationName: 'flipOutX',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
} }
case TransitionAnimationTypes.FADE_UP: case TransitionAnimationTypes.FADE_UP:
switch (transition) switch(transition)
{ {
default: default:
return {} return {};
case ENTERING: case ENTERING:
return { return {
animationName: 'fadeInUp', animationName: 'fadeInUp',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
case EXITING: case EXITING:
return { return {
animationName: 'fadeOutDown', animationName: 'fadeOutDown',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
} }
case TransitionAnimationTypes.FADE_IN: case TransitionAnimationTypes.FADE_IN:
switch (transition) switch(transition)
{ {
default: default:
return {} return {};
case ENTERING: case ENTERING:
return { return {
animationName: 'fadeIn', animationName: 'fadeIn',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
case EXITING: case EXITING:
return { return {
animationName: 'fadeOut', animationName: 'fadeOut',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
} }
case TransitionAnimationTypes.FADE_DOWN: case TransitionAnimationTypes.FADE_DOWN:
switch (transition) switch(transition)
{ {
default: default:
return {} return {};
case ENTERING: case ENTERING:
return { return {
animationName: 'fadeInDown', animationName: 'fadeInDown',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
case EXITING: case EXITING:
return { return {
animationName: 'fadeOutUp', animationName: 'fadeOutUp',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
} }
case TransitionAnimationTypes.HEAD_SHAKE: case TransitionAnimationTypes.HEAD_SHAKE:
switch (transition) switch(transition)
{ {
default: default:
return {} return {};
case ENTERING: case ENTERING:
return { return {
animationName: 'headShake', animationName: 'headShake',
animationDuration: `${ timeout }ms` animationDuration: `${ timeout }ms`
} };
} }
} }

View File

@ -10,4 +10,4 @@ export const CreateTransitionToIcon = (image: HTMLImageElement, fromElement: HTM
event.iconName = icon; event.iconName = icon;
GetEventDispatcher().dispatchEvent(event); GetEventDispatcher().dispatchEvent(event);
} };

View File

@ -25,4 +25,4 @@ export const FriendlyTimeView: FC<FriendlyTimeViewProps> = props =>
const value = (Math.round(new Date().getSeconds()) - getStartSeconds); const value = (Math.round(new Date().getSeconds()) - getStartSeconds);
return <Base { ...rest }>{ isShort ? FriendlyTime.shortFormat(value) : FriendlyTime.format(value) }</Base>; return <Base { ...rest }>{ isShort ? FriendlyTime.shortFormat(value) : FriendlyTime.format(value) }</Base>;
} };

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