mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 23:46:19 +00:00
🆙 Init V3
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { EditEventMessageComposer } from '@nitrots/nitro-renderer';
|
||||
import { FC, useState } from 'react';
|
||||
import { LocalizeText, SendMessageComposer } from '../../../../../api';
|
||||
import { Button, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../common';
|
||||
import { NitroInput } from '../../../../../layout';
|
||||
|
||||
interface RoomPromoteEditWidgetViewProps
|
||||
{
|
||||
eventId: number;
|
||||
eventName: string;
|
||||
eventDescription: string;
|
||||
setIsEditingPromote: (value: boolean) => void;
|
||||
}
|
||||
|
||||
export const RoomPromoteEditWidgetView: FC<RoomPromoteEditWidgetViewProps> = props =>
|
||||
{
|
||||
const { eventId = -1, eventName = '', eventDescription = '', setIsEditingPromote = null } = props;
|
||||
const [ newEventName, setNewEventName ] = useState<string>(eventName);
|
||||
const [ newEventDescription, setNewEventDescription ] = useState<string>(eventDescription);
|
||||
|
||||
const updatePromote = () =>
|
||||
{
|
||||
SendMessageComposer(new EditEventMessageComposer(eventId, newEventName, newEventDescription));
|
||||
setIsEditingPromote(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<NitroCardView className="nitro-guide-tool" theme="primary-slim">
|
||||
<NitroCardHeaderView headerText={ LocalizeText('navigator.eventsettings.editcaption') } onCloseClick={ () => setIsEditingPromote(false) } />
|
||||
<NitroCardContentView className="text-black">
|
||||
<div className="flex flex-col">
|
||||
<Text bold>{ LocalizeText('navigator.eventsettings.name') }</Text>
|
||||
<NitroInput maxLength={ 64 } placeholder={ LocalizeText('navigator.eventsettings.name') } type="text" value={ newEventName } onChange={ event => setNewEventName(event.target.value) } />
|
||||
</div>
|
||||
<div className="flex flex-col">
|
||||
<Text bold>{ LocalizeText('navigator.eventsettings.desc') }</Text>
|
||||
<textarea className="min-h-[calc(1.5em+ .5rem+2px)] px-[.5rem] py-[.25rem] rounded-[.2rem] form-control-sm" maxLength={ 64 } placeholder={ LocalizeText('navigator.eventsettings.desc') } value={ newEventDescription } onChange={ event => setNewEventDescription(event.target.value) }></textarea>
|
||||
</div>
|
||||
<div className="flex flex-col">
|
||||
<Button fullWidth disabled={ !newEventName || !newEventDescription } variant={ (!newEventName || !newEventDescription) ? 'danger' : 'success' } onClick={ event => updatePromote() }>{ LocalizeText('navigator.eventsettings.edit') }</Button>
|
||||
</div>
|
||||
</NitroCardContentView>
|
||||
</NitroCardView>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
import { CreateLinkEvent } from '@nitrots/nitro-renderer';
|
||||
import { FC } from 'react';
|
||||
import { LocalizeText } from '../../../../../api';
|
||||
import { Button, Flex, Grid, Text } from '../../../../../common';
|
||||
import { useRoomPromote } from '../../../../../hooks';
|
||||
|
||||
interface RoomPromoteMyOwnEventWidgetViewProps
|
||||
{
|
||||
eventDescription: string;
|
||||
setIsEditingPromote: (value: boolean) => void;
|
||||
}
|
||||
|
||||
export const RoomPromoteMyOwnEventWidgetView: FC<RoomPromoteMyOwnEventWidgetViewProps> = props =>
|
||||
{
|
||||
const { eventDescription = '', setIsEditingPromote = null } = props;
|
||||
const { setIsExtended } = useRoomPromote();
|
||||
|
||||
const extendPromote = () =>
|
||||
{
|
||||
setIsExtended(true);
|
||||
CreateLinkEvent('catalog/open/room_event');
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex alignItems="center" gap={ 2 } style={ { overflowWrap: 'anywhere' } }>
|
||||
<Text variant="white">{ eventDescription }</Text>
|
||||
</Flex>
|
||||
<br /><br />
|
||||
<Grid className="flex items-center justify-end gap-2">
|
||||
<Button className="btn btn-primary w-full btn-sm" onClick={ event => setIsEditingPromote(true) }>{ LocalizeText('navigator.roominfo.editevent') }</Button>
|
||||
<Button className="btn btn-success w-full btn-sm" onClick={ event => extendPromote() }>{ LocalizeText('roomad.extend.event') }</Button>
|
||||
</Grid>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import { FC } from 'react';
|
||||
import { LocalizeText } from '../../../../../api';
|
||||
import { Column, Flex, Text } from '../../../../../common';
|
||||
|
||||
interface RoomPromoteOtherEventWidgetViewProps
|
||||
{
|
||||
eventDescription: string;
|
||||
}
|
||||
|
||||
export const RoomPromoteOtherEventWidgetView: FC<RoomPromoteOtherEventWidgetViewProps> = props =>
|
||||
{
|
||||
const { eventDescription = '' } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex alignItems="center" gap={ 2 } style={ { overflowWrap: 'anywhere' } }>
|
||||
<Text variant="white">{ eventDescription }</Text>
|
||||
</Flex>
|
||||
<br /><br />
|
||||
<Column alignItems="center" gap={ 1 }>
|
||||
<div className="bg-light-dark rounded relative overflow-hidden w-full">
|
||||
<div className="flex justify-center items-center size-full absolute">
|
||||
<Text center variant="white">{ LocalizeText('navigator.eventinprogress') }</Text>
|
||||
</div>
|
||||
<Text> </Text>
|
||||
</div>
|
||||
</Column>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './RoomPromoteEditWidgetView';
|
||||
export * from './RoomPromoteMyOwnEventWidgetView';
|
||||
export * from './RoomPromoteOtherEventWidgetView';
|
||||
Reference in New Issue
Block a user