5180 fichiers 38.5 Mo 0 téléchargements 459 vues mis à jour il y a 7 heures ui
nitro-v36-with-renderer-v36 / src / components / room / widgets / wired-label / WiredLabelOverlayView.tsx
WiredLabelOverlayView.tsx 2.1 Ko Télécharger le fichier
import { FC } from 'react';
import { NativeTextTree } from '../../../../common/native-text/NativeTextTree';
import { useRoom, useWiredLabelEvents, useWiredLabelStore, useWiredTools } from '../../../../hooks';
import { WiredLabelBubbleView } from './WiredLabelBubbleView';
import { WiredLabelSettingsView } from './WiredLabelSettingsView';

/**
 * The room's furniture labels (official wf_label): a bubble per label that is open, kept open or
 * under the mouse, and the settings window opened from the furni's infostand.
 */
export const WiredLabelOverlayView: FC<{}> = () => {
    useWiredLabelEvents();

    const { roomSession = null } = useRoom();
    const { roomSettings = null } = useWiredTools();
    const labels = useWiredLabelStore((state) => state.labels);
    const openIds = useWiredLabelStore((state) => state.openIds);
    const hoveredId = useWiredLabelStore((state) => state.hoveredId);
    const settingsId = useWiredLabelStore((state) => state.settingsId);
    const close = useWiredLabelStore((state) => state.close);
    const closeSettings = useWiredLabelStore((state) => state.closeSettings);

    if (!roomSession) return null;

    const canModify = !!roomSettings?.canModify;
    const settingsLabel = settingsId ? labels[settingsId] : null;

    return (
        <NativeTextTree>
            <>
                <div className="octane-wired-label-overlay" data-testid="wired-label-overlay">
                    {Object.values(labels).map((label) => (
                        <WiredLabelBubbleView
                            key={label.furnitureId}
                            roomId={roomSession.roomId}
                            label={label}
                            open={openIds.includes(label.furnitureId)}
                            hovered={hoveredId === label.furnitureId}
                            canModify={canModify}
                            onClose={() => close(label.furnitureId)} />
                    ))}
                </div>
                {settingsLabel && canModify && <WiredLabelSettingsView label={settingsLabel} onClose={closeSettings} />}
            </>
        </NativeTextTree>
    );
};
15Sujets
1Dépôts
20Membres
3En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser