From 0218743efa6391b4fe72457c0069576c9a930327 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 4 May 2021 18:47:36 -0400 Subject: [PATCH] More updates --- public/configuration.json | 12 ++++---- src/App.tsx | 3 +- src/assets/styles/bootstrap/_variables.scss | 2 +- src/assets/styles/icons.scss | 2 +- src/assets/styles/scrollbars.scss | 4 ++- src/assets/styles/utils.scss | 4 +++ src/utils/GetConfiguration.ts | 6 ++++ src/utils/currency-icon/CurrencyIcon.tsx | 4 +-- src/views/badge-image/BadgeImageView.tsx | 6 ++-- src/views/friend-list/FriendListView.tsx | 2 -- src/views/hotel-view/HotelView.tsx | 15 +++++----- src/views/purse/PurseView.tsx | 7 +++-- src/views/purse/currency/CurrencyView.scss | 7 ----- src/views/purse/currency/CurrencyView.tsx | 28 +++++++++++++++---- src/views/room-host/RoomHostView.tsx | 2 +- .../stickie/FurnitureStickieView.tsx | 4 +-- 16 files changed, 66 insertions(+), 42 deletions(-) create mode 100644 src/utils/GetConfiguration.ts diff --git a/public/configuration.json b/public/configuration.json index 08aa7125..aa047b94 100644 --- a/public/configuration.json +++ b/public/configuration.json @@ -1,8 +1,8 @@ { "socket.url": "wss://ws.nitrots.co:2096", - "asset.url": "https://nitro-assets.hrw.pw", - "image.library.url": "https://swf.hrw.pw/c_images/", - "external.samples.url": "https://swf.hrw.pw/dcr/hof_furni/mp3/sound_machine_sample_%sample%.mp3", + "asset.url": "https://nitro.nitrots.co", + "image.library.url": "https://swf.nitrots.co/c_images/", + "external.samples.url": "https://swf.nitrots.co/dcr/hof_furni/mp3/sound_machine_sample_%sample%.mp3", "image.library.notifications.url": "${image.library.url}notifications/%image%.png", "achievements.images.url": "${image.library.url}Quests/%image%.png", "thumbnails.url": "${image.library.url}camera/thumbnails/%thumbnail%.png", @@ -10,8 +10,8 @@ "gamedata.url": "${asset.url}/gamedata", "sounds.url": "${asset.url}/sounds", "external.texts.url": "${gamedata.url}/json/ExternalTexts.json", - "furnidata.url": "https://gamedata.hrw.pw/gamedata/json/furnidata/1", - "productdata.url": "https://gamedata.hrw.pw/gamedata/json/productdata/1", + "furnidata.url": "https://nitro.nitrots.co/gamedata/json/FurnitureData.json", + "productdata.url": "https://nitro.nitrots.co/gamedata/json/ProductData.json", "avatar.actions.url": "${gamedata.url}/json/HabboAvatarActions.json", "avatar.figuredata.url": "${gamedata.url}/habbo/figuredata.xml", "avatar.figuremap.url": "${gamedata.url}/json/FigureMap.json", @@ -117,7 +117,7 @@ "elephants" ], "furni.asset.url": "${asset.url}/bundled/furniture/%libname%.nitro", - "furni.asset.icon.url": "https://swf.hrw.pw/dcr/hof_furni/icons/%libname%%param%_icon.png", + "furni.asset.icon.url": "https://swf.nitrots.co/dcr/hof_furni/icons/%libname%%param%_icon.png", "room.asset.url": "${asset.url}/room/%libname%/%libname%.json", "badge.asset.url": "${image.library.url}album1584/%badgename%.gif", "badge.asset.group.url": "${asset.url}/group-badge/%badgedata%", diff --git a/src/App.tsx b/src/App.tsx index b64c5b54..89ceb5f6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,6 +4,7 @@ import { useConfigurationEvent } from './hooks/events/core/configuration/configu import { useLocalizationEvent } from './hooks/events/nitro/localization/localization-event'; import { dispatchMainEvent, useMainEvent } from './hooks/events/nitro/main-event'; import { useRoomEngineEvent } from './hooks/events/nitro/room/room-engine-event'; +import { GetConfiguration } from './utils/GetConfiguration'; import { LoadingView } from './views/loading/LoadingView'; import { MainView } from './views/main/MainView'; @@ -22,7 +23,7 @@ export function App(): JSX.Element { const urls: string[] = []; - const assetUrls = Nitro.instance.getConfiguration('preload.assets.urls'); + const assetUrls = GetConfiguration('preload.assets.urls'); if(assetUrls && assetUrls.length) { diff --git a/src/assets/styles/bootstrap/_variables.scss b/src/assets/styles/bootstrap/_variables.scss index 84bd07f6..71bec3c8 100644 --- a/src/assets/styles/bootstrap/_variables.scss +++ b/src/assets/styles/bootstrap/_variables.scss @@ -349,7 +349,7 @@ $container-max-widths: ( // Set the number of columns and specify the width of the gutters. $grid-columns: 12 !default; -$grid-gutter-width: 1.5rem !default; +$grid-gutter-width: 1rem !default; $grid-row-columns: 6 !default; $gutters: $spacers !default; diff --git a/src/assets/styles/icons.scss b/src/assets/styles/icons.scss index f9afa062..28198f61 100644 --- a/src/assets/styles/icons.scss +++ b/src/assets/styles/icons.scss @@ -1,5 +1,5 @@ .fas { - line-height: unset !important; + line-height: 0 !important; } i { diff --git a/src/assets/styles/scrollbars.scss b/src/assets/styles/scrollbars.scss index ff1a045f..f644dea9 100644 --- a/src/assets/styles/scrollbars.scss +++ b/src/assets/styles/scrollbars.scss @@ -1,13 +1,15 @@ ::-webkit-scrollbar { width: 4px; - + height: 4px; } ::-webkit-scrollbar-track { + border-radius: $border-radius; background: rgba(transparent, 0.1); } ::-webkit-scrollbar-thumb { + border-radius: $border-radius; background: rgba($white, 0.7); width: 4px; } diff --git a/src/assets/styles/utils.scss b/src/assets/styles/utils.scss index af90f1a4..c579f007 100644 --- a/src/assets/styles/utils.scss +++ b/src/assets/styles/utils.scss @@ -53,3 +53,7 @@ ul { .r-0 { right: 0 !important; } + +.filter-none { + filter: unset !important; +} diff --git a/src/utils/GetConfiguration.ts b/src/utils/GetConfiguration.ts new file mode 100644 index 00000000..a70a82f2 --- /dev/null +++ b/src/utils/GetConfiguration.ts @@ -0,0 +1,6 @@ +import { Nitro } from 'nitro-renderer'; + +export function GetConfiguration(key: string, value: T = null): T +{ + return Nitro.instance.getConfiguration(key, value); +} diff --git a/src/utils/currency-icon/CurrencyIcon.tsx b/src/utils/currency-icon/CurrencyIcon.tsx index 22c5b4ec..14ee66b3 100644 --- a/src/utils/currency-icon/CurrencyIcon.tsx +++ b/src/utils/currency-icon/CurrencyIcon.tsx @@ -1,9 +1,9 @@ -import { Nitro } from 'nitro-renderer'; +import { GetConfiguration } from '../GetConfiguration'; import { CurrencyIconProps } from './CurrencyIcon.types'; export function CurrencyIcon(props: CurrencyIconProps): JSX.Element { - let url = Nitro.instance.getConfiguration('currency.asset.icon.url', ''); + let url = GetConfiguration('currency.asset.icon.url', ''); url = url.replace('%type%', props.type.toString()); diff --git a/src/views/badge-image/BadgeImageView.tsx b/src/views/badge-image/BadgeImageView.tsx index d5ceb866..37352b99 100644 --- a/src/views/badge-image/BadgeImageView.tsx +++ b/src/views/badge-image/BadgeImageView.tsx @@ -1,5 +1,5 @@ -import { Nitro } from 'nitro-renderer'; import { FC } from 'react'; +import { GetConfiguration } from '../../utils/GetConfiguration'; import { BadgeImageViewProps } from './BadgeImageView.types'; export const BadgeImageView: FC = props => @@ -10,11 +10,11 @@ export const BadgeImageView: FC = props => { if(isGroup) { - return ((Nitro.instance.getConfiguration('badge.asset.group.url')).replace('%badgedata%', badgeCode)); + return ((GetConfiguration('badge.asset.group.url')).replace('%badgedata%', badgeCode)); } else { - return ((Nitro.instance.getConfiguration('badge.asset.url')).replace('%badgename%', badgeCode)); + return ((GetConfiguration('badge.asset.url')).replace('%badgename%', badgeCode)); } } diff --git a/src/views/friend-list/FriendListView.tsx b/src/views/friend-list/FriendListView.tsx index 4187416c..da8f6178 100644 --- a/src/views/friend-list/FriendListView.tsx +++ b/src/views/friend-list/FriendListView.tsx @@ -44,8 +44,6 @@ export const FriendListView: FC = props => useEffect(() => { if(!messengerSettings) return; - - console.log(messengerSettings); }, [ messengerSettings ]); useEffect(() => diff --git a/src/views/hotel-view/HotelView.tsx b/src/views/hotel-view/HotelView.tsx index f4fa8b1b..a52b8a86 100644 --- a/src/views/hotel-view/HotelView.tsx +++ b/src/views/hotel-view/HotelView.tsx @@ -1,15 +1,16 @@ import { Nitro } from 'nitro-renderer'; +import { GetConfiguration } from '../../utils/GetConfiguration'; import { HotelViewProps } from './HotelView.types'; export function HotelView(props: HotelViewProps): JSX.Element { - const backgroundColor = Nitro.instance.getConfiguration('hotelview.images')['background.colour']; - const background = Nitro.instance.core.configuration.interpolate(Nitro.instance.getConfiguration('hotelview.images')['background']); - const sun = Nitro.instance.core.configuration.interpolate(Nitro.instance.getConfiguration('hotelview.images')['sun']); - const drape = Nitro.instance.core.configuration.interpolate(Nitro.instance.getConfiguration('hotelview.images')['drape']); - const left = Nitro.instance.core.configuration.interpolate(Nitro.instance.getConfiguration('hotelview.images')['left']); - //const rightRepeat = Nitro.instance.core.configuration.interpolate(Nitro.instance.getConfiguration('hotelview.images')['right.repeat']); - //const right = Nitro.instance.core.configuration.interpolate(Nitro.instance.getConfiguration('hotelview.images')['right']); + const backgroundColor = GetConfiguration('hotelview.images')['background.colour']; + const background = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview.images')['background']); + const sun = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview.images')['sun']); + const drape = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview.images')['drape']); + const left = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview.images')['left']); + //const rightRepeat = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview.images')['right.repeat']); + //const right = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview.images')['right']); return (
diff --git a/src/views/purse/PurseView.tsx b/src/views/purse/PurseView.tsx index eb84219f..a75f8741 100644 --- a/src/views/purse/PurseView.tsx +++ b/src/views/purse/PurseView.tsx @@ -1,8 +1,9 @@ -import { Nitro, UserCreditsEvent, UserCurrencyComposer, UserCurrencyEvent, UserCurrencyUpdateEvent } from 'nitro-renderer'; +import { UserCreditsEvent, UserCurrencyComposer, UserCurrencyEvent, UserCurrencyUpdateEvent } from 'nitro-renderer'; import { useCallback, useEffect, useState } from 'react'; import { CreateMessageHook, SendMessageHook } from '../../hooks/messages/message-event'; import { TransitionAnimation } from '../../transitions/TransitionAnimation'; import { TransitionAnimationTypes } from '../../transitions/TransitionAnimation.types'; +import { GetConfiguration } from '../../utils/GetConfiguration'; import { CurrencySet } from './currency/CurrencySet'; import { CurrencyView } from './currency/CurrencyView'; import { PurseViewProps } from './PurseView.types'; @@ -12,7 +13,7 @@ export function PurseView(props: PurseViewProps): JSX.Element const [ currencies, setCurrencies ] = useState([ new CurrencySet(-1, 0) ]); const [ isReady, setIsReady ] = useState(false); - const displayedCurrencies = Nitro.instance.getConfiguration('system.currency.types', []); + const displayedCurrencies = GetConfiguration('system.currency.types', []); const onUserCreditsEvent = useCallback((event: UserCreditsEvent) => { @@ -76,7 +77,7 @@ export function PurseView(props: PurseViewProps): JSX.Element return ( -
+
{ currencies && currencies.map((set, index) => { if(displayedCurrencies.indexOf(set.type) === -1) return null; diff --git a/src/views/purse/currency/CurrencyView.scss b/src/views/purse/currency/CurrencyView.scss index 29904fb2..f3c39f9a 100644 --- a/src/views/purse/currency/CurrencyView.scss +++ b/src/views/purse/currency/CurrencyView.scss @@ -1,9 +1,2 @@ .nitro-currency { - flex: 46%; - margin-right: 3px; - - &:nth-child(2n), - &:last-child { - margin-right: 0; - } } diff --git a/src/views/purse/currency/CurrencyView.tsx b/src/views/purse/currency/CurrencyView.tsx index ea9d351a..8564540a 100644 --- a/src/views/purse/currency/CurrencyView.tsx +++ b/src/views/purse/currency/CurrencyView.tsx @@ -7,21 +7,39 @@ import { CurrencyViewProps } from './CurrencyView.types'; export function CurrencyView(props: CurrencyViewProps): JSX.Element { const { currencySet = null } = props; + + const [ firstRender, setFirstRender ] = useState(true); const [ isAnimating, setIsAnimating ] = useState(false); useEffect(() => { + if(firstRender) + { + setFirstRender(false); + + return; + } + setIsAnimating(true); - const timeout = setTimeout(() => setIsAnimating(false), 1000); + let timeout = setTimeout(() => + { + setIsAnimating(false) + + timeout = null + }, 300); return () => clearTimeout(timeout); - }, []); + }, [ firstRender, currencySet ]); return ( - -
{ currencySet.amount }
-
+ +
+
+
{ currencySet.amount }
+
+
+
); } diff --git a/src/views/room-host/RoomHostView.tsx b/src/views/room-host/RoomHostView.tsx index badf9df1..b1803595 100644 --- a/src/views/room-host/RoomHostView.tsx +++ b/src/views/room-host/RoomHostView.tsx @@ -22,7 +22,7 @@ export function RoomHostView(props: RoomHostViewProps): JSX.Element { if(RoomId.isRoomPreviewerId(event.roomId)) return; - const session = GetRoomSession(event.roomId); + const session = GetRoomSession(); if(!session) return; diff --git a/src/views/room/widgets/furniture/stickie/FurnitureStickieView.tsx b/src/views/room/widgets/furniture/stickie/FurnitureStickieView.tsx index 43e0fc00..82b0803d 100644 --- a/src/views/room/widgets/furniture/stickie/FurnitureStickieView.tsx +++ b/src/views/room/widgets/furniture/stickie/FurnitureStickieView.tsx @@ -44,7 +44,7 @@ export function FurnitureStickieView(props: FurnitureStickieViewProps): JSX.Elem color = data; } - setStickieData(new FurnitureStickieData(widgetEvent.objectId, widgetEvent.category, color, text, (GetRoomSession(widgetEvent.roomId).isRoomOwner || GetSessionDataManager().isModerator), false)); + setStickieData(new FurnitureStickieData(widgetEvent.objectId, widgetEvent.category, color, text, (GetRoomSession().isRoomOwner || GetSessionDataManager().isModerator), false)); return; } case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: { @@ -124,7 +124,7 @@ export function FurnitureStickieView(props: FurnitureStickieViewProps): JSX.Elem
processAction('trash') }>
{ STICKIE_COLORS.map((color, index) => { - return
processAction('changeColor', color) } style={ {backgroundColor: ColorUtils.makeColorHex(color) } } /> + return
processAction('changeColor', color) } style={ {backgroundColor: ColorUtils.makeColorHex(color) } } /> })} }