5180 fichiers 38.5 Mo 0 téléchargements 377 vues mis à jour il y a 7 heures ui
nitro-v36-with-renderer-v36 / src / components / room / widgets / room-promotes / RoomPromotesWidgetView.tsx
RoomPromotesWidgetView.tsx 3.1 Ko Télécharger le fichier
import { DesktopViewEvent, GetSessionDataManager } from '@octane/renderer';
import { FC, useState } from 'react';
import { FaChevronDown, FaChevronUp } from 'react-icons/fa';
import { Flex, Text } from '../../../../common';
import { useMessageEvent, useRoomPromote } from '../../../../hooks';
import { RoomPromoteEditWidgetView, RoomPromoteMyOwnEventWidgetView, RoomPromoteOtherEventWidgetView } from './views';
import { BaseButton } from '../../../../common/BaseButton';
import { NativeTextTree } from '../../../../common/native-text/NativeTextTree';

export const RoomPromotesWidgetView: FC<{}> = (props) => {
    const [isEditingPromote, setIsEditingPromote] = useState<boolean>(false);
    const [isOpen, setIsOpen] = useState<boolean>(true);
    const { promoteInformation, setPromoteInformation } = useRoomPromote();

    useMessageEvent<DesktopViewEvent>(DesktopViewEvent, (event) => {
        setPromoteInformation(null);
    });

    if (!promoteInformation) return null;

    return (
        <NativeTextTree>
            <>
                {promoteInformation.data.adId !== -1 && (
                    <div className="px-[5px] py-[6px] [box-shadow:inset_0_5px_#22222799,inset_0_-4px_#12121599] text-sm  bg-[#1c1c20f2] rounded">
                        <div className="flex flex-col">
                            <Flex component={BaseButton} type="button" pointer alignItems="center" justifyContent="between" onClick={(event) => setIsOpen((value) => !value)}>
                                <Text overflow="hidden" variant="white">
                                    {promoteInformation.data.eventName}
                                </Text>
                                {isOpen && <FaChevronUp className="fa-icon" />}
                                {!isOpen && <FaChevronDown className="fa-icon" />}
                            </Flex>
                            {isOpen && GetSessionDataManager().userId !== promoteInformation.data.ownerAvatarId && (
                                <RoomPromoteOtherEventWidgetView eventDescription={promoteInformation.data.eventDescription} />
                            )}
                            {isOpen && GetSessionDataManager().userId === promoteInformation.data.ownerAvatarId && (
                                <RoomPromoteMyOwnEventWidgetView
                                    eventDescription={promoteInformation.data.eventDescription}
                                    setIsEditingPromote={() => setIsEditingPromote(true)}
                                />
                            )}
                            {isEditingPromote && (
                                <RoomPromoteEditWidgetView
                                    eventDescription={promoteInformation.data.eventDescription}
                                    eventId={promoteInformation.data.adId}
                                    eventName={promoteInformation.data.eventName}
                                    setIsEditingPromote={() => setIsEditingPromote(false)}
                                />
                            )}
                        </div>
                    </div>
                )}
            </>
        </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