mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
Revert "Merge pull request #45 from simoleo89/interface-color-pr"
This reverts commitd911196ccb, reversing changes made to8dccc509c4.
This commit is contained in:
@@ -2,11 +2,9 @@ import { GetSessionDataManager, HabboClubLevelEnum} from '@nitrots/nitro-rendere
|
||||
import { Dispatch, FC, SetStateAction, useCallback, useMemo, useState } from 'react';
|
||||
import { Base, Grid, Flex, NitroCardView, NitroCardHeaderView, NitroCardTabsView, NitroCardTabsItemView, NitroCardContentView, Text, LayoutCurrencyIcon } from '../../common';
|
||||
import { useRoom } from '../../hooks';
|
||||
import { GetClubMemberLevel, GetConfigurationValue, LocalizeText } from '../../api';
|
||||
import { InterfaceColorTabView } from '../interface-settings/InterfaceColorTabView';
|
||||
import { InterfaceImageTabView } from '../interface-settings/InterfaceImageTabView';
|
||||
import { GetClubMemberLevel, GetConfigurationValue } from '../../api';
|
||||
|
||||
interface ItemData {
|
||||
interface ItemData {
|
||||
id: number;
|
||||
isHcOnly: boolean;
|
||||
minRank: number;
|
||||
@@ -24,7 +22,7 @@ interface BackgroundsViewProps {
|
||||
setSelectedOverlay: Dispatch<SetStateAction<number>>;
|
||||
}
|
||||
|
||||
const TABS = ['backgrounds', 'stands', 'overlays', 'color', 'image'] as const;
|
||||
const TABS = ['backgrounds', 'stands', 'overlays'] as const;
|
||||
type TabType = typeof TABS[number];
|
||||
|
||||
export const BackgroundsView: FC<BackgroundsViewProps> = ({
|
||||
@@ -38,7 +36,7 @@ export const BackgroundsView: FC<BackgroundsViewProps> = ({
|
||||
}) => {
|
||||
const [activeTab, setActiveTab] = useState<TabType>('backgrounds');
|
||||
const { roomSession } = useRoom();
|
||||
|
||||
|
||||
const userData = useMemo(() => ({
|
||||
isHcMember: GetClubMemberLevel() >= HabboClubLevelEnum.CLUB,
|
||||
securityLevel: GetSessionDataManager().canChangeName,
|
||||
@@ -47,7 +45,7 @@ export const BackgroundsView: FC<BackgroundsViewProps> = ({
|
||||
|
||||
const processData = useCallback((configData: any[], dataType: string): ItemData[] => {
|
||||
if (!configData?.length) return [];
|
||||
|
||||
|
||||
return configData
|
||||
.filter(item => {
|
||||
const meetsRank = userData.securityLevel >= item.minRank;
|
||||
@@ -67,10 +65,10 @@ export const BackgroundsView: FC<BackgroundsViewProps> = ({
|
||||
if (!roomSession) return;
|
||||
|
||||
const setters = { backgrounds: setSelectedBackground, stands: setSelectedStand, overlays: setSelectedOverlay };
|
||||
|
||||
|
||||
const currentValues = { backgrounds: selectedBackground, stands: selectedStand, overlays: selectedOverlay };
|
||||
|
||||
setters[activeTab as 'backgrounds' | 'stands' | 'overlays'](id);
|
||||
setters[activeTab](id);
|
||||
const newValues = { ...currentValues, [activeTab]: id };
|
||||
roomSession.sendBackgroundMessage( newValues.backgrounds, newValues.stands, newValues.overlays );
|
||||
}, [activeTab, roomSession, selectedBackground, selectedStand, selectedOverlay, setSelectedBackground, setSelectedStand, setSelectedOverlay]);
|
||||
@@ -88,11 +86,9 @@ export const BackgroundsView: FC<BackgroundsViewProps> = ({
|
||||
</Flex>
|
||||
), [handleSelection]);
|
||||
|
||||
const isProfileTab = activeTab === 'backgrounds' || activeTab === 'stands' || activeTab === 'overlays';
|
||||
|
||||
return (
|
||||
<NitroCardView uniqueKey="backgrounds" className="absolute min-w-[535px] max-w-[535px] min-h-[389px] max-h-[389px]">
|
||||
<NitroCardHeaderView headerText={ LocalizeText('interface.settings.title') } onCloseClick={() => setIsVisible(false)} />
|
||||
<NitroCardHeaderView headerText="Profile Background" onCloseClick={() => setIsVisible(false)} />
|
||||
<NitroCardTabsView>
|
||||
{TABS.map(tab => (
|
||||
<NitroCardTabsItemView
|
||||
@@ -100,22 +96,16 @@ export const BackgroundsView: FC<BackgroundsViewProps> = ({
|
||||
isActive={activeTab === tab}
|
||||
onClick={() => setActiveTab(tab)}
|
||||
>
|
||||
{ LocalizeText(`interface.settings.tab.${ tab }`) }
|
||||
{tab.charAt(0).toUpperCase() + tab.slice(1)}
|
||||
</NitroCardTabsItemView>
|
||||
))}
|
||||
</NitroCardTabsView>
|
||||
<NitroCardContentView gap={1}>
|
||||
{ isProfileTab && (
|
||||
<>
|
||||
<Text bold center>{ LocalizeText('interface.settings.select.option') }</Text>
|
||||
<Grid gap={1} columnCount={7} overflow="auto">
|
||||
{allData[activeTab as 'backgrounds' | 'stands' | 'overlays'].map(item => renderItem(item, activeTab.slice(0, -1)))}
|
||||
</Grid>
|
||||
</>
|
||||
) }
|
||||
{ activeTab === 'color' && <InterfaceColorTabView /> }
|
||||
{ activeTab === 'image' && <InterfaceImageTabView /> }
|
||||
<Text bold center>Select an Option</Text>
|
||||
<Grid gap={1} columnCount={7} overflow="auto">
|
||||
{allData[activeTab].map(item => renderItem(item, activeTab.slice(0, -1)))}
|
||||
</Grid>
|
||||
</NitroCardContentView>
|
||||
</NitroCardView>
|
||||
);
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user