mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-19 05:46:27 +01:00
Add eslint formatting
This commit is contained in:
parent
95621e95eb
commit
d7b00756bf
86
.eslintrc.js
86
.eslintrc.js
@ -1,86 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
'extends': [
|
|
||||||
'react-app',
|
|
||||||
'react-app/jest'
|
|
||||||
],
|
|
||||||
'rules': {
|
|
||||||
'linebreak-style': [
|
|
||||||
'off'
|
|
||||||
],
|
|
||||||
'quotes': [
|
|
||||||
'error',
|
|
||||||
'single'
|
|
||||||
],
|
|
||||||
'brace-style': [
|
|
||||||
'error',
|
|
||||||
'allman',
|
|
||||||
{
|
|
||||||
'allowSingleLine': true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'object-curly-spacing': [
|
|
||||||
'error',
|
|
||||||
'always'
|
|
||||||
],
|
|
||||||
'keyword-spacing': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
'overrides': {
|
|
||||||
'if': {
|
|
||||||
'after': false
|
|
||||||
},
|
|
||||||
'for': {
|
|
||||||
'after': false
|
|
||||||
},
|
|
||||||
'while': {
|
|
||||||
'after': false
|
|
||||||
},
|
|
||||||
'switch': {
|
|
||||||
'after': false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-explicit-any': [
|
|
||||||
'off'
|
|
||||||
],
|
|
||||||
'@typescript-eslint/ban-ts-comment': [
|
|
||||||
'off'
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-empty-function': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
'allow': [
|
|
||||||
'functions',
|
|
||||||
'arrowFunctions',
|
|
||||||
'generatorFunctions',
|
|
||||||
'methods',
|
|
||||||
'generatorMethods',
|
|
||||||
'constructors'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-unused-vars': [
|
|
||||||
'off'
|
|
||||||
],
|
|
||||||
'@typescript-eslint/ban-types': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
'types': {
|
|
||||||
'String': true,
|
|
||||||
'Boolean': true,
|
|
||||||
'Number': true,
|
|
||||||
'Symbol': true,
|
|
||||||
'{}': false,
|
|
||||||
'Object': false,
|
|
||||||
'object': false,
|
|
||||||
'Function': false
|
|
||||||
},
|
|
||||||
'extendDefaults': true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'no-switch-case-fall-through': [
|
|
||||||
'off'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
34
.eslintrc.json
Normal file
34
.eslintrc.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"settings": {
|
||||||
|
"react": {
|
||||||
|
"pragma": "React",
|
||||||
|
"version": "17.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es2021": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:react/recommended",
|
||||||
|
"plugin:react/jsx-runtime"
|
||||||
|
],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"jsx": true
|
||||||
|
},
|
||||||
|
"ecmaVersion": "latest",
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"react",
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"indent": ["error", 4, {"SwitchCase": 1}],
|
||||||
|
"array-bracket-spacing": ["error", "always"],
|
||||||
|
"brace-style": ["error", "allman"],
|
||||||
|
"react/prop-types": ["off"]
|
||||||
|
}
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
*.scss
|
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -14,5 +14,7 @@
|
|||||||
"files.insertFinalNewline": true,
|
"files.insertFinalNewline": true,
|
||||||
"files.trimFinalNewlines": true,
|
"files.trimFinalNewlines": true,
|
||||||
"editor.wordWrap": "on",
|
"editor.wordWrap": "on",
|
||||||
"emmet.showExpandedAbbreviation": "never"
|
"emmet.showExpandedAbbreviation": "never",
|
||||||
|
"eslint.validate": [ "javascript", "javascriptreact", "html", "typescriptreact" ],
|
||||||
|
"eslint.workingDirectories": [ "./src" ]
|
||||||
}
|
}
|
||||||
|
11
package.json
11
package.json
@ -7,7 +7,8 @@
|
|||||||
"build": "cross-env GENERATE_SOURCEMAP=false IMAGE_INLINE_SIZE_LIMIT=100000 craco build",
|
"build": "cross-env GENERATE_SOURCEMAP=false IMAGE_INLINE_SIZE_LIMIT=100000 craco build",
|
||||||
"build:prod": "npx browserslist@latest --update-db && yarn build",
|
"build:prod": "npx browserslist@latest --update-db && yarn build",
|
||||||
"test": "craco test",
|
"test": "craco test",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject",
|
||||||
|
"eslint": "eslint src --ext .ts,.tsx"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@craco/craco": "^6.3.0",
|
"@craco/craco": "^6.3.0",
|
||||||
@ -41,7 +42,13 @@
|
|||||||
"@types/react-slider": "^1.3.1",
|
"@types/react-slider": "^1.3.1",
|
||||||
"@types/react-transition-group": "^4.4.2",
|
"@types/react-transition-group": "^4.4.2",
|
||||||
"@types/react-virtualized": "^9.21.13",
|
"@types/react-virtualized": "^9.21.13",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.29.1",
|
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
||||||
|
"@typescript-eslint/parser": "^5.17.0",
|
||||||
|
"eslint": "^8.12.0",
|
||||||
|
"eslint-plugin-import": "^2.25.4",
|
||||||
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
||||||
|
"eslint-plugin-react": "^7.29.4",
|
||||||
|
"eslint-plugin-react-hooks": "^4.4.0",
|
||||||
"react-error-overlay": "6.0.9"
|
"react-error-overlay": "6.0.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
src/App.tsx
22
src/App.tsx
@ -14,8 +14,8 @@ export const App: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
const [ isReady, setIsReady ] = useState(false);
|
const [ isReady, setIsReady ] = useState(false);
|
||||||
const [ isError, setIsError ] = useState(false);
|
const [ isError, setIsError ] = useState(false);
|
||||||
const [message, setMessage] = useState('Getting Ready');
|
const [ message, setMessage ] = useState('Getting Ready');
|
||||||
const [percent, setPercent] = useState(0);
|
const [ percent, setPercent ] = useState(0);
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
if(!NitroConfig) throw new Error('NitroConfig is not defined!');
|
if(!NitroConfig) throw new Error('NitroConfig is not defined!');
|
||||||
@ -68,24 +68,24 @@ export const App: FC<{}> = props =>
|
|||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING:
|
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING:
|
||||||
loadPercent();
|
loadPercent();
|
||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED:
|
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED:
|
||||||
setIsError(true);
|
setIsError(true);
|
||||||
setMessage('Handshake Failed');
|
setMessage('Handshake Failed');
|
||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED:
|
case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED:
|
||||||
loadPercent();
|
loadPercent();
|
||||||
|
|
||||||
GetNitroInstance().init();
|
GetNitroInstance().init();
|
||||||
|
|
||||||
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []);
|
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []);
|
||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
|
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
|
||||||
setIsError(true);
|
setIsError(true);
|
||||||
setMessage('Connection Error');
|
setMessage('Connection Error');
|
||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_CLOSED:
|
case NitroCommunicationDemoEvent.CONNECTION_CLOSED:
|
||||||
//if(GetNitroInstance().roomEngine) GetNitroInstance().roomEngine.dispose();
|
//if(GetNitroInstance().roomEngine) GetNitroInstance().roomEngine.dispose();
|
||||||
|
|
||||||
//setIsError(true);
|
//setIsError(true);
|
||||||
setMessage('Connection Error');
|
setMessage('Connection Error');
|
||||||
|
@ -34,7 +34,7 @@ export class ProductImageUtility
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CatalogPageMessageProductData.E:
|
case CatalogPageMessageProductData.E:
|
||||||
// fx_icon_furniClassId_png
|
// fx_icon_furniClassId_png
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,5 +10,6 @@ export class TradeUserData
|
|||||||
public itemCount: number = 0,
|
public itemCount: number = 0,
|
||||||
public creditsCount: number = 0,
|
public creditsCount: number = 0,
|
||||||
public accepts: boolean = false,
|
public accepts: boolean = false,
|
||||||
public canTrade: boolean = false) {}
|
public canTrade: boolean = false)
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
|
@ -37,40 +37,40 @@ export class FurniChooserWidgetHandler extends RoomWidgetHandler
|
|||||||
const floorItems = GetRoomEngine().getRoomObjects(roomId, RoomObjectCategory.FLOOR);
|
const floorItems = GetRoomEngine().getRoomObjects(roomId, RoomObjectCategory.FLOOR);
|
||||||
|
|
||||||
wallItems.forEach(roomObject =>
|
wallItems.forEach(roomObject =>
|
||||||
|
{
|
||||||
|
let name = roomObject.type;
|
||||||
|
|
||||||
|
if(name.startsWith('poster'))
|
||||||
{
|
{
|
||||||
let name = roomObject.type;
|
name = LocalizeText(`poster_${ name.replace('poster', '') }_name`);
|
||||||
|
}
|
||||||
if(name.startsWith('poster'))
|
else
|
||||||
{
|
|
||||||
name = LocalizeText(`poster_${ name.replace('poster', '') }_name`);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const typeId = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_TYPE_ID);
|
|
||||||
const furniData = GetSessionDataManager().getWallItemData(typeId);
|
|
||||||
|
|
||||||
if(furniData && furniData.name.length) name = furniData.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
items.push(new RoomObjectItem(roomObject.id, RoomObjectCategory.WALL, name));
|
|
||||||
});
|
|
||||||
|
|
||||||
floorItems.forEach(roomObject =>
|
|
||||||
{
|
{
|
||||||
let name = roomObject.type;
|
|
||||||
|
|
||||||
const typeId = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_TYPE_ID);
|
const typeId = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_TYPE_ID);
|
||||||
const furniData = GetSessionDataManager().getFloorItemData(typeId);
|
const furniData = GetSessionDataManager().getWallItemData(typeId);
|
||||||
|
|
||||||
if(furniData && furniData.name.length) name = furniData.name;
|
if(furniData && furniData.name.length) name = furniData.name;
|
||||||
|
}
|
||||||
|
|
||||||
items.push(new RoomObjectItem(roomObject.id, RoomObjectCategory.FLOOR, name));
|
items.push(new RoomObjectItem(roomObject.id, RoomObjectCategory.WALL, name));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
floorItems.forEach(roomObject =>
|
||||||
|
{
|
||||||
|
let name = roomObject.type;
|
||||||
|
|
||||||
|
const typeId = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_TYPE_ID);
|
||||||
|
const furniData = GetSessionDataManager().getFloorItemData(typeId);
|
||||||
|
|
||||||
|
if(furniData && furniData.name.length) name = furniData.name;
|
||||||
|
|
||||||
|
items.push(new RoomObjectItem(roomObject.id, RoomObjectCategory.FLOOR, name));
|
||||||
|
});
|
||||||
|
|
||||||
items.sort((a, b) =>
|
items.sort((a, b) =>
|
||||||
{
|
{
|
||||||
return (a.name < b.name) ? -1 : 1;
|
return (a.name < b.name) ? -1 : 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetChooserContentEvent(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, items));
|
this.container.eventDispatcher.dispatchEvent(new RoomWidgetChooserContentEvent(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, items));
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ export class FurnitureInternalLinkHandler extends RoomWidgetHandler
|
|||||||
|
|
||||||
public get eventTypes(): string[]
|
public get eventTypes(): string[]
|
||||||
{
|
{
|
||||||
return [RoomEngineTriggerWidgetEvent.REQUEST_INTERNAL_LINK];
|
return [ RoomEngineTriggerWidgetEvent.REQUEST_INTERNAL_LINK ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public get messageTypes(): string[]
|
public get messageTypes(): string[]
|
||||||
|
@ -49,7 +49,7 @@ export class FurnitureRoomLinkHandler extends RoomWidgetHandler
|
|||||||
|
|
||||||
public get eventTypes(): string[]
|
public get eventTypes(): string[]
|
||||||
{
|
{
|
||||||
return [RoomEngineTriggerWidgetEvent.REQUEST_ROOM_LINK];
|
return [ RoomEngineTriggerWidgetEvent.REQUEST_ROOM_LINK ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public get messageTypes(): string[]
|
public get messageTypes(): string[]
|
||||||
|
@ -63,11 +63,11 @@ export class PollWidgetHandler extends RoomWidgetHandler
|
|||||||
|
|
||||||
public get eventTypes(): string[]
|
public get eventTypes(): string[]
|
||||||
{
|
{
|
||||||
return [RoomSessionPollEvent.OFFER, RoomSessionPollEvent.ERROR, RoomSessionPollEvent.CONTENT];
|
return [ RoomSessionPollEvent.OFFER, RoomSessionPollEvent.ERROR, RoomSessionPollEvent.CONTENT ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public get messageTypes(): string[]
|
public get messageTypes(): string[]
|
||||||
{
|
{
|
||||||
return [RoomWidgetPollMessage.ANSWER, RoomWidgetPollMessage.REJECT, RoomWidgetPollMessage.START];
|
return [ RoomWidgetPollMessage.ANSWER, RoomWidgetPollMessage.REJECT, RoomWidgetPollMessage.START ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ export class RoomWidgetAvatarInfoHandler extends RoomWidgetHandler
|
|||||||
this.processOwnCharacterInfo();
|
this.processOwnCharacterInfo();
|
||||||
break;
|
break;
|
||||||
case RoomWidgetUserActionMessage.START_NAME_CHANGE:
|
case RoomWidgetUserActionMessage.START_NAME_CHANGE:
|
||||||
// habbo help - start name change
|
// habbo help - start name change
|
||||||
break;
|
break;
|
||||||
case RoomWidgetUserActionMessage.REQUEST_PET_UPDATE:
|
case RoomWidgetUserActionMessage.REQUEST_PET_UPDATE:
|
||||||
break;
|
break;
|
||||||
|
@ -101,7 +101,7 @@ export class RoomWidgetChatHandler extends RoomWidgetHandler implements IAvatarI
|
|||||||
text = LocalizeText('widget.chatbubble.pettreat', [ 'petname' ], [ username ]);
|
text = LocalizeText('widget.chatbubble.pettreat', [ 'petname' ], [ username ]);
|
||||||
break;
|
break;
|
||||||
case RoomSessionChatEvent.CHAT_TYPE_HAND_ITEM_RECEIVED:
|
case RoomSessionChatEvent.CHAT_TYPE_HAND_ITEM_RECEIVED:
|
||||||
text = LocalizeText('widget.chatbubble.handitem', [ 'username', 'handitem' ], [ username, LocalizeText(('handitem' + chatEvent.extraParam))]);
|
text = LocalizeText('widget.chatbubble.handitem', [ 'username', 'handitem' ], [ username, LocalizeText(('handitem' + chatEvent.extraParam)) ]);
|
||||||
break;
|
break;
|
||||||
case RoomSessionChatEvent.CHAT_TYPE_MUTE_REMAINING: {
|
case RoomSessionChatEvent.CHAT_TYPE_MUTE_REMAINING: {
|
||||||
const hours = ((chatEvent.extraParam > 0) ? Math.floor((chatEvent.extraParam / 3600)) : 0).toString();
|
const hours = ((chatEvent.extraParam > 0) ? Math.floor((chatEvent.extraParam / 3600)) : 0).toString();
|
||||||
|
@ -141,10 +141,10 @@ export class RoomWidgetChatInputHandler extends RoomWidgetHandler
|
|||||||
if(this.container.roomSession.isRoomOwner || GetSessionDataManager().isModerator)
|
if(this.container.roomSession.isRoomOwner || GetSessionDataManager().isModerator)
|
||||||
{
|
{
|
||||||
NotificationUtilities.confirm(LocalizeText('room.confirm.pick_all'), () =>
|
NotificationUtilities.confirm(LocalizeText('room.confirm.pick_all'), () =>
|
||||||
{
|
{
|
||||||
GetSessionDataManager().sendSpecialCommandMessage(':pickall');
|
GetSessionDataManager().sendSpecialCommandMessage(':pickall');
|
||||||
},
|
},
|
||||||
null, null, null, LocalizeText('generic.alert.title'));
|
null, null, null, LocalizeText('generic.alert.title'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -35,13 +35,13 @@ export class UserChooserWidgetHandler extends RoomWidgetHandler
|
|||||||
const userItems = GetRoomEngine().getRoomObjects(roomId, RoomObjectCategory.UNIT);
|
const userItems = GetRoomEngine().getRoomObjects(roomId, RoomObjectCategory.UNIT);
|
||||||
|
|
||||||
userItems.forEach(roomObject =>
|
userItems.forEach(roomObject =>
|
||||||
{
|
{
|
||||||
const userData = this.container.roomSession.userDataManager.getUserDataByIndex(roomObject.id);
|
const userData = this.container.roomSession.userDataManager.getUserDataByIndex(roomObject.id);
|
||||||
|
|
||||||
if(!userData) return;
|
if(!userData) return;
|
||||||
|
|
||||||
items.push(new RoomObjectItem(userData.roomIndex, RoomObjectCategory.UNIT, userData.name));
|
items.push(new RoomObjectItem(userData.roomIndex, RoomObjectCategory.UNIT, userData.name));
|
||||||
});
|
});
|
||||||
|
|
||||||
items.sort((a, b) =>
|
items.sort((a, b) =>
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ export class WordQuizWidgetHandler extends RoomWidgetHandler
|
|||||||
|
|
||||||
public get eventTypes(): string[]
|
public get eventTypes(): string[]
|
||||||
{
|
{
|
||||||
return [RoomSessionWordQuizEvent.ANSWERED, RoomSessionWordQuizEvent.FINISHED, RoomSessionWordQuizEvent.QUESTION];
|
return [ RoomSessionWordQuizEvent.ANSWERED, RoomSessionWordQuizEvent.FINISHED, RoomSessionWordQuizEvent.QUESTION ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public get messageTypes(): string[]
|
public get messageTypes(): string[]
|
||||||
|
@ -4,7 +4,7 @@ export class RoomWidgetDanceMessage extends RoomWidgetMessage
|
|||||||
{
|
{
|
||||||
public static DANCE: string = 'RWDM_MESSAGE_DANCE';
|
public static DANCE: string = 'RWDM_MESSAGE_DANCE';
|
||||||
public static NORMAL_STYLE: number = 0;
|
public static NORMAL_STYLE: number = 0;
|
||||||
public static CLUB_STYLE: number[] = [2, 3, 4];
|
public static CLUB_STYLE: number[] = [ 2, 3, 4 ];
|
||||||
|
|
||||||
private _style: number = 0;
|
private _style: number = 0;
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ export class NotificationUtilities
|
|||||||
|
|
||||||
public static handleHotelClosedMessage(open: number, minute: number, thrownOut: boolean): void
|
public static handleHotelClosedMessage(open: number, minute: number, thrownOut: boolean): void
|
||||||
{
|
{
|
||||||
this.simpleAlert( LocalizeText(('opening.hours.' + (thrownOut ? 'disconnected' : 'closed')), [ 'h', 'm'], [ this.getTimeZeroPadded(open), this.getTimeZeroPadded(minute) ]), NotificationAlertType.DEFAULT, null, null, LocalizeText('opening.hours.title'));
|
this.simpleAlert( LocalizeText(('opening.hours.' + (thrownOut ? 'disconnected' : 'closed')), [ 'h', 'm' ], [ this.getTimeZeroPadded(open), this.getTimeZeroPadded(minute) ]), NotificationAlertType.DEFAULT, null, null, LocalizeText('opening.hours.title'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static handleHotelMaintenanceMessage(minutesUntilMaintenance: number, duration: number): void
|
public static handleHotelMaintenanceMessage(minutesUntilMaintenance: number, duration: number): void
|
||||||
|
@ -26,16 +26,16 @@ allowedColours.set('pink', 'pink');
|
|||||||
function encodeHTML(str: string)
|
function encodeHTML(str: string)
|
||||||
{
|
{
|
||||||
return str.replace(/([\u00A0-\u9999<>&])(.|$)/g, function(full, char, next)
|
return str.replace(/([\u00A0-\u9999<>&])(.|$)/g, function(full, char, next)
|
||||||
{
|
{
|
||||||
if(char !== '&' || next !== '#')
|
if(char !== '&' || next !== '#')
|
||||||
{
|
{
|
||||||
if(/[\u00A0-\u9999<>&]/.test(next))
|
if(/[\u00A0-\u9999<>&]/.test(next))
|
||||||
next = '&#' + next.charCodeAt(0) + ';';
|
next = '&#' + next.charCodeAt(0) + ';';
|
||||||
|
|
||||||
return '&#' + char.charCodeAt(0) + ';' + next;
|
return '&#' + char.charCodeAt(0) + ';' + next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return full;
|
return full;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,26 +45,26 @@ export const NitroCardAccordionSetView: FC<NitroCardAccordionSetViewProps> = pro
|
|||||||
const closeFunction = close;
|
const closeFunction = close;
|
||||||
|
|
||||||
setClosers(prevValue =>
|
setClosers(prevValue =>
|
||||||
{
|
{
|
||||||
const newClosers = [ ...prevValue ];
|
const newClosers = [ ...prevValue ];
|
||||||
|
|
||||||
newClosers.push(closeFunction);
|
newClosers.push(closeFunction);
|
||||||
|
|
||||||
return newClosers;
|
return newClosers;
|
||||||
});
|
});
|
||||||
|
|
||||||
return () =>
|
return () =>
|
||||||
{
|
{
|
||||||
setClosers(prevValue =>
|
setClosers(prevValue =>
|
||||||
{
|
{
|
||||||
const newClosers = [ ...prevValue ];
|
const newClosers = [ ...prevValue ];
|
||||||
|
|
||||||
const index = newClosers.indexOf(closeFunction);
|
const index = newClosers.indexOf(closeFunction);
|
||||||
|
|
||||||
if(index >= 0) newClosers.splice(index, 1);
|
if(index >= 0) newClosers.splice(index, 1);
|
||||||
|
|
||||||
return newClosers;
|
return newClosers;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [ close, setClosers ]);
|
}, [ close, setClosers ]);
|
||||||
|
|
||||||
|
@ -261,8 +261,8 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
createPortal(
|
createPortal(
|
||||||
<Base position="absolute" innerRef={ elementRef } className="draggable-window" onMouseDownCapture={ onMouseDown } onTouchStartCapture={ onTouchStart } style={ dragStyle }>
|
<Base position="absolute" innerRef={ elementRef } className="draggable-window" onMouseDownCapture={ onMouseDown } onTouchStartCapture={ onTouchStart } style={ dragStyle }>
|
||||||
{ children }
|
{ children }
|
||||||
</Base>, document.getElementById('draggable-windows-container'))
|
</Base>, document.getElementById('draggable-windows-container'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,8 @@ export const LayoutAvatarImageView: FC<LayoutAvatarImageViewProps> = props =>
|
|||||||
|
|
||||||
setRandomValue(Math.random());
|
setRandomValue(Math.random());
|
||||||
},
|
},
|
||||||
dispose: () => {},
|
dispose: () =>
|
||||||
|
{},
|
||||||
disposed: false
|
disposed: false
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ export const LayoutGiftTagView: FC<LayoutGiftTagViewProps> = props =>
|
|||||||
{ editable && (onChange !== null) &&
|
{ editable && (onChange !== null) &&
|
||||||
<textarea className="gift-message h-100" maxLength={ 140 } value={ message } onChange={ (e) => onChange(e.target.value) } placeholder={ LocalizeText('catalog.gift_wrapping_new.message_hint') }></textarea> }
|
<textarea className="gift-message h-100" maxLength={ 140 } value={ message } onChange={ (e) => onChange(e.target.value) } placeholder={ LocalizeText('catalog.gift_wrapping_new.message_hint') }></textarea> }
|
||||||
{ userName &&
|
{ userName &&
|
||||||
<Text italics textEnd className="pe-1">{ LocalizeText('catalog.gift_wrapping_new.message_from', ['name'], [userName]) }</Text> }
|
<Text italics textEnd className="pe-1">{ LocalizeText('catalog.gift_wrapping_new.message_from', [ 'name' ], [ userName ]) }</Text> }
|
||||||
</Column>
|
</Column>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -15,7 +15,7 @@ export const LayoutNotificationAlertView: FC<LayoutNotificationAlertViewProps> =
|
|||||||
|
|
||||||
const getClassNames = useMemo(() =>
|
const getClassNames = useMemo(() =>
|
||||||
{
|
{
|
||||||
const newClassNames: string[] = ['nitro-alert'];
|
const newClassNames: string[] = [ 'nitro-alert' ];
|
||||||
|
|
||||||
newClassNames.push('nitro-alert-' + type);
|
newClassNames.push('nitro-alert-' + type);
|
||||||
|
|
||||||
|
@ -35,11 +35,11 @@ export const LayoutNotificationBubbleView: FC<LayoutNotificationBubbleViewProps>
|
|||||||
if(!fadesOut) return;
|
if(!fadesOut) return;
|
||||||
|
|
||||||
const timeout = setTimeout(() =>
|
const timeout = setTimeout(() =>
|
||||||
{
|
{
|
||||||
setIsVisible(false);
|
setIsVisible(false);
|
||||||
|
|
||||||
setTimeout(() => close(), 300);
|
setTimeout(() => close(), 300);
|
||||||
}, timeoutMs);
|
}, timeoutMs);
|
||||||
|
|
||||||
return () => clearTimeout(timeout);
|
return () => clearTimeout(timeout);
|
||||||
}, [ fadesOut, timeoutMs, close ]);
|
}, [ fadesOut, timeoutMs, close ]);
|
||||||
|
@ -74,15 +74,15 @@ export const LayoutRoomPreviewerView: FC<LayoutRoomPreviewerViewProps> = props =
|
|||||||
GetNitroInstance().ticker.add(update);
|
GetNitroInstance().ticker.add(update);
|
||||||
|
|
||||||
const resizeObserver = new ResizeObserver(() =>
|
const resizeObserver = new ResizeObserver(() =>
|
||||||
{
|
{
|
||||||
if(!roomPreviewer || !elementRef.current) return;
|
if(!roomPreviewer || !elementRef.current) return;
|
||||||
|
|
||||||
const width = elementRef.current.parentElement.offsetWidth;
|
const width = elementRef.current.parentElement.offsetWidth;
|
||||||
|
|
||||||
roomPreviewer.modifyRoomCanvas(width, height);
|
roomPreviewer.modifyRoomCanvas(width, height);
|
||||||
|
|
||||||
update(-1);
|
update(-1);
|
||||||
});
|
});
|
||||||
|
|
||||||
resizeObserver.observe(elementRef.current);
|
resizeObserver.observe(elementRef.current);
|
||||||
|
|
||||||
|
@ -8,15 +8,11 @@ interface LayoutLimitedEditionStyledNumberViewProps
|
|||||||
export const LayoutLimitedEditionStyledNumberView: FC<LayoutLimitedEditionStyledNumberViewProps> = props =>
|
export const LayoutLimitedEditionStyledNumberView: FC<LayoutLimitedEditionStyledNumberViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { value = 0 } = props;
|
const { value = 0 } = props;
|
||||||
|
|
||||||
const numbers = value.toString().split('');
|
const numbers = value.toString().split('');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{ numbers.map((number, index) =>
|
{ numbers.map((number, index) => <i key={ index } className={ 'limited-edition-number n-' + number } />) }
|
||||||
{
|
|
||||||
return <i key={ index } className={ 'limited-edition-number n-' + number } />;
|
|
||||||
})}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -22,50 +22,50 @@ export const AchievementsView: FC<{}> = props =>
|
|||||||
const categoryName = achievement.category;
|
const categoryName = achievement.category;
|
||||||
|
|
||||||
setAchievementCategories(prevValue =>
|
setAchievementCategories(prevValue =>
|
||||||
|
{
|
||||||
|
const newValue = [ ...prevValue ];
|
||||||
|
const categoryIndex = newValue.findIndex(existing => (existing.code === categoryName));
|
||||||
|
|
||||||
|
if(categoryIndex === -1)
|
||||||
{
|
{
|
||||||
const newValue = [ ...prevValue ];
|
const category = new AchievementCategory(categoryName);
|
||||||
const categoryIndex = newValue.findIndex(existing => (existing.code === categoryName));
|
|
||||||
|
|
||||||
if(categoryIndex === -1)
|
category.achievements.push(achievement);
|
||||||
|
|
||||||
|
newValue.push(category);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const category = CloneObject(newValue[categoryIndex]);
|
||||||
|
const newAchievements = [ ...category.achievements ];
|
||||||
|
const achievementIndex = newAchievements.findIndex(existing => (existing.achievementId === achievement.achievementId));
|
||||||
|
let previousAchievement: AchievementData = null;
|
||||||
|
|
||||||
|
if(achievementIndex === -1)
|
||||||
{
|
{
|
||||||
const category = new AchievementCategory(categoryName);
|
newAchievements.push(achievement);
|
||||||
|
|
||||||
category.achievements.push(achievement);
|
|
||||||
|
|
||||||
newValue.push(category);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const category = CloneObject(newValue[categoryIndex]);
|
previousAchievement = newAchievements[achievementIndex];
|
||||||
const newAchievements = [ ...category.achievements ];
|
|
||||||
const achievementIndex = newAchievements.findIndex(existing => (existing.achievementId === achievement.achievementId));
|
|
||||||
let previousAchievement: AchievementData = null;
|
|
||||||
|
|
||||||
if(achievementIndex === -1)
|
newAchievements[achievementIndex] = achievement;
|
||||||
{
|
|
||||||
newAchievements.push(achievement);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
previousAchievement = newAchievements[achievementIndex];
|
|
||||||
|
|
||||||
newAchievements[achievementIndex] = achievement;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!GetAchievementIsIgnored(achievement))
|
|
||||||
{
|
|
||||||
achievement.unseen++;
|
|
||||||
|
|
||||||
if(previousAchievement) achievement.unseen += previousAchievement.unseen;
|
|
||||||
}
|
|
||||||
|
|
||||||
category.achievements = newAchievements;
|
|
||||||
|
|
||||||
newValue[categoryIndex] = category;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return newValue;
|
if(!GetAchievementIsIgnored(achievement))
|
||||||
});
|
{
|
||||||
|
achievement.unseen++;
|
||||||
|
|
||||||
|
if(previousAchievement) achievement.unseen += previousAchievement.unseen;
|
||||||
|
}
|
||||||
|
|
||||||
|
category.achievements = newAchievements;
|
||||||
|
|
||||||
|
newValue[categoryIndex] = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newValue;
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
UseMessageEventHook(AchievementEvent, onAchievementEvent);
|
UseMessageEventHook(AchievementEvent, onAchievementEvent);
|
||||||
@ -155,23 +155,23 @@ export const AchievementsView: FC<{}> = props =>
|
|||||||
const setAchievementSeen = useCallback((code: string, achievementId: number) =>
|
const setAchievementSeen = useCallback((code: string, achievementId: number) =>
|
||||||
{
|
{
|
||||||
setAchievementCategories(prevValue =>
|
setAchievementCategories(prevValue =>
|
||||||
|
{
|
||||||
|
const newValue = [ ...prevValue ];
|
||||||
|
|
||||||
|
for(const category of newValue)
|
||||||
{
|
{
|
||||||
const newValue = [ ...prevValue ];
|
if(category.code !== code) continue;
|
||||||
|
|
||||||
for(const category of newValue)
|
for(const achievement of category.achievements)
|
||||||
{
|
{
|
||||||
if(category.code !== code) continue;
|
if(achievement.achievementId !== achievementId) continue;
|
||||||
|
|
||||||
for(const achievement of category.achievements)
|
achievement.unseen = 0;
|
||||||
{
|
|
||||||
if(achievement.achievementId !== achievementId) continue;
|
|
||||||
|
|
||||||
achievement.unseen = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const linkReceived = useCallback((url: string) =>
|
const linkReceived = useCallback((url: string) =>
|
||||||
|
@ -288,15 +288,15 @@ export const AvatarEditorView: FC<{}> = props =>
|
|||||||
<NitroCardHeaderView headerText={ LocalizeText('avatareditor.title') } onCloseClick={ event => setIsVisible(false) } />
|
<NitroCardHeaderView headerText={ LocalizeText('avatareditor.title') } onCloseClick={ event => setIsVisible(false) } />
|
||||||
<NitroCardTabsView>
|
<NitroCardTabsView>
|
||||||
{ categories && (categories.size > 0) && Array.from(categories.keys()).map(category =>
|
{ categories && (categories.size > 0) && Array.from(categories.keys()).map(category =>
|
||||||
{
|
{
|
||||||
const isActive = (activeCategory && (activeCategory.name === category));
|
const isActive = (activeCategory && (activeCategory.name === category));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NitroCardTabsItemView key={ category } isActive={ isActive } onClick={ event => selectCategory(category) }>
|
<NitroCardTabsItemView key={ category } isActive={ isActive } onClick={ event => selectCategory(category) }>
|
||||||
{ LocalizeText(`avatareditor.category.${ category }`) }
|
{ LocalizeText(`avatareditor.category.${ category }`) }
|
||||||
</NitroCardTabsItemView>
|
</NitroCardTabsItemView>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
<NitroCardTabsItemView isActive={ isWardrobeVisible } onClick={ event => setIsWardrobeVisible(true) }>
|
<NitroCardTabsItemView isActive={ isWardrobeVisible } onClick={ event => setIsWardrobeVisible(true) }>
|
||||||
{ LocalizeText('avatareditor.category.wardrobe') }
|
{ LocalizeText('avatareditor.category.wardrobe') }
|
||||||
</NitroCardTabsItemView>
|
</NitroCardTabsItemView>
|
||||||
|
@ -5,7 +5,7 @@ import { FigureData } from './FigureData';
|
|||||||
export class AvatarEditorGridPartItem implements IAvatarImageListener
|
export class AvatarEditorGridPartItem implements IAvatarImageListener
|
||||||
{
|
{
|
||||||
private static ALPHA_FILTER: NitroAlphaFilter = new NitroAlphaFilter(0.2);
|
private static ALPHA_FILTER: NitroAlphaFilter = new NitroAlphaFilter(0.2);
|
||||||
private static THUMB_DIRECTIONS: number[] = [2, 6, 0, 4, 3, 1];
|
private static THUMB_DIRECTIONS: number[] = [ 2, 6, 0, 4, 3, 1 ];
|
||||||
private static DRAW_ORDER: string[] = [
|
private static DRAW_ORDER: string[] = [
|
||||||
AvatarFigurePartType.LEFT_HAND_ITEM,
|
AvatarFigurePartType.LEFT_HAND_ITEM,
|
||||||
AvatarFigurePartType.LEFT_HAND,
|
AvatarFigurePartType.LEFT_HAND,
|
||||||
|
@ -26,11 +26,11 @@ function getRandomPartSet(setType: SetType, gender: string, clubLevel: number =
|
|||||||
if(!setType) return null;
|
if(!setType) return null;
|
||||||
|
|
||||||
const options = setType.partSets.getValues().filter(option =>
|
const options = setType.partSets.getValues().filter(option =>
|
||||||
{
|
{
|
||||||
if(!option.isSelectable || ((option.gender !== 'U') && (option.gender !== gender)) || (option.clubLevel > clubLevel) || (option.isSellable && (figureSetIds.indexOf(option.id) === -1))) return null;
|
if(!option.isSelectable || ((option.gender !== 'U') && (option.gender !== gender)) || (option.clubLevel > clubLevel) || (option.isSellable && (figureSetIds.indexOf(option.id) === -1))) return null;
|
||||||
|
|
||||||
return option;
|
return option;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!options || !options.length) return null;
|
if(!options || !options.length) return null;
|
||||||
|
|
||||||
@ -42,11 +42,11 @@ function getRandomColors(palette: IPalette, partSet: IFigurePartSet, clubLevel:
|
|||||||
if(!palette) return [];
|
if(!palette) return [];
|
||||||
|
|
||||||
const options = palette.colors.getValues().filter(option =>
|
const options = palette.colors.getValues().filter(option =>
|
||||||
{
|
{
|
||||||
if(!option.isSelectable || (option.clubLevel > clubLevel)) return null;
|
if(!option.isSelectable || (option.clubLevel > clubLevel)) return null;
|
||||||
|
|
||||||
return option;
|
return option;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!options || !options.length) return null;
|
if(!options || !options.length) return null;
|
||||||
|
|
||||||
|
@ -68,15 +68,15 @@ export const AvatarEditorModelView: FC<AvatarEditorModelViewProps> = props =>
|
|||||||
</Flex>
|
</Flex>
|
||||||
</> }
|
</> }
|
||||||
{ !model.canSetGender && model.categories && (model.categories.size > 0) && Array.from(model.categories.keys()).map(name =>
|
{ !model.canSetGender && model.categories && (model.categories.size > 0) && Array.from(model.categories.keys()).map(name =>
|
||||||
{
|
{
|
||||||
const category = model.categories.get(name);
|
const category = model.categories.get(name);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex center pointer key={ name } className="category-item" onClick={ event => selectCategory(name) }>
|
<Flex center pointer key={ name } className="category-item" onClick={ event => selectCategory(name) }>
|
||||||
<AvatarEditorIcon icon={ category.name } selected={ (activeCategory === category) } />
|
<AvatarEditorIcon icon={ category.name } selected={ (activeCategory === category) } />
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Column>
|
</Column>
|
||||||
<Column size={ 5 } overflow="hidden">
|
<Column size={ 5 } overflow="hidden">
|
||||||
<AvatarEditorFigureSetView model={ model } category={ activeCategory } setMaxPaletteCount={ setMaxPaletteCount } />
|
<AvatarEditorFigureSetView model={ model } category={ activeCategory } setMaxPaletteCount={ setMaxPaletteCount } />
|
||||||
|
@ -47,25 +47,25 @@ export const AvatarEditorWardrobeView: FC<AvatarEditorWardrobeViewProps> = props
|
|||||||
const items: JSX.Element[] = [];
|
const items: JSX.Element[] = [];
|
||||||
|
|
||||||
savedFigures.forEach(([ figureContainer, gender ], index) =>
|
savedFigures.forEach(([ figureContainer, gender ], index) =>
|
||||||
{
|
{
|
||||||
let clubLevel = 0;
|
let clubLevel = 0;
|
||||||
|
|
||||||
if(figureContainer) clubLevel = GetAvatarRenderManager().getFigureClubLevel(figureContainer, gender);
|
if(figureContainer) clubLevel = GetAvatarRenderManager().getFigureClubLevel(figureContainer, gender);
|
||||||
|
|
||||||
items.push(
|
items.push(
|
||||||
<LayoutGridItem key={ index } position="relative" overflow="hidden" className="nitro-avatar-editor-wardrobe-figure-preview">
|
<LayoutGridItem key={ index } position="relative" overflow="hidden" className="nitro-avatar-editor-wardrobe-figure-preview">
|
||||||
{ figureContainer &&
|
{ figureContainer &&
|
||||||
<LayoutAvatarImageView figure={ figureContainer.getFigureString() } gender={ gender } direction={ 2 } /> }
|
<LayoutAvatarImageView figure={ figureContainer.getFigureString() } gender={ gender } direction={ 2 } /> }
|
||||||
<Base className="avatar-shadow" />
|
<Base className="avatar-shadow" />
|
||||||
{ (clubLevel > 0) && <LayoutCurrencyIcon className="position-absolute top-1 start-1" type="hc" /> }
|
{ (clubLevel > 0) && <LayoutCurrencyIcon className="position-absolute top-1 start-1" type="hc" /> }
|
||||||
<Flex gap={ 1 } className="button-container">
|
<Flex gap={ 1 } className="button-container">
|
||||||
<Button variant="link" fullWidth onClick={ event => saveFigureAtWardrobeIndex(index) }>{ LocalizeText('avatareditor.wardrobe.save') }</Button>
|
<Button variant="link" fullWidth onClick={ event => saveFigureAtWardrobeIndex(index) }>{ LocalizeText('avatareditor.wardrobe.save') }</Button>
|
||||||
{ figureContainer &&
|
{ figureContainer &&
|
||||||
<Button variant="link" fullWidth onClick={ event => wearFigureAtIndex(index) } disabled={ (clubLevel > GetClubMemberLevel()) }>{ LocalizeText('generic_usable.button.use') }</Button> }
|
<Button variant="link" fullWidth onClick={ event => wearFigureAtIndex(index) } disabled={ (clubLevel > GetClubMemberLevel()) }>{ LocalizeText('generic_usable.button.use') }</Button> }
|
||||||
</Flex>
|
</Flex>
|
||||||
</LayoutGridItem>
|
</LayoutGridItem>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}, [ savedFigures, saveFigureAtWardrobeIndex, wearFigureAtIndex ]);
|
}, [ savedFigures, saveFigureAtWardrobeIndex, wearFigureAtIndex ]);
|
||||||
|
@ -70,13 +70,13 @@ export const CameraWidgetView: FC<{}> = props =>
|
|||||||
return;
|
return;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
setCameraRoll(prevValue =>
|
setCameraRoll(prevValue =>
|
||||||
{
|
{
|
||||||
const clone = [ ...prevValue ];
|
const clone = [ ...prevValue ];
|
||||||
|
|
||||||
clone.splice(selectedPictureIndex, 1);
|
clone.splice(selectedPictureIndex, 1);
|
||||||
|
|
||||||
return clone;
|
return clone;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
case 'editor_cancel':
|
case 'editor_cancel':
|
||||||
setMode(MODE_CAPTURE);
|
setMode(MODE_CAPTURE);
|
||||||
@ -106,10 +106,10 @@ export const CameraWidgetView: FC<{}> = props =>
|
|||||||
return;
|
return;
|
||||||
case 'toggle':
|
case 'toggle':
|
||||||
setMode(prevValue =>
|
setMode(prevValue =>
|
||||||
{
|
{
|
||||||
if(!prevValue) return MODE_CAPTURE;
|
if(!prevValue) return MODE_CAPTURE;
|
||||||
else return MODE_NONE;
|
else return MODE_NONE;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -4,5 +4,6 @@ export class CameraPicture
|
|||||||
{
|
{
|
||||||
constructor(
|
constructor(
|
||||||
public texture: NitroTexture,
|
public texture: NitroTexture,
|
||||||
public imageUrl: string) {}
|
public imageUrl: string)
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,6 @@ export class CameraPictureThumbnail
|
|||||||
{
|
{
|
||||||
constructor(
|
constructor(
|
||||||
public effectName: string,
|
public effectName: string,
|
||||||
public thumbnailUrl: string) {}
|
public thumbnailUrl: string)
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,9 @@ export const CameraWidgetCaptureView: FC<CameraWidgetCaptureViewProps> = props =
|
|||||||
{ (cameraRoll.length > 0) &&
|
{ (cameraRoll.length > 0) &&
|
||||||
<Flex gap={ 2 } justifyContent="center" className="camera-roll d-flex justify-content-center py-2">
|
<Flex gap={ 2 } justifyContent="center" className="camera-roll d-flex justify-content-center py-2">
|
||||||
{ cameraRoll.map((picture, index) =>
|
{ cameraRoll.map((picture, index) =>
|
||||||
{
|
{
|
||||||
return <img alt="" key={ index } src={ picture.imageUrl } onClick={ event => setSelectedPictureIndex(index) } />;
|
return <img alt="" key={ index } src={ picture.imageUrl } onClick={ event => setSelectedPictureIndex(index) } />;
|
||||||
}) }
|
}) }
|
||||||
</Flex> }
|
</Flex> }
|
||||||
</Column>
|
</Column>
|
||||||
</DraggableWindow>
|
</DraggableWindow>
|
||||||
|
@ -76,14 +76,14 @@ export const CameraWidgetEditorView: FC<CameraWidgetEditorViewProps> = props =>
|
|||||||
if(index === -1) return;
|
if(index === -1) return;
|
||||||
|
|
||||||
setSelectedEffects(prevValue =>
|
setSelectedEffects(prevValue =>
|
||||||
{
|
{
|
||||||
const clone = [ ...prevValue ];
|
const clone = [ ...prevValue ];
|
||||||
const currentEffect = clone[index];
|
const currentEffect = clone[index];
|
||||||
|
|
||||||
clone[getCurrentEffectIndex] = new RoomCameraWidgetSelectedEffect(currentEffect.effect, alpha);
|
clone[getCurrentEffectIndex] = new RoomCameraWidgetSelectedEffect(currentEffect.effect, alpha);
|
||||||
|
|
||||||
return clone;
|
return clone;
|
||||||
});
|
});
|
||||||
}, [ getCurrentEffectIndex, setSelectedEffects ]);
|
}, [ getCurrentEffectIndex, setSelectedEffects ]);
|
||||||
|
|
||||||
const getCurrentPictureUrl = useMemo(() =>
|
const getCurrentPictureUrl = useMemo(() =>
|
||||||
@ -117,9 +117,9 @@ export const CameraWidgetEditorView: FC<CameraWidgetEditorViewProps> = props =>
|
|||||||
if(!effect) return;
|
if(!effect) return;
|
||||||
|
|
||||||
setSelectedEffects(prevValue =>
|
setSelectedEffects(prevValue =>
|
||||||
{
|
{
|
||||||
return [ ...prevValue, new RoomCameraWidgetSelectedEffect(effect, 1) ];
|
return [ ...prevValue, new RoomCameraWidgetSelectedEffect(effect, 1) ];
|
||||||
});
|
});
|
||||||
|
|
||||||
setSelectedEffectName(effect.name);
|
setSelectedEffectName(effect.name);
|
||||||
return;
|
return;
|
||||||
@ -130,13 +130,13 @@ export const CameraWidgetEditorView: FC<CameraWidgetEditorViewProps> = props =>
|
|||||||
if(existingIndex === -1) return;
|
if(existingIndex === -1) return;
|
||||||
|
|
||||||
setSelectedEffects(prevValue =>
|
setSelectedEffects(prevValue =>
|
||||||
{
|
{
|
||||||
const clone = [ ...prevValue ];
|
const clone = [ ...prevValue ];
|
||||||
|
|
||||||
clone.splice(existingIndex, 1);
|
clone.splice(existingIndex, 1);
|
||||||
|
|
||||||
return clone;
|
return clone;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(selectedEffectName === effectName) setSelectedEffectName(null);
|
if(selectedEffectName === effectName) setSelectedEffectName(null);
|
||||||
return;
|
return;
|
||||||
@ -177,9 +177,9 @@ export const CameraWidgetEditorView: FC<CameraWidgetEditorViewProps> = props =>
|
|||||||
<NitroCardHeaderView headerText={ LocalizeText('camera.editor.button.text') } onCloseClick={ event => processAction('close') } />
|
<NitroCardHeaderView headerText={ LocalizeText('camera.editor.button.text') } onCloseClick={ event => processAction('close') } />
|
||||||
<NitroCardTabsView>
|
<NitroCardTabsView>
|
||||||
{ TABS.map(tab =>
|
{ TABS.map(tab =>
|
||||||
{
|
{
|
||||||
return <NitroCardTabsItemView key={ tab } isActive={ currentTab === tab } onClick={ event => processAction('change_tab', tab) }><i className={ 'icon icon-camera-' + tab }></i></NitroCardTabsItemView>
|
return <NitroCardTabsItemView key={ tab } isActive={ currentTab === tab } onClick={ event => processAction('change_tab', tab) }><i className={ 'icon icon-camera-' + tab }></i></NitroCardTabsItemView>
|
||||||
}) }
|
}) }
|
||||||
</NitroCardTabsView>
|
</NitroCardTabsView>
|
||||||
<NitroCardContentView>
|
<NitroCardContentView>
|
||||||
<Grid>
|
<Grid>
|
||||||
|
@ -20,12 +20,12 @@ export const CameraWidgetEffectListView: FC<CameraWidgetEffectListViewProps> = p
|
|||||||
return (
|
return (
|
||||||
<AutoGrid columnCount={ 2 } columnMinHeight={ 60 }>
|
<AutoGrid columnCount={ 2 } columnMinHeight={ 60 }>
|
||||||
{ effects && (effects.length > 0) && effects.map((effect, index) =>
|
{ effects && (effects.length > 0) && effects.map((effect, index) =>
|
||||||
{
|
{
|
||||||
const thumbnailUrl = (thumbnails.find(thumbnail => (thumbnail.effectName === effect.name)));
|
const thumbnailUrl = (thumbnails.find(thumbnail => (thumbnail.effectName === effect.name)));
|
||||||
const isActive = (selectedEffects.findIndex(selectedEffect => (selectedEffect.effect.name === effect.name)) > -1);
|
const isActive = (selectedEffects.findIndex(selectedEffect => (selectedEffect.effect.name === effect.name)) > -1);
|
||||||
|
|
||||||
return <CameraWidgetEffectListItemView key={ index } effect={ effect } thumbnailUrl={ ((thumbnailUrl && thumbnailUrl.thumbnailUrl) || null) } isActive={ isActive } isLocked={ (effect.minLevel > myLevel) } selectEffect={ () => processAction('select_effect', effect.name) } removeEffect={ () => processAction('remove_effect', effect.name) } />
|
return <CameraWidgetEffectListItemView key={ index } effect={ effect } thumbnailUrl={ ((thumbnailUrl && thumbnailUrl.thumbnailUrl) || null) } isActive={ isActive } isLocked={ (effect.minLevel > myLevel) } selectEffect={ () => processAction('select_effect', effect.name) } removeEffect={ () => processAction('remove_effect', effect.name) } />
|
||||||
}) }
|
}) }
|
||||||
</AutoGrid>
|
</AutoGrid>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ export const CalendarView: FC<CalendarViewProps> = props =>
|
|||||||
<Column size={ 10 }>
|
<Column size={ 10 }>
|
||||||
<Flex justifyContent="between" alignItems="center" gap={ 1 }>
|
<Flex justifyContent="between" alignItems="center" gap={ 1 }>
|
||||||
<Column gap={ 1 }>
|
<Column gap={ 1 }>
|
||||||
<Text fontSize={ 3 }>{ LocalizeText('campaign.calendar.heading.day', ['number'], [(selectedDay + 1).toString()]) }</Text>
|
<Text fontSize={ 3 }>{ LocalizeText('campaign.calendar.heading.day', [ 'number' ], [ (selectedDay + 1).toString() ]) }</Text>
|
||||||
<Text>{ dayMessage(selectedDay) }</Text>
|
<Text>{ dayMessage(selectedDay) }</Text>
|
||||||
</Column>
|
</Column>
|
||||||
<div>
|
<div>
|
||||||
@ -121,16 +121,16 @@ export const CalendarView: FC<CalendarViewProps> = props =>
|
|||||||
</Flex>
|
</Flex>
|
||||||
<Column center fullWidth>
|
<Column center fullWidth>
|
||||||
<Grid fit columnCount={ TOTAL_SHOWN_ITEMS } gap={ 1 }>
|
<Grid fit columnCount={ TOTAL_SHOWN_ITEMS } gap={ 1 }>
|
||||||
{ [...Array(TOTAL_SHOWN_ITEMS)].map((e, i) =>
|
{ [ ...Array(TOTAL_SHOWN_ITEMS) ].map((e, i) =>
|
||||||
{
|
{
|
||||||
const day = (index + i);
|
const day = (index + i);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column key={ i } overflow="hidden">
|
<Column key={ i } overflow="hidden">
|
||||||
<CalendarItemView itemId={ day } state={ getDayState(day) } active={ (selectedDay === day) } product={ receivedProducts.has(day) ? receivedProducts.get(day) : null } onClick={ onClickItem } />
|
<CalendarItemView itemId={ day } state={ getDayState(day) } active={ (selectedDay === day) } product={ receivedProducts.has(day) ? receivedProducts.get(day) : null } onClick={ onClickItem } />
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
}) }
|
}) }
|
||||||
</Grid>
|
</Grid>
|
||||||
</Column>
|
</Column>
|
||||||
<Flex center>
|
<Flex center>
|
||||||
|
@ -34,25 +34,25 @@ export const CampaignView: FC<{}> = props =>
|
|||||||
BatchUpdates(() =>
|
BatchUpdates(() =>
|
||||||
{
|
{
|
||||||
setCalendarData(prev =>
|
setCalendarData(prev =>
|
||||||
{
|
{
|
||||||
const copy = prev.clone();
|
const copy = prev.clone();
|
||||||
copy.openedDays.push(lastOpenAttempt);
|
copy.openedDays.push(lastOpenAttempt);
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
});
|
});
|
||||||
|
|
||||||
setReceivedProducts(prev =>
|
setReceivedProducts(prev =>
|
||||||
{
|
{
|
||||||
const copy = new Map(prev);
|
const copy = new Map(prev);
|
||||||
copy.set(lastAttempt, new CalendarItem(parser.productName, parser.customImage,parser.furnitureClassName));
|
copy.set(lastAttempt, new CalendarItem(parser.productName, parser.customImage,parser.furnitureClassName));
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setLastOpenAttempt(-1);
|
setLastOpenAttempt(-1);
|
||||||
}, [lastOpenAttempt]);
|
}, [ lastOpenAttempt ]);
|
||||||
|
|
||||||
UseMessageEventHook(CampaignCalendarDoorOpenedMessageEvent, onCampaignCalendarDoorOpenedMessageEvent);
|
UseMessageEventHook(CampaignCalendarDoorOpenedMessageEvent, onCampaignCalendarDoorOpenedMessageEvent);
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ export const CampaignView: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
SendMessageComposer(new OpenCampaignCalendarDoorComposer(calendarData.campaignName, id));
|
SendMessageComposer(new OpenCampaignCalendarDoorComposer(calendarData.campaignName, id));
|
||||||
}
|
}
|
||||||
}, [calendarData]);
|
}, [ calendarData ]);
|
||||||
|
|
||||||
const onCalendarClose = useCallback(() =>
|
const onCalendarClose = useCallback(() =>
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ export const CampaignView: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
RemoveLinkEventTracker(linkTracker);
|
RemoveLinkEventTracker(linkTracker);
|
||||||
}
|
}
|
||||||
}, [onLinkReceived]);
|
}, [ onLinkReceived ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -155,13 +155,13 @@ export const CatalogMessageHandler: FC<{}> = props =>
|
|||||||
if(offer.product && (offer.product.productType === ProductTypeEnum.WALL))
|
if(offer.product && (offer.product.productType === ProductTypeEnum.WALL))
|
||||||
{
|
{
|
||||||
setPurchaseOptions(prevValue =>
|
setPurchaseOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.extraData =( offer.product.extraParam || null);
|
newValue.extraData =( offer.product.extraParam || null);
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,27 +174,27 @@ export const CatalogMessageHandler: FC<{}> = props =>
|
|||||||
const petPalette = new CatalogPetPalette(parser.productCode, parser.palettes.slice());
|
const petPalette = new CatalogPetPalette(parser.productCode, parser.palettes.slice());
|
||||||
|
|
||||||
setCatalogOptions(prevValue =>
|
setCatalogOptions(prevValue =>
|
||||||
|
{
|
||||||
|
const petPalettes = [];
|
||||||
|
|
||||||
|
if(prevValue.petPalettes) petPalettes.push(...prevValue.petPalettes);
|
||||||
|
|
||||||
|
for(let i = 0; i < petPalettes.length; i++)
|
||||||
{
|
{
|
||||||
const petPalettes = [];
|
const palette = petPalettes[i];
|
||||||
|
|
||||||
if(prevValue.petPalettes) petPalettes.push(...prevValue.petPalettes);
|
if(palette.breed === petPalette.breed)
|
||||||
|
|
||||||
for(let i = 0; i < petPalettes.length; i++)
|
|
||||||
{
|
{
|
||||||
const palette = petPalettes[i];
|
petPalettes.splice(i, 1);
|
||||||
|
|
||||||
if(palette.breed === petPalette.breed)
|
break;
|
||||||
{
|
|
||||||
petPalettes.splice(i, 1);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
petPalettes.push(petPalette);
|
petPalettes.push(petPalette);
|
||||||
|
|
||||||
return { ...prevValue, petPalettes };
|
return { ...prevValue, petPalettes };
|
||||||
});
|
});
|
||||||
}, [ setCatalogOptions ]);
|
}, [ setCatalogOptions ]);
|
||||||
|
|
||||||
const onApproveNameMessageEvent = useCallback((event: ApproveNameMessageEvent) =>
|
const onApproveNameMessageEvent = useCallback((event: ApproveNameMessageEvent) =>
|
||||||
@ -214,11 +214,11 @@ export const CatalogMessageHandler: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setCatalogOptions(prevValue =>
|
setCatalogOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const clubOffers = parser.offers;
|
const clubOffers = parser.offers;
|
||||||
|
|
||||||
return { ...prevValue, clubOffers };
|
return { ...prevValue, clubOffers };
|
||||||
});
|
});
|
||||||
}, [ setCatalogOptions ]);
|
}, [ setCatalogOptions ]);
|
||||||
|
|
||||||
const onGuildMembershipsMessageEvent = useCallback((event: GuildMembershipsMessageEvent) =>
|
const onGuildMembershipsMessageEvent = useCallback((event: GuildMembershipsMessageEvent) =>
|
||||||
@ -226,11 +226,11 @@ export const CatalogMessageHandler: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setCatalogOptions(prevValue =>
|
setCatalogOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const groups = parser.groups;
|
const groups = parser.groups;
|
||||||
|
|
||||||
return { ...prevValue, groups };
|
return { ...prevValue, groups };
|
||||||
});
|
});
|
||||||
}, [ setCatalogOptions ]);
|
}, [ setCatalogOptions ]);
|
||||||
|
|
||||||
const onUserSubscriptionEvent = useCallback((event: UserSubscriptionEvent) =>
|
const onUserSubscriptionEvent = useCallback((event: UserSubscriptionEvent) =>
|
||||||
@ -238,16 +238,16 @@ export const CatalogMessageHandler: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setCatalogOptions(prevValue =>
|
setCatalogOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const subscriptionInfo = new SubscriptionInfo(
|
const subscriptionInfo = new SubscriptionInfo(
|
||||||
Math.max(0, parser.daysToPeriodEnd),
|
Math.max(0, parser.daysToPeriodEnd),
|
||||||
Math.max(0, parser.periodsSubscribedAhead),
|
Math.max(0, parser.periodsSubscribedAhead),
|
||||||
parser.isVip,
|
parser.isVip,
|
||||||
parser.pastClubDays,
|
parser.pastClubDays,
|
||||||
parser.pastVipDays);
|
parser.pastVipDays);
|
||||||
|
|
||||||
return { ...prevValue, subscriptionInfo };
|
return { ...prevValue, subscriptionInfo };
|
||||||
});
|
});
|
||||||
}, [ setCatalogOptions ]);
|
}, [ setCatalogOptions ]);
|
||||||
|
|
||||||
const onGiftWrappingConfigurationEvent = useCallback((event: GiftWrappingConfigurationEvent) =>
|
const onGiftWrappingConfigurationEvent = useCallback((event: GiftWrappingConfigurationEvent) =>
|
||||||
@ -255,11 +255,11 @@ export const CatalogMessageHandler: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setCatalogOptions(prevValue =>
|
setCatalogOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const giftConfiguration = new GiftWrappingConfiguration(parser);
|
const giftConfiguration = new GiftWrappingConfiguration(parser);
|
||||||
|
|
||||||
return { ...prevValue, giftConfiguration };
|
return { ...prevValue, giftConfiguration };
|
||||||
});
|
});
|
||||||
}, [ setCatalogOptions ]);
|
}, [ setCatalogOptions ]);
|
||||||
|
|
||||||
const onMarketplaceMakeOfferResult = useCallback((event: MarketplaceMakeOfferResult) =>
|
const onMarketplaceMakeOfferResult = useCallback((event: MarketplaceMakeOfferResult) =>
|
||||||
@ -288,11 +288,11 @@ export const CatalogMessageHandler: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setCatalogOptions(prevValue =>
|
setCatalogOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const clubGifts = parser;
|
const clubGifts = parser;
|
||||||
|
|
||||||
return { ...prevValue, clubGifts };
|
return { ...prevValue, clubGifts };
|
||||||
});
|
});
|
||||||
}, [ setCatalogOptions ]);
|
}, [ setCatalogOptions ]);
|
||||||
|
|
||||||
UseMessageEventHook(CatalogPagesListEvent, onCatalogPagesListEvent);
|
UseMessageEventHook(CatalogPagesListEvent, onCatalogPagesListEvent);
|
||||||
|
@ -183,31 +183,31 @@ export const CatalogView: FC<{}> = props =>
|
|||||||
nodes.reverse();
|
nodes.reverse();
|
||||||
|
|
||||||
setActiveNodes(prevValue =>
|
setActiveNodes(prevValue =>
|
||||||
|
{
|
||||||
|
const isActive = (prevValue.indexOf(targetNode) >= 0);
|
||||||
|
const isOpen = targetNode.isOpen;
|
||||||
|
|
||||||
|
for(const existing of prevValue)
|
||||||
{
|
{
|
||||||
const isActive = (prevValue.indexOf(targetNode) >= 0);
|
existing.deactivate();
|
||||||
const isOpen = targetNode.isOpen;
|
|
||||||
|
|
||||||
for(const existing of prevValue)
|
if(nodes.indexOf(existing) === -1) existing.close();
|
||||||
{
|
}
|
||||||
existing.deactivate();
|
|
||||||
|
|
||||||
if(nodes.indexOf(existing) === -1) existing.close();
|
for(const n of nodes)
|
||||||
}
|
{
|
||||||
|
n.activate();
|
||||||
|
|
||||||
for(const n of nodes)
|
if(n.parent) n.open();
|
||||||
{
|
|
||||||
n.activate();
|
|
||||||
|
|
||||||
if(n.parent) n.open();
|
if((n === targetNode.parent) && n.children.length) n.open();
|
||||||
|
}
|
||||||
|
|
||||||
if((n === targetNode.parent) && n.children.length) n.open();
|
if(isActive && isOpen) targetNode.close();
|
||||||
}
|
else targetNode.open();
|
||||||
|
|
||||||
if(isActive && isOpen) targetNode.close();
|
return nodes;
|
||||||
else targetNode.open();
|
});
|
||||||
|
|
||||||
return nodes;
|
|
||||||
});
|
|
||||||
|
|
||||||
if(targetNode.pageId > -1) loadCatalogPage(targetNode.pageId, offerId);
|
if(targetNode.pageId > -1) loadCatalogPage(targetNode.pageId, offerId);
|
||||||
}, [ setActiveNodes, loadCatalogPage ]);
|
}, [ setActiveNodes, loadCatalogPage ]);
|
||||||
@ -346,11 +346,11 @@ export const CatalogView: FC<{}> = props =>
|
|||||||
return () =>
|
return () =>
|
||||||
{
|
{
|
||||||
setRoomPreviewer(prevValue =>
|
setRoomPreviewer(prevValue =>
|
||||||
{
|
{
|
||||||
prevValue.dispose();
|
prevValue.dispose();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -415,23 +415,26 @@ export const CatalogView: FC<{}> = props =>
|
|||||||
<CatalogMessageHandler />
|
<CatalogMessageHandler />
|
||||||
{ isVisible &&
|
{ isVisible &&
|
||||||
<NitroCardView uniqueKey="catalog" className="nitro-catalog">
|
<NitroCardView uniqueKey="catalog" className="nitro-catalog">
|
||||||
<NitroCardHeaderView headerText={ LocalizeText('catalog.title') } onCloseClick={ event => { setIsVisible(false); } } />
|
<NitroCardHeaderView headerText={ LocalizeText('catalog.title') } onCloseClick={ event =>
|
||||||
|
{
|
||||||
|
setIsVisible(false);
|
||||||
|
} } />
|
||||||
<NitroCardTabsView>
|
<NitroCardTabsView>
|
||||||
{ rootNode && (rootNode.children.length > 0) && rootNode.children.map(child =>
|
{ rootNode && (rootNode.children.length > 0) && rootNode.children.map(child =>
|
||||||
{
|
{
|
||||||
if(!child.isVisible) return null;
|
if(!child.isVisible) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NitroCardTabsItemView key={ child.pageId } isActive={ child.isActive } onClick={ event =>
|
<NitroCardTabsItemView key={ child.pageId } isActive={ child.isActive } onClick={ event =>
|
||||||
{
|
{
|
||||||
if(searchResult) setSearchResult(null);
|
if(searchResult) setSearchResult(null);
|
||||||
|
|
||||||
activateNode(child);
|
activateNode(child);
|
||||||
} }>
|
} }>
|
||||||
{ child.localization }
|
{ child.localization }
|
||||||
</NitroCardTabsItemView>
|
</NitroCardTabsItemView>
|
||||||
);
|
);
|
||||||
}) }
|
}) }
|
||||||
</NitroCardTabsView>
|
</NitroCardTabsView>
|
||||||
<NitroCardContentView>
|
<NitroCardContentView>
|
||||||
<Grid>
|
<Grid>
|
||||||
@ -446,8 +449,8 @@ export const CatalogView: FC<{}> = props =>
|
|||||||
</Grid>
|
</Grid>
|
||||||
</NitroCardContentView>
|
</NitroCardContentView>
|
||||||
</NitroCardView> }
|
</NitroCardView> }
|
||||||
<CatalogGiftView />
|
<CatalogGiftView />
|
||||||
<MarketplacePostOfferView />
|
<MarketplacePostOfferView />
|
||||||
</CatalogContextProvider>
|
</CatalogContextProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,6 @@ export class CatalogPetPalette
|
|||||||
constructor(
|
constructor(
|
||||||
public readonly breed: string,
|
public readonly breed: string,
|
||||||
public readonly palettes: SellablePetPaletteData[]
|
public readonly palettes: SellablePetPaletteData[]
|
||||||
) {}
|
)
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
|
@ -85,21 +85,21 @@ export function GetPetAvailableColors(petIndex: number, palettes: SellablePetPal
|
|||||||
switch(petIndex)
|
switch(petIndex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return [[16743226], [16750435], [16764339], [0xF59500], [16498012], [16704690], [0xEDD400], [16115545], [16513201], [8694111], [11585939], [14413767], [6664599], [9553845], [12971486], [8358322], [10002885], [13292268], [10780600], [12623573], [14403561], [12418717], [14327229], [15517403], [14515069], [15764368], [16366271], [0xABABAB], [0xD4D4D4], [0xFFFFFF], [14256481], [14656129], [15848130], [14005087], [14337152], [15918540], [15118118], [15531929], [9764857], [11258085]];
|
return [ [ 16743226 ], [ 16750435 ], [ 16764339 ], [ 0xF59500 ], [ 16498012 ], [ 16704690 ], [ 0xEDD400 ], [ 16115545 ], [ 16513201 ], [ 8694111 ], [ 11585939 ], [ 14413767 ], [ 6664599 ], [ 9553845 ], [ 12971486 ], [ 8358322 ], [ 10002885 ], [ 13292268 ], [ 10780600 ], [ 12623573 ], [ 14403561 ], [ 12418717 ], [ 14327229 ], [ 15517403 ], [ 14515069 ], [ 15764368 ], [ 16366271 ], [ 0xABABAB ], [ 0xD4D4D4 ], [ 0xFFFFFF ], [ 14256481 ], [ 14656129 ], [ 15848130 ], [ 14005087 ], [ 14337152 ], [ 15918540 ], [ 15118118 ], [ 15531929 ], [ 9764857 ], [ 11258085 ] ];
|
||||||
case 1:
|
case 1:
|
||||||
return [[16743226], [16750435], [16764339], [0xF59500], [16498012], [16704690], [0xEDD400], [16115545], [16513201], [8694111], [11585939], [14413767], [6664599], [9553845], [12971486], [8358322], [10002885], [13292268], [10780600], [12623573], [14403561], [12418717], [14327229], [15517403], [14515069], [15764368], [16366271], [0xABABAB], [0xD4D4D4], [0xFFFFFF], [14256481], [14656129], [15848130], [14005087], [14337152], [15918540], [15118118], [15531929], [9764857], [11258085]];
|
return [ [ 16743226 ], [ 16750435 ], [ 16764339 ], [ 0xF59500 ], [ 16498012 ], [ 16704690 ], [ 0xEDD400 ], [ 16115545 ], [ 16513201 ], [ 8694111 ], [ 11585939 ], [ 14413767 ], [ 6664599 ], [ 9553845 ], [ 12971486 ], [ 8358322 ], [ 10002885 ], [ 13292268 ], [ 10780600 ], [ 12623573 ], [ 14403561 ], [ 12418717 ], [ 14327229 ], [ 15517403 ], [ 14515069 ], [ 15764368 ], [ 16366271 ], [ 0xABABAB ], [ 0xD4D4D4 ], [ 0xFFFFFF ], [ 14256481 ], [ 14656129 ], [ 15848130 ], [ 14005087 ], [ 14337152 ], [ 15918540 ], [ 15118118 ], [ 15531929 ], [ 9764857 ], [ 11258085 ] ];
|
||||||
case 2:
|
case 2:
|
||||||
return [[16579283], [15378351], [8830016], [15257125], [9340985], [8949607], [6198292], [8703620], [9889626], [8972045], [12161285], [13162269], [8620113], [12616503], [8628101], [0xD2FF00], [9764857]];
|
return [ [ 16579283 ], [ 15378351 ], [ 8830016 ], [ 15257125 ], [ 9340985 ], [ 8949607 ], [ 6198292 ], [ 8703620 ], [ 9889626 ], [ 8972045 ], [ 12161285 ], [ 13162269 ], [ 8620113 ], [ 12616503 ], [ 8628101 ], [ 0xD2FF00 ], [ 9764857 ] ];
|
||||||
case 3:
|
case 3:
|
||||||
return [[0xFFFFFF], [0xEEEEEE], [0xDDDDDD]];
|
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ] ];
|
||||||
case 4:
|
case 4:
|
||||||
return [[0xFFFFFF], [16053490], [15464440], [16248792], [15396319], [15007487]];
|
return [ [ 0xFFFFFF ], [ 16053490 ], [ 15464440 ], [ 16248792 ], [ 15396319 ], [ 15007487 ] ];
|
||||||
case 5:
|
case 5:
|
||||||
return [[0xFFFFFF], [0xEEEEEE], [0xDDDDDD]];
|
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ] ];
|
||||||
case 6:
|
case 6:
|
||||||
return [[0xFFFFFF], [0xEEEEEE], [0xDDDDDD], [16767177], [16770205], [16751331]];
|
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ], [ 16767177 ], [ 16770205 ], [ 16751331 ] ];
|
||||||
case 7:
|
case 7:
|
||||||
return [[0xCCCCCC], [0xAEAEAE], [16751331], [10149119], [16763290], [16743786]];
|
return [ [ 0xCCCCCC ], [ 0xAEAEAE ], [ 16751331 ], [ 10149119 ], [ 16763290 ], [ 16743786 ] ];
|
||||||
default: {
|
default: {
|
||||||
const colors: number[][] = [];
|
const colors: number[][] = [];
|
||||||
|
|
||||||
|
@ -6,6 +6,6 @@ export class SearchResult
|
|||||||
constructor(
|
constructor(
|
||||||
public readonly searchValue: string,
|
public readonly searchValue: string,
|
||||||
public readonly offers: IPurchasableOffer[],
|
public readonly offers: IPurchasableOffer[],
|
||||||
public readonly filteredNodes: ICatalogNode[]
|
public readonly filteredNodes: ICatalogNode[])
|
||||||
) {}
|
{}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,8 @@ export class SubscriptionInfo
|
|||||||
public readonly clubPeriods: number = 0,
|
public readonly clubPeriods: number = 0,
|
||||||
public readonly isVip: boolean = false,
|
public readonly isVip: boolean = false,
|
||||||
public readonly pastDays: number = 0,
|
public readonly pastDays: number = 0,
|
||||||
public readonly pastVipDays: number = 0) {}
|
public readonly pastVipDays: number = 0)
|
||||||
|
{}
|
||||||
|
|
||||||
public get lastUpdated(): number
|
public get lastUpdated(): number
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,7 @@ export const CatalogGiftView: FC<{}> = props =>
|
|||||||
<Column gap={ 1 }>
|
<Column gap={ 1 }>
|
||||||
<Text fontWeight="bold">{ LocalizeText(boxName) }</Text>
|
<Text fontWeight="bold">{ LocalizeText(boxName) }</Text>
|
||||||
<Flex alignItems="center" gap={ 1 }>
|
<Flex alignItems="center" gap={ 1 }>
|
||||||
{ LocalizeText(priceText, ['price'], [giftConfiguration.price.toString()]) }
|
{ LocalizeText(priceText, [ 'price' ], [ giftConfiguration.price.toString() ]) }
|
||||||
<LayoutCurrencyIcon type={ -1 } />
|
<LayoutCurrencyIcon type={ -1 } />
|
||||||
</Flex>
|
</Flex>
|
||||||
</Column>
|
</Column>
|
||||||
|
@ -14,11 +14,11 @@ export const CatalogNavigationSetView: FC<CatalogNavigationSetViewProps> = props
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{ node && (node.children.length > 0) && node.children.map((n, index) =>
|
{ node && (node.children.length > 0) && node.children.map((n, index) =>
|
||||||
{
|
{
|
||||||
if(!n.isVisible) return null;
|
if(!n.isVisible) return null;
|
||||||
|
|
||||||
return <CatalogNavigationItemView key={ index } node={ n } />
|
return <CatalogNavigationItemView key={ index } node={ n } />
|
||||||
}) }
|
}) }
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ export const CatalogLayoutBadgeDisplayView: FC<CatalogLayoutProps> = props =>
|
|||||||
<Column grow gap={ 1 }>
|
<Column grow gap={ 1 }>
|
||||||
<Text grow truncate>{ currentOffer.localizationName }</Text>
|
<Text grow truncate>{ currentOffer.localizationName }</Text>
|
||||||
<Flex justifyContent="end">
|
<Flex justifyContent="end">
|
||||||
<CatalogTotalPriceWidget alignItems="end" />
|
<CatalogTotalPriceWidget alignItems="end" />
|
||||||
</Flex>
|
</Flex>
|
||||||
<CatalogPurchaseWidgetView />
|
<CatalogPurchaseWidgetView />
|
||||||
</Column>
|
</Column>
|
||||||
|
@ -21,13 +21,13 @@ export const CatalogLayoutTrophiesView: FC<CatalogLayoutProps> = props =>
|
|||||||
if(!currentOffer) return;
|
if(!currentOffer) return;
|
||||||
|
|
||||||
setPurchaseOptions(prevValue =>
|
setPurchaseOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.extraData = trophyText;
|
newValue.extraData = trophyText;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}, [ currentOffer, trophyText, setPurchaseOptions ]);
|
}, [ currentOffer, trophyText, setPurchaseOptions ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -140,28 +140,28 @@ export const CatalogLayoutVipBuyView: FC<CatalogLayoutProps> = props =>
|
|||||||
<Column fullHeight size={ 7 } overflow="hidden" justifyContent="between">
|
<Column fullHeight size={ 7 } overflow="hidden" justifyContent="between">
|
||||||
<AutoGrid columnCount={ 1 } className="nitro-catalog-layout-vip-buy-grid">
|
<AutoGrid columnCount={ 1 } className="nitro-catalog-layout-vip-buy-grid">
|
||||||
{ clubOffers && (clubOffers.length > 0) && clubOffers.map((offer, index) =>
|
{ clubOffers && (clubOffers.length > 0) && clubOffers.map((offer, index) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<LayoutGridItem key={ index } column={ false } center={ false } alignItems="center" justifyContent="between" itemActive={ pendingOffer === offer } className="p-1" onClick={ () => setOffer(offer) }>
|
<LayoutGridItem key={ index } column={ false } center={ false } alignItems="center" justifyContent="between" itemActive={ pendingOffer === offer } className="p-1" onClick={ () => setOffer(offer) }>
|
||||||
<i className="icon-hc-banner" />
|
<i className="icon-hc-banner" />
|
||||||
<Column justifyContent="end" gap={ 0 }>
|
<Column justifyContent="end" gap={ 0 }>
|
||||||
<Text textEnd>{ getOfferText(offer) }</Text>
|
<Text textEnd>{ getOfferText(offer) }</Text>
|
||||||
<Flex justifyContent="end" gap={ 1 }>
|
<Flex justifyContent="end" gap={ 1 }>
|
||||||
{ (offer.priceCredits > 0) &&
|
{ (offer.priceCredits > 0) &&
|
||||||
<Flex alignItems="center" justifyContent="end" gap={ 1 }>
|
<Flex alignItems="center" justifyContent="end" gap={ 1 }>
|
||||||
<Text>{ offer.priceCredits }</Text>
|
<Text>{ offer.priceCredits }</Text>
|
||||||
<LayoutCurrencyIcon type={ -1 } />
|
<LayoutCurrencyIcon type={ -1 } />
|
||||||
</Flex> }
|
</Flex> }
|
||||||
{ (offer.priceActivityPoints > 0) &&
|
{ (offer.priceActivityPoints > 0) &&
|
||||||
<Flex alignItems="center" justifyContent="end" gap={ 1 }>
|
<Flex alignItems="center" justifyContent="end" gap={ 1 }>
|
||||||
<Text>{ offer.priceActivityPoints }</Text>
|
<Text>{ offer.priceActivityPoints }</Text>
|
||||||
<LayoutCurrencyIcon type={ offer.priceActivityPointsType } />
|
<LayoutCurrencyIcon type={ offer.priceActivityPointsType } />
|
||||||
</Flex> }
|
</Flex> }
|
||||||
</Flex>
|
</Flex>
|
||||||
</Column>
|
</Column>
|
||||||
</LayoutGridItem>
|
</LayoutGridItem>
|
||||||
);
|
);
|
||||||
}) }
|
}) }
|
||||||
</AutoGrid>
|
</AutoGrid>
|
||||||
<Text center dangerouslySetInnerHTML={{ __html: LocalizeText('catalog.vip.buy.hccenter') }}></Text>
|
<Text center dangerouslySetInnerHTML={{ __html: LocalizeText('catalog.vip.buy.hccenter') }}></Text>
|
||||||
</Column>
|
</Column>
|
||||||
|
@ -64,7 +64,7 @@ export const GetCatalogLayout = (page: ICatalogPage, hideNavigation: () => void)
|
|||||||
case 'badge_display':
|
case 'badge_display':
|
||||||
return <CatalogLayoutBadgeDisplayView { ...layoutProps } />;
|
return <CatalogLayoutBadgeDisplayView { ...layoutProps } />;
|
||||||
//case 'default_3x3_color_grouping':
|
//case 'default_3x3_color_grouping':
|
||||||
//return <CatalogLayoutColorGroupingView { ...layoutProps } />;
|
//return <CatalogLayoutColorGroupingView { ...layoutProps } />;
|
||||||
case 'bots':
|
case 'bots':
|
||||||
case 'default_3x3':
|
case 'default_3x3':
|
||||||
default:
|
default:
|
||||||
|
@ -44,8 +44,8 @@ export const CatalogLayoutMarketplaceItemView: FC<MarketplaceItemViewProps> = pr
|
|||||||
text = hours + ' ' + LocalizeText('catalog.marketplace.offer.hours') + ' ' + text;
|
text = hours + ' ' + LocalizeText('catalog.marketplace.offer.hours') + ' ' + text;
|
||||||
}
|
}
|
||||||
|
|
||||||
return LocalizeText('catalog.marketplace.offer.time_left', ['time'], [text] );
|
return LocalizeText('catalog.marketplace.offer.time_left', [ 'time' ], [ text ] );
|
||||||
}, [offerData]);
|
}, [ offerData ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutGridItem shrink center={ false } column={ false } alignItems="center" className="p-1">
|
<LayoutGridItem shrink center={ false } column={ false } alignItems="center" className="p-1">
|
||||||
@ -59,8 +59,8 @@ export const CatalogLayoutMarketplaceItemView: FC<MarketplaceItemViewProps> = pr
|
|||||||
</> }
|
</> }
|
||||||
{ (type === PUBLIC_OFFER) &&
|
{ (type === PUBLIC_OFFER) &&
|
||||||
<>
|
<>
|
||||||
<Text>{ LocalizeText('catalog.marketplace.offer.price_public_item', ['price', 'average'], [offerData.price.toString(), offerData.averagePrice.toString() ]) }</Text>
|
<Text>{ LocalizeText('catalog.marketplace.offer.price_public_item', [ 'price', 'average' ], [ offerData.price.toString(), offerData.averagePrice.toString() ]) }</Text>
|
||||||
<Text>{ LocalizeText('catalog.marketplace.offer_count', ['count'], [offerData.offerCount.toString()]) }</Text>
|
<Text>{ LocalizeText('catalog.marketplace.offer_count', [ 'count' ], [ offerData.offerCount.toString() ]) }</Text>
|
||||||
</> }
|
</> }
|
||||||
</Column>
|
</Column>
|
||||||
<Column gap={ 1 }>
|
<Column gap={ 1 }>
|
||||||
|
@ -20,13 +20,13 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC<CatalogLayoutProps> = prop
|
|||||||
if(!parser) return;
|
if(!parser) return;
|
||||||
|
|
||||||
const offers = parser.offers.map(offer =>
|
const offers = parser.offers.map(offer =>
|
||||||
{
|
{
|
||||||
const newOffer = new MarketplaceOfferData(offer.offerId, offer.furniId, offer.furniType, offer.extraData, offer.stuffData, offer.price, offer.status, offer.averagePrice, offer.offerCount);
|
const newOffer = new MarketplaceOfferData(offer.offerId, offer.furniId, offer.furniType, offer.extraData, offer.stuffData, offer.price, offer.status, offer.averagePrice, offer.offerCount);
|
||||||
|
|
||||||
newOffer.timeLeftMinutes = offer.timeLeftMinutes;
|
newOffer.timeLeftMinutes = offer.timeLeftMinutes;
|
||||||
|
|
||||||
return newOffer;
|
return newOffer;
|
||||||
});
|
});
|
||||||
|
|
||||||
BatchUpdates(() =>
|
BatchUpdates(() =>
|
||||||
{
|
{
|
||||||
@ -91,7 +91,7 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC<CatalogLayoutProps> = prop
|
|||||||
{ (creditsWaiting > 0) &&
|
{ (creditsWaiting > 0) &&
|
||||||
<Column center gap={ 1 } className="bg-muted rounded p-2">
|
<Column center gap={ 1 } className="bg-muted rounded p-2">
|
||||||
<Text>
|
<Text>
|
||||||
{ LocalizeText('catalog.marketplace.redeem.get_credits', ['count', 'credits'], [ soldOffers.length.toString(), creditsWaiting.toString() ]) }
|
{ LocalizeText('catalog.marketplace.redeem.get_credits', [ 'count', 'credits' ], [ soldOffers.length.toString(), creditsWaiting.toString() ]) }
|
||||||
</Text>
|
</Text>
|
||||||
<Button className="mt-1" onClick={ redeemSoldOffers }>
|
<Button className="mt-1" onClick={ redeemSoldOffers }>
|
||||||
{ LocalizeText('catalog.marketplace.offer.redeem') }
|
{ LocalizeText('catalog.marketplace.offer.redeem') }
|
||||||
|
@ -11,9 +11,9 @@ import { IMarketplaceSearchOptions } from './common/IMarketplaceSearchOptions';
|
|||||||
import { MarketplaceOfferData } from './common/MarketplaceOfferData';
|
import { MarketplaceOfferData } from './common/MarketplaceOfferData';
|
||||||
import { MarketplaceSearchType } from './common/MarketplaceSearchType';
|
import { MarketplaceSearchType } from './common/MarketplaceSearchType';
|
||||||
|
|
||||||
const SORT_TYPES_VALUE = [1, 2];
|
const SORT_TYPES_VALUE = [ 1, 2 ];
|
||||||
const SORT_TYPES_ACTIVITY = [3, 4, 5, 6];
|
const SORT_TYPES_ACTIVITY = [ 3, 4, 5, 6 ];
|
||||||
const SORT_TYPES_ADVANCED = [1, 2, 3, 4, 5, 6];
|
const SORT_TYPES_ADVANCED = [ 1, 2, 3, 4, 5, 6 ];
|
||||||
export interface CatalogLayoutMarketplacePublicItemsViewProps extends CatalogLayoutProps
|
export interface CatalogLayoutMarketplacePublicItemsViewProps extends CatalogLayoutProps
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
|
|||||||
return SORT_TYPES_ADVANCED;
|
return SORT_TYPES_ADVANCED;
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}, [searchType]);
|
}, [ searchType ]);
|
||||||
|
|
||||||
const purchaseItem = useCallback((offerData: MarketplaceOfferData) =>
|
const purchaseItem = useCallback((offerData: MarketplaceOfferData) =>
|
||||||
{
|
{
|
||||||
@ -55,10 +55,10 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
|
|||||||
}
|
}
|
||||||
const offerId = offerData.offerId;
|
const offerId = offerData.offerId;
|
||||||
NotificationUtilities.confirm(LocalizeText('catalog.marketplace.confirm_header'), () =>
|
NotificationUtilities.confirm(LocalizeText('catalog.marketplace.confirm_header'), () =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new BuyMarketplaceOfferMessageComposer(offerId));
|
SendMessageComposer(new BuyMarketplaceOfferMessageComposer(offerId));
|
||||||
},
|
},
|
||||||
null, null, null, LocalizeText('catalog.marketplace.confirm_title'));
|
null, null, null, LocalizeText('catalog.marketplace.confirm_title'));
|
||||||
},[]);
|
},[]);
|
||||||
|
|
||||||
const onMarketPlaceOffersEvent = useCallback( (event: MarketPlaceOffersEvent) =>
|
const onMarketPlaceOffersEvent = useCallback( (event: MarketPlaceOffersEvent) =>
|
||||||
@ -104,8 +104,8 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
|
|||||||
NotificationUtilities.simpleAlert(LocalizeText('catalog.marketplace.not_available_header'), NotificationAlertType.DEFAULT, null, null, LocalizeText('catalog.marketplace.not_available_title'));
|
NotificationUtilities.simpleAlert(LocalizeText('catalog.marketplace.not_available_header'), NotificationAlertType.DEFAULT, null, null, LocalizeText('catalog.marketplace.not_available_title'));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// our shit was updated
|
// our shit was updated
|
||||||
// todo: some dialogue modal
|
// todo: some dialogue modal
|
||||||
setOffers( prev =>
|
setOffers( prev =>
|
||||||
{
|
{
|
||||||
const newVal = new Map(prev);
|
const newVal = new Map(prev);
|
||||||
@ -124,7 +124,7 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
|
|||||||
});
|
});
|
||||||
|
|
||||||
NotificationUtilities.confirm(LocalizeText('catalog.marketplace.confirm_higher_header') +
|
NotificationUtilities.confirm(LocalizeText('catalog.marketplace.confirm_higher_header') +
|
||||||
'\n' + LocalizeText('catalog.marketplace.confirm_price', ['price'], [parser.newPrice.toString()]), () =>
|
'\n' + LocalizeText('catalog.marketplace.confirm_price', [ 'price' ], [ parser.newPrice.toString() ]), () =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new BuyMarketplaceOfferMessageComposer(parser.offerId));
|
SendMessageComposer(new BuyMarketplaceOfferMessageComposer(parser.offerId));
|
||||||
},
|
},
|
||||||
@ -134,7 +134,7 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
|
|||||||
NotificationUtilities.simpleAlert(LocalizeText('catalog.alert.notenough.credits.description'), NotificationAlertType.DEFAULT, null, null, LocalizeText('catalog.alert.notenough.title'));
|
NotificationUtilities.simpleAlert(LocalizeText('catalog.alert.notenough.credits.description'), NotificationAlertType.DEFAULT, null, null, LocalizeText('catalog.alert.notenough.title'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}, [lastSearch, requestOffers]);
|
}, [ lastSearch, requestOffers ]);
|
||||||
|
|
||||||
UseMessageEventHook(MarketPlaceOffersEvent, onMarketPlaceOffersEvent);
|
UseMessageEventHook(MarketPlaceOffersEvent, onMarketPlaceOffersEvent);
|
||||||
UseMessageEventHook(MarketplaceBuyOfferResultEvent, onMarketplaceBuyOfferResultEvent);
|
UseMessageEventHook(MarketplaceBuyOfferResultEvent, onMarketplaceBuyOfferResultEvent);
|
||||||
|
@ -46,7 +46,7 @@ export const SearchFormView: FC<SearchFormViewProps> = props =>
|
|||||||
setSortType(sortType);
|
setSortType(sortType);
|
||||||
|
|
||||||
if(searchType === MarketplaceSearchType.BY_ACTIVITY || MarketplaceSearchType.BY_VALUE === searchType) onSearch({ minPrice: -1, maxPrice: -1, query: '', type: sortType });
|
if(searchType === MarketplaceSearchType.BY_ACTIVITY || MarketplaceSearchType.BY_VALUE === searchType) onSearch({ minPrice: -1, maxPrice: -1, query: '', type: sortType });
|
||||||
}, [onSearch, searchType, sortTypes]);
|
}, [ onSearch, searchType, sortTypes ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column gap={ 1 }>
|
<Column gap={ 1 }>
|
||||||
|
@ -18,13 +18,13 @@ export const MarketplacePostOfferView : FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setCatalogOptions(prevValue =>
|
setCatalogOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.marketplaceConfiguration = parser;
|
newValue.marketplaceConfiguration = parser;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}, [ setCatalogOptions ]);
|
}, [ setCatalogOptions ]);
|
||||||
|
|
||||||
UseMessageEventHook(MarketplaceConfigurationEvent, onMarketplaceConfigurationEvent);
|
UseMessageEventHook(MarketplaceConfigurationEvent, onMarketplaceConfigurationEvent);
|
||||||
@ -60,11 +60,14 @@ export const MarketplacePostOfferView : FC<{}> = props =>
|
|||||||
if(!item || (askingPrice <= marketplaceConfiguration.minimumPrice)) return;
|
if(!item || (askingPrice <= marketplaceConfiguration.minimumPrice)) return;
|
||||||
|
|
||||||
NotificationUtilities.confirm(LocalizeText('inventory.marketplace.confirm_offer.info', [ 'furniname', 'price' ], [ getFurniTitle, askingPrice.toString() ]), () =>
|
NotificationUtilities.confirm(LocalizeText('inventory.marketplace.confirm_offer.info', [ 'furniname', 'price' ], [ getFurniTitle, askingPrice.toString() ]), () =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new MakeOfferMessageComposer(askingPrice, item.isWallItem ? 2 : 1, item.id));
|
SendMessageComposer(new MakeOfferMessageComposer(askingPrice, item.isWallItem ? 2 : 1, item.id));
|
||||||
setItem(null);
|
setItem(null);
|
||||||
},
|
},
|
||||||
() => { setItem(null) }, null, null, LocalizeText('inventory.marketplace.confirm_offer.title'));
|
() =>
|
||||||
|
{
|
||||||
|
setItem(null)
|
||||||
|
}, null, null, LocalizeText('inventory.marketplace.confirm_offer.title'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -82,7 +85,7 @@ export const MarketplacePostOfferView : FC<{}> = props =>
|
|||||||
</Column>
|
</Column>
|
||||||
<Column overflow="auto">
|
<Column overflow="auto">
|
||||||
<Text italics>
|
<Text italics>
|
||||||
{ LocalizeText('inventory.marketplace.make_offer.expiration_info', ['time'], [marketplaceConfiguration.offerTime.toString()]) }
|
{ LocalizeText('inventory.marketplace.make_offer.expiration_info', [ 'time' ], [ marketplaceConfiguration.offerTime.toString() ]) }
|
||||||
</Text>
|
</Text>
|
||||||
<div className="input-group has-validation">
|
<div className="input-group has-validation">
|
||||||
<input className="form-control form-control-sm" type="number" min={ 0 } value={ askingPrice } onChange={ event => setAskingPrice(parseInt(event.target.value)) } placeholder={ LocalizeText('inventory.marketplace.make_offer.price_request') } />
|
<input className="form-control form-control-sm" type="number" min={ 0 } value={ askingPrice } onChange={ event => setAskingPrice(parseInt(event.target.value)) } placeholder={ LocalizeText('inventory.marketplace.make_offer.price_request') } />
|
||||||
|
@ -212,13 +212,13 @@ export const CatalogLayoutPetView: FC<CatalogLayoutProps> = props =>
|
|||||||
<Column size={ 7 } overflow="hidden">
|
<Column size={ 7 } overflow="hidden">
|
||||||
<AutoGrid columnCount={ 5 }>
|
<AutoGrid columnCount={ 5 }>
|
||||||
{ !colorsShowing && (sellablePalettes.length > 0) && sellablePalettes.map((palette, index) =>
|
{ !colorsShowing && (sellablePalettes.length > 0) && sellablePalettes.map((palette, index) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<LayoutGridItem key={ index } itemActive={ (selectedPaletteIndex === index) } onClick={ event => setSelectedPaletteIndex(index) }>
|
<LayoutGridItem key={ index } itemActive={ (selectedPaletteIndex === index) } onClick={ event => setSelectedPaletteIndex(index) }>
|
||||||
<LayoutPetImageView typeId={ petIndex } paletteId={ palette.paletteId } direction={ 2 } headOnly={ true } />
|
<LayoutPetImageView typeId={ petIndex } paletteId={ palette.paletteId } direction={ 2 } headOnly={ true } />
|
||||||
</LayoutGridItem>
|
</LayoutGridItem>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{ colorsShowing && (sellableColors.length > 0) && sellableColors.map((colorSet, index) => <LayoutGridItem itemHighlight key={ index } itemActive={ (selectedColorIndex === index) } itemColor={ ColorConverter.int2rgb(colorSet[0]) } className="clear-bg" onClick={ event => setSelectedColorIndex(index) } />) }
|
{ colorsShowing && (sellableColors.length > 0) && sellableColors.map((colorSet, index) => <LayoutGridItem itemHighlight key={ index } itemActive={ (selectedColorIndex === index) } itemColor={ ColorConverter.int2rgb(colorSet[0]) } className="clear-bg" onClick={ event => setSelectedColorIndex(index) } />) }
|
||||||
</AutoGrid>
|
</AutoGrid>
|
||||||
</Column>
|
</Column>
|
||||||
|
@ -27,16 +27,16 @@ export const CatalogLayoutVipGiftsView: FC<CatalogLayoutProps> = props =>
|
|||||||
const selectGift = useCallback((localizationId: string) =>
|
const selectGift = useCallback((localizationId: string) =>
|
||||||
{
|
{
|
||||||
NotificationUtilities.confirm(LocalizeText('catalog.club_gift.confirm'), () =>
|
NotificationUtilities.confirm(LocalizeText('catalog.club_gift.confirm'), () =>
|
||||||
|
{
|
||||||
|
SendMessageComposer(new SelectClubGiftComposer(localizationId));
|
||||||
|
|
||||||
|
setCatalogOptions(prevValue =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new SelectClubGiftComposer(localizationId));
|
prevValue.clubGifts.giftsAvailable--;
|
||||||
|
|
||||||
setCatalogOptions(prevValue =>
|
return { ...prevValue };
|
||||||
{
|
});
|
||||||
prevValue.clubGifts.giftsAvailable--;
|
}, null);
|
||||||
|
|
||||||
return { ...prevValue };
|
|
||||||
});
|
|
||||||
}, null);
|
|
||||||
}, [ setCatalogOptions ]);
|
}, [ setCatalogOptions ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -21,7 +21,7 @@ export const VipGiftItem : FC<VipGiftItemViewProps> = props =>
|
|||||||
const productData = offer.products[0];
|
const productData = offer.products[0];
|
||||||
|
|
||||||
return ProductImageUtility.getProductImageUrl(productData.productType, productData.furniClassId, productData.extraParam);
|
return ProductImageUtility.getProductImageUrl(productData.productType, productData.furniClassId, productData.extraParam);
|
||||||
}, [offer]);
|
}, [ offer ]);
|
||||||
|
|
||||||
const getItemTitle = useCallback(() =>
|
const getItemTitle = useCallback(() =>
|
||||||
{
|
{
|
||||||
@ -32,7 +32,7 @@ export const VipGiftItem : FC<VipGiftItemViewProps> = props =>
|
|||||||
const localizationKey = ProductImageUtility.getProductCategory(productData.productType, productData.furniClassId) === 2 ? 'wallItem.name.' + productData.furniClassId : 'roomItem.name.' + productData.furniClassId;
|
const localizationKey = ProductImageUtility.getProductCategory(productData.productType, productData.furniClassId) === 2 ? 'wallItem.name.' + productData.furniClassId : 'roomItem.name.' + productData.furniClassId;
|
||||||
|
|
||||||
return LocalizeText(localizationKey);
|
return LocalizeText(localizationKey);
|
||||||
}, [offer]);
|
}, [ offer ]);
|
||||||
|
|
||||||
const getItemDesc = useCallback( () =>
|
const getItemDesc = useCallback( () =>
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ export const VipGiftItem : FC<VipGiftItemViewProps> = props =>
|
|||||||
const localizationKey = ProductImageUtility.getProductCategory(productData.productType, productData.furniClassId) === 2 ? 'wallItem.desc.' + productData.furniClassId : 'roomItem.desc.' + productData.furniClassId ;
|
const localizationKey = ProductImageUtility.getProductCategory(productData.productType, productData.furniClassId) === 2 ? 'wallItem.desc.' + productData.furniClassId : 'roomItem.desc.' + productData.furniClassId ;
|
||||||
|
|
||||||
return LocalizeText(localizationKey);
|
return LocalizeText(localizationKey);
|
||||||
}, [offer]);
|
}, [ offer ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutGridItem center={ false } column={ false } alignItems="center" className="p-1">
|
<LayoutGridItem center={ false } column={ false } alignItems="center" className="p-1">
|
||||||
|
@ -34,27 +34,27 @@ export const CatalogBadgeSelectorWidgetView: FC<CatalogBadgeSelectorWidgetViewPr
|
|||||||
if(!currentOffer) return;
|
if(!currentOffer) return;
|
||||||
|
|
||||||
setPurchaseOptions(prevValue =>
|
setPurchaseOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.extraParamRequired = true;
|
newValue.extraParamRequired = true;
|
||||||
newValue.extraData = ((previewStuffData && previewStuffData.getValue(1)) || null);
|
newValue.extraData = ((previewStuffData && previewStuffData.getValue(1)) || null);
|
||||||
newValue.previewStuffData = previewStuffData;
|
newValue.previewStuffData = previewStuffData;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}, [ currentOffer, previewStuffData, setPurchaseOptions ]);
|
}, [ currentOffer, previewStuffData, setPurchaseOptions ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AutoGrid columnCount={ columnCount } { ...rest }>
|
<AutoGrid columnCount={ columnCount } { ...rest }>
|
||||||
{ badgeCodes && (badgeCodes.length > 0) && badgeCodes.map((badgeCode, index) =>
|
{ badgeCodes && (badgeCodes.length > 0) && badgeCodes.map((badgeCode, index) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<LayoutGridItem key={ index } itemActive={ (currentBadgeCode === badgeCode) } onClick={ event => setCurrentBadgeCode(badgeCode) }>
|
<LayoutGridItem key={ index } itemActive={ (currentBadgeCode === badgeCode) } onClick={ event => setCurrentBadgeCode(badgeCode) }>
|
||||||
<LayoutBadgeImageView badgeCode={ badgeCode } />
|
<LayoutBadgeImageView badgeCode={ badgeCode } />
|
||||||
</LayoutGridItem>
|
</LayoutGridItem>
|
||||||
);
|
);
|
||||||
}) }
|
}) }
|
||||||
</AutoGrid>
|
</AutoGrid>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,15 @@ export const CatalogGuildSelectorWidgetView: FC<{}> = props =>
|
|||||||
if(!currentOffer) return;
|
if(!currentOffer) return;
|
||||||
|
|
||||||
setPurchaseOptions(prevValue =>
|
setPurchaseOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.extraParamRequired = true;
|
newValue.extraParamRequired = true;
|
||||||
newValue.extraData = ((previewStuffData && previewStuffData.getValue(1)) || null);
|
newValue.extraData = ((previewStuffData && previewStuffData.getValue(1)) || null);
|
||||||
newValue.previewStuffData = previewStuffData;
|
newValue.previewStuffData = previewStuffData;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}, [ currentOffer, previewStuffData, setPurchaseOptions ]);
|
}, [ currentOffer, previewStuffData, setPurchaseOptions ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
|
@ -28,13 +28,13 @@ export const CatalogItemGridWidgetView: FC<CatalogItemGridWidgetViewProps> = pro
|
|||||||
if(offer.product && (offer.product.productType === ProductTypeEnum.WALL))
|
if(offer.product && (offer.product.productType === ProductTypeEnum.WALL))
|
||||||
{
|
{
|
||||||
setPurchaseOptions(prevValue =>
|
setPurchaseOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.extraData = (offer.product.extraParam || null);
|
newValue.extraData = (offer.product.extraParam || null);
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,14 +73,14 @@ export const CatalogSpacesWidgetView: FC<CatalogSpacesWidgetViewProps> = props =
|
|||||||
if((selectedGroupIndex === -1) || !selectedOfferForGroup || !currentOffer) return;
|
if((selectedGroupIndex === -1) || !selectedOfferForGroup || !currentOffer) return;
|
||||||
|
|
||||||
setPurchaseOptions(prevValue =>
|
setPurchaseOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.extraData = selectedOfferForGroup[selectedGroupIndex].product.extraParam;
|
newValue.extraData = selectedOfferForGroup[selectedGroupIndex].product.extraParam;
|
||||||
newValue.extraParamRequired = true;
|
newValue.extraParamRequired = true;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}, [ currentOffer, selectedGroupIndex, selectedOfferForGroup, setPurchaseOptions ]);
|
}, [ currentOffer, selectedGroupIndex, selectedOfferForGroup, setPurchaseOptions ]);
|
||||||
|
|
||||||
if(!groupedOffers || (selectedGroupIndex === -1)) return null;
|
if(!groupedOffers || (selectedGroupIndex === -1)) return null;
|
||||||
@ -98,13 +98,13 @@ export const CatalogSpacesWidgetView: FC<CatalogSpacesWidgetViewProps> = props =
|
|||||||
const setSelectedOffer = () =>
|
const setSelectedOffer = () =>
|
||||||
{
|
{
|
||||||
setSelectedOfferForGroup(prevValue =>
|
setSelectedOfferForGroup(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = [ ...prevValue ];
|
const newValue = [ ...prevValue ];
|
||||||
|
|
||||||
newValue[selectedGroupIndex] = offer;
|
newValue[selectedGroupIndex] = offer;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return <CatalogGridOfferView key={ index } itemActive={ (currentOffer && (currentOffer === offer)) } offer={ offer } onClick={ setSelectedOffer } />;
|
return <CatalogGridOfferView key={ index } itemActive={ (currentOffer && (currentOffer === offer)) } offer={ offer } onClick={ setSelectedOffer } />;
|
||||||
|
@ -23,13 +23,13 @@ export const CatalogSpinnerWidgetView: FC<{}> = props =>
|
|||||||
if(value === quantity) return;
|
if(value === quantity) return;
|
||||||
|
|
||||||
setPurchaseOptions(prevValue =>
|
setPurchaseOptions(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.quantity = value;
|
newValue.quantity = value;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!currentOffer || !currentOffer.bundlePurchaseAllowed) return null;
|
if(!currentOffer || !currentOffer.bundlePurchaseAllowed) return null;
|
||||||
|
@ -15,7 +15,7 @@ export const ChatHistoryMessageHandler: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
const { chatHistoryState = null, roomHistoryState = null } = useChatHistoryContext();
|
const { chatHistoryState = null, roomHistoryState = null } = useChatHistoryContext();
|
||||||
|
|
||||||
const [needsRoomInsert, setNeedsRoomInsert ] = useState(false);
|
const [ needsRoomInsert, setNeedsRoomInsert ] = useState(false);
|
||||||
|
|
||||||
const addChatEntry = useCallback((entry: IChatEntry) =>
|
const addChatEntry = useCallback((entry: IChatEntry) =>
|
||||||
{
|
{
|
||||||
@ -32,7 +32,7 @@ export const ChatHistoryMessageHandler: FC<{}> = props =>
|
|||||||
|
|
||||||
//dispatchUiEvent(new ChatHistoryEvent(ChatHistoryEvent.CHAT_HISTORY_CHANGED));
|
//dispatchUiEvent(new ChatHistoryEvent(ChatHistoryEvent.CHAT_HISTORY_CHANGED));
|
||||||
|
|
||||||
}, [chatHistoryState]);
|
}, [ chatHistoryState ]);
|
||||||
|
|
||||||
const addRoomHistoryEntry = useCallback((entry: IRoomHistoryEntry) =>
|
const addRoomHistoryEntry = useCallback((entry: IRoomHistoryEntry) =>
|
||||||
{
|
{
|
||||||
@ -45,7 +45,7 @@ export const ChatHistoryMessageHandler: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
roomHistoryState.notify();
|
roomHistoryState.notify();
|
||||||
}, [roomHistoryState]);
|
}, [ roomHistoryState ]);
|
||||||
|
|
||||||
const onChatEvent = useCallback((event: RoomSessionChatEvent) =>
|
const onChatEvent = useCallback((event: RoomSessionChatEvent) =>
|
||||||
{
|
{
|
||||||
@ -62,7 +62,7 @@ export const ChatHistoryMessageHandler: FC<{}> = props =>
|
|||||||
const entry: IChatEntry = { id: -1, entityId: userData.webID, name: userData.name, look: userData.figure, entityType: userData.type, message: event.message, timestamp: timeString, type: ChatEntryType.TYPE_CHAT, roomId: roomSession.roomId };
|
const entry: IChatEntry = { id: -1, entityId: userData.webID, name: userData.name, look: userData.figure, entityType: userData.type, message: event.message, timestamp: timeString, type: ChatEntryType.TYPE_CHAT, roomId: roomSession.roomId };
|
||||||
|
|
||||||
addChatEntry(entry);
|
addChatEntry(entry);
|
||||||
}, [addChatEntry]);
|
}, [ addChatEntry ]);
|
||||||
|
|
||||||
UseRoomSessionManagerEvent(RoomSessionChatEvent.CHAT_EVENT, onChatEvent);
|
UseRoomSessionManagerEvent(RoomSessionChatEvent.CHAT_EVENT, onChatEvent);
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ export const ChatHistoryMessageHandler: FC<{}> = props =>
|
|||||||
setNeedsRoomInsert(true);
|
setNeedsRoomInsert(true);
|
||||||
break;
|
break;
|
||||||
case RoomSessionEvent.ENDED:
|
case RoomSessionEvent.ENDED:
|
||||||
//dispatchUiEvent(new ChatHistoryEvent(ChatHistoryEvent.HIDE_CHAT_HISTORY));
|
//dispatchUiEvent(new ChatHistoryEvent(ChatHistoryEvent.HIDE_CHAT_HISTORY));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
@ -104,7 +104,7 @@ export const ChatHistoryMessageHandler: FC<{}> = props =>
|
|||||||
|
|
||||||
setNeedsRoomInsert(false);
|
setNeedsRoomInsert(false);
|
||||||
}
|
}
|
||||||
}, [addChatEntry, addRoomHistoryEntry, needsRoomInsert]);
|
}, [ addChatEntry, addRoomHistoryEntry, needsRoomInsert ]);
|
||||||
|
|
||||||
UseMessageEventHook(GetGuestRoomResultEvent, onGetGuestRoomResultEvent);
|
UseMessageEventHook(GetGuestRoomResultEvent, onGetGuestRoomResultEvent);
|
||||||
|
|
||||||
|
@ -118,19 +118,19 @@ export const ChatHistoryView: FC<{}> = props =>
|
|||||||
<NitroCardContentView>
|
<NitroCardContentView>
|
||||||
<AutoSizer defaultWidth={ 300 } defaultHeight={ 200 } onResize={ onResize }>
|
<AutoSizer defaultWidth={ 300 } defaultHeight={ 200 } onResize={ onResize }>
|
||||||
{ ({ height, width }) =>
|
{ ({ height, width }) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<List
|
<List
|
||||||
ref={ elementRef }
|
ref={ elementRef }
|
||||||
width={ width }
|
width={ width }
|
||||||
height={ height }
|
height={ height }
|
||||||
rowCount={ chatHistoryState.chats.length }
|
rowCount={ chatHistoryState.chats.length }
|
||||||
rowHeight={ cache.rowHeight }
|
rowHeight={ cache.rowHeight }
|
||||||
className={ 'chat-history-list' }
|
className={ 'chat-history-list' }
|
||||||
rowRenderer={ RowRenderer }
|
rowRenderer={ RowRenderer }
|
||||||
deferredMeasurementCache={ cache } />
|
deferredMeasurementCache={ cache } />
|
||||||
)
|
)
|
||||||
} }
|
} }
|
||||||
</AutoSizer>
|
</AutoSizer>
|
||||||
</NitroCardContentView>
|
</NitroCardContentView>
|
||||||
</NitroCardView> }
|
</NitroCardView> }
|
||||||
|
@ -20,7 +20,7 @@ export const FloorplanEditorView: FC<{}> = props =>
|
|||||||
const [ originalFloorplanSettings, setOriginalFloorplanSettings ] = useState<IFloorplanSettings>({
|
const [ originalFloorplanSettings, setOriginalFloorplanSettings ] = useState<IFloorplanSettings>({
|
||||||
tilemap: '',
|
tilemap: '',
|
||||||
reservedTiles: [],
|
reservedTiles: [],
|
||||||
entryPoint: [0, 0],
|
entryPoint: [ 0, 0 ],
|
||||||
entryPointDir: 2,
|
entryPointDir: 2,
|
||||||
wallHeight: -1,
|
wallHeight: -1,
|
||||||
thicknessWall: 1,
|
thicknessWall: 1,
|
||||||
@ -65,23 +65,23 @@ export const FloorplanEditorView: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setOriginalFloorplanSettings(prevValue =>
|
setOriginalFloorplanSettings(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.tilemap = parser.model;
|
newValue.tilemap = parser.model;
|
||||||
newValue.wallHeight = (parser.wallHeight + 1);
|
newValue.wallHeight = (parser.wallHeight + 1);
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
setVisualizationSettings(prevValue =>
|
setVisualizationSettings(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.wallHeight = (parser.wallHeight + 1);
|
newValue.wallHeight = (parser.wallHeight + 1);
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
UseMessageEventHook(FloorHeightMapEvent, onFloorHeightMapEvent);
|
UseMessageEventHook(FloorHeightMapEvent, onFloorHeightMapEvent);
|
||||||
@ -91,24 +91,24 @@ export const FloorplanEditorView: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setOriginalFloorplanSettings(prevValue =>
|
setOriginalFloorplanSettings(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.thicknessFloor = convertSettingToNumber(parser.thicknessFloor);
|
newValue.thicknessFloor = convertSettingToNumber(parser.thicknessFloor);
|
||||||
newValue.thicknessWall = convertSettingToNumber(parser.thicknessWall);
|
newValue.thicknessWall = convertSettingToNumber(parser.thicknessWall);
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
setVisualizationSettings(prevValue =>
|
setVisualizationSettings(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.thicknessFloor = convertSettingToNumber(parser.thicknessFloor);
|
newValue.thicknessFloor = convertSettingToNumber(parser.thicknessFloor);
|
||||||
newValue.thicknessWall = convertSettingToNumber(parser.thicknessWall);
|
newValue.thicknessWall = convertSettingToNumber(parser.thicknessWall);
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
UseMessageEventHook(RoomVisualizationSettingsEvent, onRoomVisualizationSettingsEvent);
|
UseMessageEventHook(RoomVisualizationSettingsEvent, onRoomVisualizationSettingsEvent);
|
||||||
|
@ -151,7 +151,7 @@ export class FloorplanEditor extends PixiApplicationProxy
|
|||||||
{
|
{
|
||||||
if(this._isHolding)
|
if(this._isHolding)
|
||||||
{
|
{
|
||||||
const [realX, realY] = getTileFromScreenPosition(tileStartX, tileStartY);
|
const [ realX, realY ] = getTileFromScreenPosition(tileStartX, tileStartY);
|
||||||
|
|
||||||
if(isClick)
|
if(isClick)
|
||||||
{
|
{
|
||||||
@ -246,7 +246,7 @@ export class FloorplanEditor extends PixiApplicationProxy
|
|||||||
if(tile.isBlocked) assetName = FloorplanEditor.TILE_BLOCKED;
|
if(tile.isBlocked) assetName = FloorplanEditor.TILE_BLOCKED;
|
||||||
|
|
||||||
//if((tile.height === 'x') || tile.height === 'X') continue;
|
//if((tile.height === 'x') || tile.height === 'X') continue;
|
||||||
const [positionX, positionY] = getScreenPositionForTile(x, y);
|
const [ positionX, positionY ] = getScreenPositionForTile(x, y);
|
||||||
|
|
||||||
this._tilemapRenderer.tile(this._assetCollection.getTexture(`floor_editor_${ assetName }`), positionX, positionY);
|
this._tilemapRenderer.tile(this._assetCollection.getTexture(`floor_editor_${ assetName }`), positionX, positionY);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ export const getScreenPositionForTile = (x: number, y: number): [number , number
|
|||||||
|
|
||||||
positionX = positionX + 1024; // center the map in the canvas
|
positionX = positionX + 1024; // center the map in the canvas
|
||||||
|
|
||||||
return [positionX, positionY];
|
return [ positionX, positionY ];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getTileFromScreenPosition = (x: number, y: number): [number, number] =>
|
export const getTileFromScreenPosition = (x: number, y: number): [number, number] =>
|
||||||
@ -17,7 +17,7 @@ export const getTileFromScreenPosition = (x: number, y: number): [number, number
|
|||||||
const realX = ((translatedX /(TILE_SIZE / 2)) + (y / (TILE_SIZE / 4))) / 2;
|
const realX = ((translatedX /(TILE_SIZE / 2)) + (y / (TILE_SIZE / 4))) / 2;
|
||||||
const realY = ((y /(TILE_SIZE / 4)) - (translatedX / (TILE_SIZE / 2))) / 2;
|
const realY = ((y /(TILE_SIZE / 4)) - (translatedX / (TILE_SIZE / 2))) / 2;
|
||||||
|
|
||||||
return [realX, realY];
|
return [ realX, realY ];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const convertNumbersForSaving = (value: number): number =>
|
export const convertNumbersForSaving = (value: number): number =>
|
||||||
|
@ -28,15 +28,15 @@ export const FloorplanCanvasView: FC<FloorplanCanvasViewProps> = props =>
|
|||||||
let newFloorPlanSettings: IFloorplanSettings = null;
|
let newFloorPlanSettings: IFloorplanSettings = null;
|
||||||
|
|
||||||
setOriginalFloorplanSettings(prevValue =>
|
setOriginalFloorplanSettings(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.reservedTiles = parser.blockedTilesMap;
|
newValue.reservedTiles = parser.blockedTilesMap;
|
||||||
|
|
||||||
newFloorPlanSettings = newValue;
|
newFloorPlanSettings = newValue;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
FloorplanEditor.instance.setTilemap(newFloorPlanSettings.tilemap, parser.blockedTilesMap);
|
FloorplanEditor.instance.setTilemap(newFloorPlanSettings.tilemap, parser.blockedTilesMap);
|
||||||
|
|
||||||
@ -52,23 +52,23 @@ export const FloorplanCanvasView: FC<FloorplanCanvasViewProps> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setOriginalFloorplanSettings(prevValue =>
|
setOriginalFloorplanSettings(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.entryPoint = [ parser.x, parser.y ];
|
newValue.entryPoint = [ parser.x, parser.y ];
|
||||||
newValue.entryPointDir = parser.direction;
|
newValue.entryPointDir = parser.direction;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
setVisualizationSettings(prevValue =>
|
setVisualizationSettings(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.entryPointDir = parser.direction;
|
newValue.entryPointDir = parser.direction;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
FloorplanEditor.instance.doorLocation = new NitroPoint(parser.x, parser.y);
|
FloorplanEditor.instance.doorLocation = new NitroPoint(parser.x, parser.y);
|
||||||
|
|
||||||
@ -107,14 +107,14 @@ export const FloorplanCanvasView: FC<FloorplanCanvasViewProps> = props =>
|
|||||||
FloorplanEditor.instance.clear();
|
FloorplanEditor.instance.clear();
|
||||||
|
|
||||||
setVisualizationSettings(prevValue =>
|
setVisualizationSettings(prevValue =>
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
wallHeight: originalFloorplanSettings.wallHeight,
|
wallHeight: originalFloorplanSettings.wallHeight,
|
||||||
thicknessWall: originalFloorplanSettings.thicknessWall,
|
thicknessWall: originalFloorplanSettings.thicknessWall,
|
||||||
thicknessFloor: originalFloorplanSettings.thicknessFloor,
|
thicknessFloor: originalFloorplanSettings.thicknessFloor,
|
||||||
entryPointDir: prevValue.entryPointDir
|
entryPointDir: prevValue.entryPointDir
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [ originalFloorplanSettings.thicknessFloor, originalFloorplanSettings.thicknessWall, originalFloorplanSettings.wallHeight, setVisualizationSettings ]);
|
}, [ originalFloorplanSettings.thicknessFloor, originalFloorplanSettings.thicknessWall, originalFloorplanSettings.wallHeight, setVisualizationSettings ]);
|
||||||
|
|
||||||
|
@ -29,20 +29,20 @@ export const FloorplanOptionsView: FC<{}> = props =>
|
|||||||
const changeDoorDirection = () =>
|
const changeDoorDirection = () =>
|
||||||
{
|
{
|
||||||
setVisualizationSettings(prevValue =>
|
setVisualizationSettings(prevValue =>
|
||||||
|
{
|
||||||
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
|
if(newValue.entryPointDir < 7)
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
++newValue.entryPointDir;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newValue.entryPointDir = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(newValue.entryPointDir < 7)
|
return newValue;
|
||||||
{
|
});
|
||||||
++newValue.entryPointDir;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newValue.entryPointDir = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return newValue;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const onFloorHeightChange = (value: number) =>
|
const onFloorHeightChange = (value: number) =>
|
||||||
@ -71,13 +71,13 @@ export const FloorplanOptionsView: FC<{}> = props =>
|
|||||||
const onWallThicknessChange = (value: number) =>
|
const onWallThicknessChange = (value: number) =>
|
||||||
{
|
{
|
||||||
setVisualizationSettings(prevValue =>
|
setVisualizationSettings(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.thicknessWall = value;
|
newValue.thicknessWall = value;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const onWallHeightChange = (value: number) =>
|
const onWallHeightChange = (value: number) =>
|
||||||
@ -87,13 +87,13 @@ export const FloorplanOptionsView: FC<{}> = props =>
|
|||||||
if(value > MAX_WALL_HEIGHT) value = MAX_WALL_HEIGHT;
|
if(value > MAX_WALL_HEIGHT) value = MAX_WALL_HEIGHT;
|
||||||
|
|
||||||
setVisualizationSettings(prevValue =>
|
setVisualizationSettings(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.wallHeight = value;
|
newValue.wallHeight = value;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const increaseWallHeight = () =>
|
const increaseWallHeight = () =>
|
||||||
|
@ -53,13 +53,13 @@ export const FriendsView: FC<{}> = props =>
|
|||||||
if(!canRequestFriend(userId)) return false;
|
if(!canRequestFriend(userId)) return false;
|
||||||
|
|
||||||
setSentRequests(prevValue =>
|
setSentRequests(prevValue =>
|
||||||
{
|
{
|
||||||
const newSentRequests = [ ...prevValue ];
|
const newSentRequests = [ ...prevValue ];
|
||||||
|
|
||||||
newSentRequests.push(userId);
|
newSentRequests.push(userId);
|
||||||
|
|
||||||
return newSentRequests;
|
return newSentRequests;
|
||||||
});
|
});
|
||||||
|
|
||||||
SendMessageComposer(new RequestFriendComposer(userName));
|
SendMessageComposer(new RequestFriendComposer(userName));
|
||||||
}, [ sentRequests, canRequestFriend ]);
|
}, [ sentRequests, canRequestFriend ]);
|
||||||
@ -67,6 +67,37 @@ export const FriendsView: FC<{}> = props =>
|
|||||||
const acceptFriend = useCallback((userId: number) =>
|
const acceptFriend = useCallback((userId: number) =>
|
||||||
{
|
{
|
||||||
setRequests(prevValue =>
|
setRequests(prevValue =>
|
||||||
|
{
|
||||||
|
const newRequests: MessengerRequest[] = [ ...prevValue ];
|
||||||
|
|
||||||
|
const index = newRequests.findIndex(request => (request.requesterUserId === userId));
|
||||||
|
|
||||||
|
if(index >= 0)
|
||||||
|
{
|
||||||
|
SendMessageComposer(new AcceptFriendMessageComposer(newRequests[index].id));
|
||||||
|
|
||||||
|
DispatchUiEvent(new FriendRequestEvent(FriendRequestEvent.ACCEPTED, userId));
|
||||||
|
|
||||||
|
newRequests.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newRequests;
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const declineFriend = useCallback((userId: number, declineAll: boolean = false) =>
|
||||||
|
{
|
||||||
|
setRequests(prevValue =>
|
||||||
|
{
|
||||||
|
if(declineAll)
|
||||||
|
{
|
||||||
|
SendMessageComposer(new DeclineFriendMessageComposer(true));
|
||||||
|
|
||||||
|
for(const request of prevValue) DispatchUiEvent(new FriendRequestEvent(FriendRequestEvent.DECLINED, request.requesterUserId));
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const newRequests: MessengerRequest[] = [ ...prevValue ];
|
const newRequests: MessengerRequest[] = [ ...prevValue ];
|
||||||
|
|
||||||
@ -74,47 +105,16 @@ export const FriendsView: FC<{}> = props =>
|
|||||||
|
|
||||||
if(index >= 0)
|
if(index >= 0)
|
||||||
{
|
{
|
||||||
SendMessageComposer(new AcceptFriendMessageComposer(newRequests[index].id));
|
SendMessageComposer(new DeclineFriendMessageComposer(false, newRequests[index].id));
|
||||||
|
|
||||||
DispatchUiEvent(new FriendRequestEvent(FriendRequestEvent.ACCEPTED, userId));
|
DispatchUiEvent(new FriendRequestEvent(FriendRequestEvent.DECLINED, userId));
|
||||||
|
|
||||||
newRequests.splice(index, 1);
|
newRequests.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return newRequests;
|
return newRequests;
|
||||||
});
|
}
|
||||||
}, []);
|
});
|
||||||
|
|
||||||
const declineFriend = useCallback((userId: number, declineAll: boolean = false) =>
|
|
||||||
{
|
|
||||||
setRequests(prevValue =>
|
|
||||||
{
|
|
||||||
if(declineAll)
|
|
||||||
{
|
|
||||||
SendMessageComposer(new DeclineFriendMessageComposer(true));
|
|
||||||
|
|
||||||
for(const request of prevValue) DispatchUiEvent(new FriendRequestEvent(FriendRequestEvent.DECLINED, request.requesterUserId));
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const newRequests: MessengerRequest[] = [ ...prevValue ];
|
|
||||||
|
|
||||||
const index = newRequests.findIndex(request => (request.requesterUserId === userId));
|
|
||||||
|
|
||||||
if(index >= 0)
|
|
||||||
{
|
|
||||||
SendMessageComposer(new DeclineFriendMessageComposer(false, newRequests[index].id));
|
|
||||||
|
|
||||||
DispatchUiEvent(new FriendRequestEvent(FriendRequestEvent.DECLINED, userId));
|
|
||||||
|
|
||||||
newRequests.splice(index, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newRequests;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onMessengerInitEvent = useCallback((event: MessengerInitEvent) =>
|
const onMessengerInitEvent = useCallback((event: MessengerInitEvent) =>
|
||||||
@ -137,22 +137,22 @@ export const FriendsView: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setFriends(prevValue =>
|
setFriends(prevValue =>
|
||||||
|
{
|
||||||
|
const newFriends = [ ...prevValue ];
|
||||||
|
|
||||||
|
for(const friend of parser.fragment)
|
||||||
{
|
{
|
||||||
const newFriends = [ ...prevValue ];
|
const index = newFriends.findIndex(existingFriend => (existingFriend.id === friend.id));
|
||||||
|
const newFriend = new MessengerFriend();
|
||||||
|
|
||||||
for(const friend of parser.fragment)
|
newFriend.populate(friend);
|
||||||
{
|
|
||||||
const index = newFriends.findIndex(existingFriend => (existingFriend.id === friend.id));
|
|
||||||
const newFriend = new MessengerFriend();
|
|
||||||
|
|
||||||
newFriend.populate(friend);
|
if(index > -1) newFriends[index] = newFriend;
|
||||||
|
else newFriends.push(newFriend);
|
||||||
|
}
|
||||||
|
|
||||||
if(index > -1) newFriends[index] = newFriend;
|
return newFriends;
|
||||||
else newFriends.push(newFriend);
|
});
|
||||||
}
|
|
||||||
|
|
||||||
return newFriends;
|
|
||||||
});
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
UseMessageEventHook(FriendListFragmentEvent, onFriendsFragmentEvent);
|
UseMessageEventHook(FriendListFragmentEvent, onFriendsFragmentEvent);
|
||||||
@ -162,39 +162,39 @@ export const FriendsView: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setFriends(prevValue =>
|
setFriends(prevValue =>
|
||||||
|
{
|
||||||
|
const newFriends = [ ...prevValue ];
|
||||||
|
|
||||||
|
const processUpdate = (friend: FriendParser) =>
|
||||||
{
|
{
|
||||||
const newFriends = [ ...prevValue ];
|
const index = newFriends.findIndex(existingFriend => (existingFriend.id === friend.id));
|
||||||
|
|
||||||
const processUpdate = (friend: FriendParser) =>
|
if(index === -1)
|
||||||
{
|
{
|
||||||
const index = newFriends.findIndex(existingFriend => (existingFriend.id === friend.id));
|
const newFriend = new MessengerFriend();
|
||||||
|
newFriend.populate(friend);
|
||||||
|
|
||||||
if(index === -1)
|
newFriends.unshift(newFriend);
|
||||||
{
|
|
||||||
const newFriend = new MessengerFriend();
|
|
||||||
newFriend.populate(friend);
|
|
||||||
|
|
||||||
newFriends.unshift(newFriend);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newFriends[index].populate(friend);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
for(const friend of parser.addedFriends) processUpdate(friend);
|
|
||||||
|
|
||||||
for(const friend of parser.updatedFriends) processUpdate(friend);
|
|
||||||
|
|
||||||
for(const removedFriendId of parser.removedFriendIds)
|
|
||||||
{
|
{
|
||||||
const index = newFriends.findIndex(existingFriend => (existingFriend.id === removedFriendId));
|
newFriends[index].populate(friend);
|
||||||
|
|
||||||
if(index > -1) newFriends.splice(index);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return newFriends;
|
for(const friend of parser.addedFriends) processUpdate(friend);
|
||||||
});
|
|
||||||
|
for(const friend of parser.updatedFriends) processUpdate(friend);
|
||||||
|
|
||||||
|
for(const removedFriendId of parser.removedFriendIds)
|
||||||
|
{
|
||||||
|
const index = newFriends.findIndex(existingFriend => (existingFriend.id === removedFriendId));
|
||||||
|
|
||||||
|
if(index > -1) newFriends.splice(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newFriends;
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
UseMessageEventHook(FriendListUpdateEvent, onFriendsUpdateEvent);
|
UseMessageEventHook(FriendListUpdateEvent, onFriendsUpdateEvent);
|
||||||
@ -204,23 +204,23 @@ export const FriendsView: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
setRequests(prevValue =>
|
setRequests(prevValue =>
|
||||||
|
{
|
||||||
|
const newRequests = [ ...prevValue ];
|
||||||
|
|
||||||
|
for(const request of parser.requests)
|
||||||
{
|
{
|
||||||
const newRequests = [ ...prevValue ];
|
const index = newRequests.findIndex(existing => (existing.requesterUserId === request.requesterUserId));
|
||||||
|
|
||||||
for(const request of parser.requests)
|
if(index > 0) continue;
|
||||||
{
|
|
||||||
const index = newRequests.findIndex(existing => (existing.requesterUserId === request.requesterUserId));
|
|
||||||
|
|
||||||
if(index > 0) continue;
|
const newRequest = new MessengerRequest();
|
||||||
|
newRequest.populate(request);
|
||||||
|
|
||||||
const newRequest = new MessengerRequest();
|
newRequests.push(newRequest);
|
||||||
newRequest.populate(request);
|
}
|
||||||
|
|
||||||
newRequests.push(newRequest);
|
return newRequests;
|
||||||
}
|
});
|
||||||
|
|
||||||
return newRequests;
|
|
||||||
});
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
UseMessageEventHook(FriendRequestsEvent, onFriendRequestsEvent);
|
UseMessageEventHook(FriendRequestsEvent, onFriendRequestsEvent);
|
||||||
@ -231,21 +231,21 @@ export const FriendsView: FC<{}> = props =>
|
|||||||
const request = parser.request;
|
const request = parser.request;
|
||||||
|
|
||||||
setRequests(prevValue =>
|
setRequests(prevValue =>
|
||||||
|
{
|
||||||
|
const newRequests = [ ...prevValue ];
|
||||||
|
|
||||||
|
const index = newRequests.findIndex(existing => (existing.requesterUserId === request.requesterUserId));
|
||||||
|
|
||||||
|
if(index === -1)
|
||||||
{
|
{
|
||||||
const newRequests = [ ...prevValue ];
|
const newRequest = new MessengerRequest();
|
||||||
|
newRequest.populate(request);
|
||||||
|
|
||||||
const index = newRequests.findIndex(existing => (existing.requesterUserId === request.requesterUserId));
|
newRequests.push(newRequest);
|
||||||
|
}
|
||||||
|
|
||||||
if(index === -1)
|
return newRequests;
|
||||||
{
|
});
|
||||||
const newRequest = new MessengerRequest();
|
|
||||||
newRequest.populate(request);
|
|
||||||
|
|
||||||
newRequests.push(newRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newRequests;
|
|
||||||
});
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
UseMessageEventHook(NewFriendRequestEvent, onNewFriendRequestEvent);
|
UseMessageEventHook(NewFriendRequestEvent, onNewFriendRequestEvent);
|
||||||
|
@ -6,5 +6,6 @@ export class MessengerSettings
|
|||||||
public userFriendLimit: number = 0,
|
public userFriendLimit: number = 0,
|
||||||
public normalFriendLimit: number = 0,
|
public normalFriendLimit: number = 0,
|
||||||
public extendedFriendLimit: number = 0,
|
public extendedFriendLimit: number = 0,
|
||||||
public categories: FriendCategoryData[] = []) {}
|
public categories: FriendCategoryData[] = [])
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,9 @@ export const FriendBarView: FC<FriendBarViewProps> = props =>
|
|||||||
<FontAwesomeIcon icon="chevron-left" />
|
<FontAwesomeIcon icon="chevron-left" />
|
||||||
</Button>
|
</Button>
|
||||||
{ Array.from(Array(maxDisplayCount), (e, i) =>
|
{ Array.from(Array(maxDisplayCount), (e, i) =>
|
||||||
{
|
{
|
||||||
return <FriendBarItemView key={ i } friend={ (onlineFriends[ indexOffset + i ] || null) } />;
|
return <FriendBarItemView key={ i } friend={ (onlineFriends[ indexOffset + i ] || null) } />;
|
||||||
}) }
|
}) }
|
||||||
<Button variant="black" className="friend-bar-button" disabled={ !canIncreaseIndex } onClick={ event => setIndexOffset(indexOffset + 1) }>
|
<Button variant="black" className="friend-bar-button" disabled={ !canIncreaseIndex } onClick={ event => setIndexOffset(indexOffset + 1) }>
|
||||||
<FontAwesomeIcon icon="chevron-right" />
|
<FontAwesomeIcon icon="chevron-right" />
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -43,29 +43,29 @@ export const FriendsListView: FC<FriendsListViewProps> = props =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return LocalizeText('friendlist.removefriendconfirm.userlist', [ 'user_names' ], [ userNames.join(', ') ]);
|
return LocalizeText('friendlist.removefriendconfirm.userlist', [ 'user_names' ], [ userNames.join(', ') ]);
|
||||||
}, [offlineFriends, onlineFriends, selectedFriendsIds]);
|
}, [ offlineFriends, onlineFriends, selectedFriendsIds ]);
|
||||||
|
|
||||||
const selectFriend = useCallback((userId: number) =>
|
const selectFriend = useCallback((userId: number) =>
|
||||||
{
|
{
|
||||||
if(userId < 0) return;
|
if(userId < 0) return;
|
||||||
|
|
||||||
setSelectedFriendsIds(prevValue =>
|
setSelectedFriendsIds(prevValue =>
|
||||||
|
{
|
||||||
|
const newValue = [ ...prevValue ];
|
||||||
|
|
||||||
|
const existingUserIdIndex: number = newValue.indexOf(userId);
|
||||||
|
|
||||||
|
if(existingUserIdIndex > -1)
|
||||||
{
|
{
|
||||||
const newValue = [ ...prevValue ];
|
newValue.splice(existingUserIdIndex, 1)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newValue.push(userId);
|
||||||
|
}
|
||||||
|
|
||||||
const existingUserIdIndex: number = newValue.indexOf(userId);
|
return newValue;
|
||||||
|
});
|
||||||
if(existingUserIdIndex > -1)
|
|
||||||
{
|
|
||||||
newValue.splice(existingUserIdIndex, 1)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newValue.push(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newValue;
|
|
||||||
});
|
|
||||||
}, [ setSelectedFriendsIds ]);
|
}, [ setSelectedFriendsIds ]);
|
||||||
|
|
||||||
const sendRoomInvite = (message: string) =>
|
const sendRoomInvite = (message: string) =>
|
||||||
@ -81,11 +81,11 @@ export const FriendsListView: FC<FriendsListViewProps> = props =>
|
|||||||
if(selectedFriendsIds.length === 0) return;
|
if(selectedFriendsIds.length === 0) return;
|
||||||
|
|
||||||
setSelectedFriendsIds(prevValue =>
|
setSelectedFriendsIds(prevValue =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new RemoveFriendComposer(...prevValue));
|
SendMessageComposer(new RemoveFriendComposer(...prevValue));
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
|
|
||||||
setShowRemoveFriendsConfirmation(false);
|
setShowRemoveFriendsConfirmation(false);
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ export const FriendsRemoveConfirmationView: FC<FriendsRemoveConfirmationViewProp
|
|||||||
<NitroCardView className="nitro-friends-remove-confirmation" theme="primary-slim">
|
<NitroCardView className="nitro-friends-remove-confirmation" theme="primary-slim">
|
||||||
<NitroCardHeaderView headerText={ LocalizeText('friendlist.removefriendconfirm.title') } onCloseClick={ onCloseClick } />
|
<NitroCardHeaderView headerText={ LocalizeText('friendlist.removefriendconfirm.title') } onCloseClick={ onCloseClick } />
|
||||||
<NitroCardContentView className="text-black">
|
<NitroCardContentView className="text-black">
|
||||||
<div>{ removeFriendsText }</div>
|
<div>{ removeFriendsText }</div>
|
||||||
<Flex gap={ 1 }>
|
<Flex gap={ 1 }>
|
||||||
<Button fullWidth variant="danger" disabled={ (selectedFriendsIds.length === 0) } onClick={ removeSelectedFriends }>{ LocalizeText('generic.ok') }</Button>
|
<Button fullWidth variant="danger" disabled={ (selectedFriendsIds.length === 0) } onClick={ removeSelectedFriends }>{ LocalizeText('generic.ok') }</Button>
|
||||||
<Button fullWidth onClick={ onCloseClick }>{ LocalizeText('generic.cancel') }</Button>
|
<Button fullWidth onClick={ onCloseClick }>{ LocalizeText('generic.cancel') }</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -59,20 +59,20 @@ export const FriendsSearchView: FC<FriendsSearchViewProps> = props =>
|
|||||||
<hr className="mx-2 mt-0 mb-1 text-black" />
|
<hr className="mx-2 mt-0 mb-1 text-black" />
|
||||||
<Column gap={ 0 }>
|
<Column gap={ 0 }>
|
||||||
{ friendResults.map(result =>
|
{ friendResults.map(result =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<NitroCardAccordionItemView key={ result.avatarId } justifyContent="between" className="px-2 py-1">
|
<NitroCardAccordionItemView key={ result.avatarId } justifyContent="between" className="px-2 py-1">
|
||||||
<Flex alignItems="center" gap={ 1 }>
|
<Flex alignItems="center" gap={ 1 }>
|
||||||
<UserProfileIconView userId={ result.avatarId } />
|
<UserProfileIconView userId={ result.avatarId } />
|
||||||
<div>{ result.avatarName }</div>
|
<div>{ result.avatarName }</div>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex alignItems="center" gap={ 1 }>
|
<Flex alignItems="center" gap={ 1 }>
|
||||||
{ result.isAvatarOnline &&
|
{ result.isAvatarOnline &&
|
||||||
<Base className="nitro-friends-spritesheet icon-chat cursor-pointer" onClick={ event => OpenMessengerChat(result.avatarId) } title={ LocalizeText('friendlist.tip.im') } /> }
|
<Base className="nitro-friends-spritesheet icon-chat cursor-pointer" onClick={ event => OpenMessengerChat(result.avatarId) } title={ LocalizeText('friendlist.tip.im') } /> }
|
||||||
</Flex>
|
</Flex>
|
||||||
</NitroCardAccordionItemView>
|
</NitroCardAccordionItemView>
|
||||||
)
|
)
|
||||||
}) }
|
}) }
|
||||||
</Column>
|
</Column>
|
||||||
</Column> }
|
</Column> }
|
||||||
</> }
|
</> }
|
||||||
@ -86,20 +86,20 @@ export const FriendsSearchView: FC<FriendsSearchViewProps> = props =>
|
|||||||
<hr className="mx-2 mt-0 mb-1 text-black" />
|
<hr className="mx-2 mt-0 mb-1 text-black" />
|
||||||
<Column gap={ 0 }>
|
<Column gap={ 0 }>
|
||||||
{ otherResults.map(result =>
|
{ otherResults.map(result =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<NitroCardAccordionItemView key={ result.avatarId } justifyContent="between" className="px-2 py-1">
|
<NitroCardAccordionItemView key={ result.avatarId } justifyContent="between" className="px-2 py-1">
|
||||||
<Flex alignItems="center" gap={ 1 }>
|
<Flex alignItems="center" gap={ 1 }>
|
||||||
<UserProfileIconView userId={ result.avatarId } />
|
<UserProfileIconView userId={ result.avatarId } />
|
||||||
<div>{ result.avatarName }</div>
|
<div>{ result.avatarName }</div>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex alignItems="center" gap={ 1 }>
|
<Flex alignItems="center" gap={ 1 }>
|
||||||
{ canRequestFriend(result.avatarId) &&
|
{ canRequestFriend(result.avatarId) &&
|
||||||
<Base className="nitro-friends-spritesheet icon-add cursor-pointer" onClick={ event => requestFriend(result.avatarId, result.avatarName) } title={ LocalizeText('friendlist.tip.addfriend') } /> }
|
<Base className="nitro-friends-spritesheet icon-add cursor-pointer" onClick={ event => requestFriend(result.avatarId, result.avatarName) } title={ LocalizeText('friendlist.tip.addfriend') } /> }
|
||||||
</Flex>
|
</Flex>
|
||||||
</NitroCardAccordionItemView>
|
</NitroCardAccordionItemView>
|
||||||
)
|
)
|
||||||
}) }
|
}) }
|
||||||
</Column>
|
</Column>
|
||||||
</Column> }
|
</Column> }
|
||||||
</> }
|
</> }
|
||||||
|
@ -26,47 +26,47 @@ export const FriendsMessengerThreadGroup: FC<FriendsMessengerThreadGroupProps> =
|
|||||||
if( (group.type === GroupType.GROUP_CHAT) && (group.chats.length && getGroupChatData(group.chats[0].extraData).userId === GetSessionDataManager().userId)) return true;
|
if( (group.type === GroupType.GROUP_CHAT) && (group.chats.length && getGroupChatData(group.chats[0].extraData).userId === GetSessionDataManager().userId)) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}, [group, thread]);
|
}, [ group, thread ]);
|
||||||
|
|
||||||
if(!thread || !group) return null;
|
if(!thread || !group) return null;
|
||||||
|
|
||||||
if(!group.userId)
|
if(!group.userId)
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{ group.chats.map((chat, index) =>
|
{ group.chats.map((chat, index) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<div className="d-flex gap-2 w-100 justify-content-start">
|
<div key={ index } className="d-flex gap-2 w-100 justify-content-start">
|
||||||
<Base key={ index } className="w-100 text-break">
|
<Base className="w-100 text-break">
|
||||||
{ chat.type === MessengerThreadChat.SECURITY_NOTIFICATION &&
|
{ chat.type === MessengerThreadChat.SECURITY_NOTIFICATION &&
|
||||||
<Base className="bg-light rounded mb-2 d-flex gap-2 px-2 py-1 small text-muted align-items-center">
|
<Base className="bg-light rounded mb-2 d-flex gap-2 px-2 py-1 small text-muted align-items-center">
|
||||||
<Base className="nitro-friends-spritesheet icon-warning flex-shrink-0" />
|
<Base className="nitro-friends-spritesheet icon-warning flex-shrink-0" />
|
||||||
<Base>{ chat.message }</Base>
|
<Base>{ chat.message }</Base>
|
||||||
</Base> }
|
</Base> }
|
||||||
{ chat.type === MessengerThreadChat.ROOM_INVITE &&
|
{ chat.type === MessengerThreadChat.ROOM_INVITE &&
|
||||||
<Base className="bg-light rounded mb-2 d-flex gap-2 px-2 py-1 small text-black align-items-center">
|
<Base className="bg-light rounded mb-2 d-flex gap-2 px-2 py-1 small text-black align-items-center">
|
||||||
<Base className="messenger-notification-icon flex-shrink-0" />
|
<Base className="messenger-notification-icon flex-shrink-0" />
|
||||||
<Base>{(LocalizeText('messenger.invitation') + ' ') }{ chat.message }</Base>
|
<Base>{(LocalizeText('messenger.invitation') + ' ') }{ chat.message }</Base>
|
||||||
</Base> }
|
</Base> }
|
||||||
</Base>
|
</Base>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}) }
|
}) }
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex className={ 'w-100 justify-content-' + (isOwnChat ? 'end' : 'start') } gap={ 2 }>
|
<Flex className={ 'w-100 justify-content-' + (isOwnChat ? 'end' : 'start') } gap={ 2 }>
|
||||||
<Base className="message-avatar flex-shrink-0">
|
<Base className="message-avatar flex-shrink-0">
|
||||||
{ (group.type === GroupType.PRIVATE_CHAT && !isOwnChat) &&
|
{ (group.type === GroupType.PRIVATE_CHAT && !isOwnChat) &&
|
||||||
<LayoutAvatarImageView figure={ thread.participant.figure } direction={ 2 } />
|
<LayoutAvatarImageView figure={ thread.participant.figure } direction={ 2 } />
|
||||||
}
|
}
|
||||||
{ (group.type === GroupType.GROUP_CHAT && !isOwnChat) &&
|
{ (group.type === GroupType.GROUP_CHAT && !isOwnChat) &&
|
||||||
<LayoutAvatarImageView figure={ getGroupChatData(group.chats[0].extraData).figure } direction={ 2} />
|
<LayoutAvatarImageView figure={ getGroupChatData(group.chats[0].extraData).figure } direction={ 2} />
|
||||||
}
|
}
|
||||||
</Base>
|
</Base>
|
||||||
<Base className={ 'bg-light text-black border-radius mb-2 rounded py-1 px-2 messages-group-' + (isOwnChat ? 'right' : 'left') }>
|
<Base className={ 'bg-light text-black border-radius mb-2 rounded py-1 px-2 messages-group-' + (isOwnChat ? 'right' : 'left') }>
|
||||||
<Base className='fw-bold'>
|
<Base className='fw-bold'>
|
||||||
{ (isOwnChat) && GetSessionDataManager().userName }
|
{ (isOwnChat) && GetSessionDataManager().userName }
|
||||||
|
@ -14,9 +14,9 @@ export const FriendsMessengerThreadView: FC<FriendsMessengerThreadViewProps> = p
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{ (thread.groups.length > 0) && thread.groups.map((group, index) =>
|
{ (thread.groups.length > 0) && thread.groups.map((group, index) =>
|
||||||
{
|
{
|
||||||
return <FriendsMessengerThreadGroup key={ index } thread={ thread } group={ group } />;
|
return <FriendsMessengerThreadGroup key={ index } thread={ thread } group={ group } />;
|
||||||
}) }
|
}) }
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -12,29 +12,29 @@ import { FriendsMessengerThreadView } from './FriendsMessengerThreadView';
|
|||||||
|
|
||||||
export const FriendsMessengerView: FC<{}> = props =>
|
export const FriendsMessengerView: FC<{}> = props =>
|
||||||
{
|
{
|
||||||
const [isVisible, setIsVisible] = useState(false);
|
const [ isVisible, setIsVisible ] = useState(false);
|
||||||
const [messageThreads, setMessageThreads] = useState<MessengerThread[]>([]);
|
const [ messageThreads, setMessageThreads ] = useState<MessengerThread[]>([]);
|
||||||
const [activeThreadIndex, setActiveThreadIndex] = useState(-1);
|
const [ activeThreadIndex, setActiveThreadIndex ] = useState(-1);
|
||||||
const [hiddenThreadIndexes, setHiddenThreadIndexes] = useState<number[]>([]);
|
const [ hiddenThreadIndexes, setHiddenThreadIndexes ] = useState<number[]>([]);
|
||||||
const [messageText, setMessageText] = useState('');
|
const [ messageText, setMessageText ] = useState('');
|
||||||
const [updateValue, setUpdateValue] = useState({});
|
const [ updateValue, setUpdateValue ] = useState({});
|
||||||
const { friends = [] } = useFriendsContext();
|
const { friends = [] } = useFriendsContext();
|
||||||
const messagesBox = useRef<HTMLDivElement>();
|
const messagesBox = useRef<HTMLDivElement>();
|
||||||
|
|
||||||
const followFriend = useCallback(() =>
|
const followFriend = useCallback(() =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new FollowFriendMessageComposer(messageThreads[activeThreadIndex].participant.id));
|
SendMessageComposer(new FollowFriendMessageComposer(messageThreads[activeThreadIndex].participant.id));
|
||||||
}, [messageThreads, activeThreadIndex]);
|
}, [ messageThreads, activeThreadIndex ]);
|
||||||
|
|
||||||
const openProfile = useCallback(() =>
|
const openProfile = useCallback(() =>
|
||||||
{
|
{
|
||||||
GetUserProfile(messageThreads[activeThreadIndex].participant.id);
|
GetUserProfile(messageThreads[activeThreadIndex].participant.id);
|
||||||
}, [messageThreads, activeThreadIndex]);
|
}, [ messageThreads, activeThreadIndex ]);
|
||||||
|
|
||||||
const getFriend = useCallback((userId: number) =>
|
const getFriend = useCallback((userId: number) =>
|
||||||
{
|
{
|
||||||
return ((friends.find(friend => (friend.id === userId))) || null);
|
return ((friends.find(friend => (friend.id === userId))) || null);
|
||||||
}, [friends]);
|
}, [ friends ]);
|
||||||
|
|
||||||
const visibleThreads = useMemo(() =>
|
const visibleThreads = useMemo(() =>
|
||||||
{
|
{
|
||||||
@ -44,7 +44,7 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}, [messageThreads, hiddenThreadIndexes]);
|
}, [ messageThreads, hiddenThreadIndexes ]);
|
||||||
|
|
||||||
const getMessageThreadWithIndex = useCallback<(userId: number) => [number, MessengerThread]>((userId: number) =>
|
const getMessageThreadWithIndex = useCallback<(userId: number) => [number, MessengerThread]>((userId: number) =>
|
||||||
{
|
{
|
||||||
@ -62,7 +62,7 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
setHiddenThreadIndexes(prevValue =>
|
setHiddenThreadIndexes(prevValue =>
|
||||||
{
|
{
|
||||||
const newIndexes = [...prevValue];
|
const newIndexes = [ ...prevValue ];
|
||||||
|
|
||||||
newIndexes.splice(hiddenIndex, 1);
|
newIndexes.splice(hiddenIndex, 1);
|
||||||
|
|
||||||
@ -70,34 +70,34 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return [i, thread];
|
return [ i, thread ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const friend = getFriend(userId);
|
const friend = getFriend(userId);
|
||||||
|
|
||||||
if(!friend) return [-1, null];
|
if(!friend) return [ -1, null ];
|
||||||
|
|
||||||
const thread = new MessengerThread(friend);
|
const thread = new MessengerThread(friend);
|
||||||
const newThreads = [...messageThreads, thread];
|
const newThreads = [ ...messageThreads, thread ];
|
||||||
|
|
||||||
setMessageThreads(newThreads);
|
setMessageThreads(newThreads);
|
||||||
|
|
||||||
return [(newThreads.length - 1), thread];
|
return [ (newThreads.length - 1), thread ];
|
||||||
}, [messageThreads, hiddenThreadIndexes, getFriend]);
|
}, [ messageThreads, hiddenThreadIndexes, getFriend ]);
|
||||||
|
|
||||||
const onNewConsoleMessageEvent = useCallback((event: NewConsoleMessageEvent) =>
|
const onNewConsoleMessageEvent = useCallback((event: NewConsoleMessageEvent) =>
|
||||||
{
|
{
|
||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
const [threadIndex, thread] = getMessageThreadWithIndex(parser.senderId);
|
const [ threadIndex, thread ] = getMessageThreadWithIndex(parser.senderId);
|
||||||
|
|
||||||
if((threadIndex === -1) || !thread) return;
|
if((threadIndex === -1) || !thread) return;
|
||||||
|
|
||||||
thread.addMessage(parser.senderId, parser.messageText, parser.secondsSinceSent, parser.extraData);
|
thread.addMessage(parser.senderId, parser.messageText, parser.secondsSinceSent, parser.extraData);
|
||||||
|
|
||||||
setMessageThreads(prevValue => [...prevValue]);
|
setMessageThreads(prevValue => [ ...prevValue ]);
|
||||||
}, [getMessageThreadWithIndex]);
|
}, [ getMessageThreadWithIndex ]);
|
||||||
|
|
||||||
UseMessageEventHook(NewConsoleMessageEvent, onNewConsoleMessageEvent);
|
UseMessageEventHook(NewConsoleMessageEvent, onNewConsoleMessageEvent);
|
||||||
|
|
||||||
@ -105,14 +105,14 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
const [threadIndex, thread] = getMessageThreadWithIndex(parser.senderId);
|
const [ threadIndex, thread ] = getMessageThreadWithIndex(parser.senderId);
|
||||||
|
|
||||||
if((threadIndex === -1) || !thread) return;
|
if((threadIndex === -1) || !thread) return;
|
||||||
|
|
||||||
thread.addMessage(null, parser.messageText, 0, null, MessengerThreadChat.ROOM_INVITE);
|
thread.addMessage(null, parser.messageText, 0, null, MessengerThreadChat.ROOM_INVITE);
|
||||||
|
|
||||||
setMessageThreads(prevValue => [...prevValue]);
|
setMessageThreads(prevValue => [ ...prevValue ]);
|
||||||
}, [getMessageThreadWithIndex]);
|
}, [ getMessageThreadWithIndex ]);
|
||||||
|
|
||||||
UseMessageEventHook(RoomInviteEvent, onRoomInviteEvent);
|
UseMessageEventHook(RoomInviteEvent, onRoomInviteEvent);
|
||||||
|
|
||||||
@ -144,17 +144,17 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
|
|
||||||
BatchUpdates(() =>
|
BatchUpdates(() =>
|
||||||
{
|
{
|
||||||
setMessageThreads(prevValue => [...prevValue]);
|
setMessageThreads(prevValue => [ ...prevValue ]);
|
||||||
setMessageText('');
|
setMessageText('');
|
||||||
});
|
});
|
||||||
}, [messageThreads, activeThreadIndex, messageText]);
|
}, [ messageThreads, activeThreadIndex, messageText ]);
|
||||||
|
|
||||||
const onKeyDown = useCallback((event: KeyboardEvent<HTMLInputElement>) =>
|
const onKeyDown = useCallback((event: KeyboardEvent<HTMLInputElement>) =>
|
||||||
{
|
{
|
||||||
if(event.key !== 'Enter') return;
|
if(event.key !== 'Enter') return;
|
||||||
|
|
||||||
sendMessage();
|
sendMessage();
|
||||||
}, [sendMessage]);
|
}, [ sendMessage ]);
|
||||||
|
|
||||||
const linkReceived = useCallback((url: string) =>
|
const linkReceived = useCallback((url: string) =>
|
||||||
{
|
{
|
||||||
@ -169,7 +169,7 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [threadIndex] = getMessageThreadWithIndex(parseInt(parts[2]));
|
const [ threadIndex ] = getMessageThreadWithIndex(parseInt(parts[2]));
|
||||||
|
|
||||||
if(threadIndex === -1) return;
|
if(threadIndex === -1) return;
|
||||||
|
|
||||||
@ -178,13 +178,13 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
setActiveThreadIndex(threadIndex);
|
setActiveThreadIndex(threadIndex);
|
||||||
setIsVisible(true);
|
setIsVisible(true);
|
||||||
});
|
});
|
||||||
}, [getMessageThreadWithIndex]);
|
}, [ getMessageThreadWithIndex ]);
|
||||||
|
|
||||||
const closeThread = useCallback((threadIndex: number) =>
|
const closeThread = useCallback((threadIndex: number) =>
|
||||||
{
|
{
|
||||||
setHiddenThreadIndexes(prevValue =>
|
setHiddenThreadIndexes(prevValue =>
|
||||||
{
|
{
|
||||||
const values = [...prevValue];
|
const values = [ ...prevValue ];
|
||||||
|
|
||||||
if(values.indexOf(threadIndex) === -1) values.push(threadIndex);
|
if(values.indexOf(threadIndex) === -1) values.push(threadIndex);
|
||||||
|
|
||||||
@ -202,19 +202,19 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
AddEventLinkTracker(linkTracker);
|
AddEventLinkTracker(linkTracker);
|
||||||
|
|
||||||
return () => RemoveLinkEventTracker(linkTracker);
|
return () => RemoveLinkEventTracker(linkTracker);
|
||||||
}, [linkReceived]);
|
}, [ linkReceived ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
if(!isVisible) return;
|
if(!isVisible) return;
|
||||||
|
|
||||||
if(activeThreadIndex === -1) setActiveThreadIndex(0);
|
if(activeThreadIndex === -1) setActiveThreadIndex(0);
|
||||||
}, [isVisible, activeThreadIndex]);
|
}, [ isVisible, activeThreadIndex ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
if(hiddenThreadIndexes.indexOf(activeThreadIndex) >= 0) setActiveThreadIndex(0);
|
if(hiddenThreadIndexes.indexOf(activeThreadIndex) >= 0) setActiveThreadIndex(0);
|
||||||
}, [activeThreadIndex, hiddenThreadIndexes]);
|
}, [ activeThreadIndex, hiddenThreadIndexes ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
@ -230,7 +230,7 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
activeThread.setRead();
|
activeThread.setRead();
|
||||||
setUpdateValue({});
|
setUpdateValue({});
|
||||||
}
|
}
|
||||||
}, [isVisible, messageThreads, activeThreadIndex]);
|
}, [ isVisible, messageThreads, activeThreadIndex ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
@ -258,13 +258,13 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
if(isUnread) PlaySound(SoundNames.MESSENGER_MESSAGE_RECEIVED);
|
if(isUnread) PlaySound(SoundNames.MESSENGER_MESSAGE_RECEIVED);
|
||||||
|
|
||||||
DispatchUiEvent(new FriendsMessengerIconEvent(FriendsMessengerIconEvent.UPDATE_ICON, isUnread ? FriendsMessengerIconEvent.UNREAD_ICON : FriendsMessengerIconEvent.SHOW_ICON));
|
DispatchUiEvent(new FriendsMessengerIconEvent(FriendsMessengerIconEvent.UPDATE_ICON, isUnread ? FriendsMessengerIconEvent.UNREAD_ICON : FriendsMessengerIconEvent.SHOW_ICON));
|
||||||
}, [visibleThreads, updateValue]);
|
}, [ visibleThreads, updateValue ]);
|
||||||
|
|
||||||
if(!isVisible) return null;
|
if(!isVisible) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NitroCardView className="nitro-friends-messenger" uniqueKey="nitro-friends-messenger" theme="primary-slim">
|
<NitroCardView className="nitro-friends-messenger" uniqueKey="nitro-friends-messenger" theme="primary-slim">
|
||||||
<NitroCardHeaderView headerText={LocalizeText('messenger.window.title', ['OPEN_CHAT_COUNT'], [visibleThreads.length.toString()])} onCloseClick={event => setIsVisible(false)} />
|
<NitroCardHeaderView headerText={LocalizeText('messenger.window.title', [ 'OPEN_CHAT_COUNT' ], [ visibleThreads.length.toString() ])} onCloseClick={event => setIsVisible(false)} />
|
||||||
<NitroCardContentView>
|
<NitroCardContentView>
|
||||||
<Grid overflow="hidden">
|
<Grid overflow="hidden">
|
||||||
<Column size={ 4 }>
|
<Column size={ 4 }>
|
||||||
|
@ -34,33 +34,33 @@ export const GroupBadgeCreatorView: FC<GroupBadgeCreatorViewProps> = props =>
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{ ((selectedIndex < 0) && badgeParts && (badgeParts.length > 0)) && badgeParts.map((part, index) =>
|
{ ((selectedIndex < 0) && badgeParts && (badgeParts.length > 0)) && badgeParts.map((part, index) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<Flex key={ index } alignItems="center" justifyContent="between" gap={ 2 } className="bg-muted rounded px-2 py-1">
|
<Flex key={ index } alignItems="center" justifyContent="between" gap={ 2 } className="bg-muted rounded px-2 py-1">
|
||||||
<Flex pointer center className="bg-muted rounded p-1" onClick={ event => setSelectedIndex(index) }>
|
<Flex pointer center className="bg-muted rounded p-1" onClick={ event => setSelectedIndex(index) }>
|
||||||
{ (badgeParts[index].code && (badgeParts[index].code.length > 0)) &&
|
{ (badgeParts[index].code && (badgeParts[index].code.length > 0)) &&
|
||||||
<LayoutBadgeImageView badgeCode={ badgeParts[index].code } isGroup={ true } /> }
|
<LayoutBadgeImageView badgeCode={ badgeParts[index].code } isGroup={ true } /> }
|
||||||
{ (!badgeParts[index].code || !badgeParts[index].code.length) &&
|
{ (!badgeParts[index].code || !badgeParts[index].code.length) &&
|
||||||
<Flex center className="badge-image group-badge">
|
<Flex center className="badge-image group-badge">
|
||||||
<FontAwesomeIcon icon="plus" />
|
<FontAwesomeIcon icon="plus" />
|
||||||
</Flex> }
|
</Flex> }
|
||||||
</Flex>
|
</Flex>
|
||||||
{ (part.type !== GroupBadgePart.BASE) &&
|
{ (part.type !== GroupBadgePart.BASE) &&
|
||||||
<Grid gap={ 1 } columnCount={ 3 }>
|
<Grid gap={ 1 } columnCount={ 3 }>
|
||||||
{ POSITIONS.map((position, posIndex) =>
|
{ POSITIONS.map((position, posIndex) =>
|
||||||
{
|
|
||||||
return <Base key={ posIndex } pointer className={ `group-badge-position-swatch ${ (badgeParts[index].position === position) ? 'active' : '' }` } onClick={ event => setPartProperty(index, 'position', position) }></Base>
|
|
||||||
}) }
|
|
||||||
</Grid> }
|
|
||||||
<Grid gap={ 1 } columnCount={ 8 }>
|
|
||||||
{ (groupCustomize.badgePartColors.length > 0) && groupCustomize.badgePartColors.map((item, colorIndex) =>
|
|
||||||
{
|
{
|
||||||
return <Base key={ colorIndex } pointer className={ `group-badge-color-swatch ${ (badgeParts[index].color === (colorIndex + 1)) ? 'active' : '' }` } style={{ backgroundColor: '#' + item.color }} onClick={ event => setPartProperty(index, 'color', (colorIndex + 1)) }></Base>
|
return <Base key={ posIndex } pointer className={ `group-badge-position-swatch ${ (badgeParts[index].position === position) ? 'active' : '' }` } onClick={ event => setPartProperty(index, 'position', position) }></Base>
|
||||||
}) }
|
}) }
|
||||||
</Grid>
|
</Grid> }
|
||||||
</Flex>
|
<Grid gap={ 1 } columnCount={ 8 }>
|
||||||
);
|
{ (groupCustomize.badgePartColors.length > 0) && groupCustomize.badgePartColors.map((item, colorIndex) =>
|
||||||
}) }
|
{
|
||||||
|
return <Base key={ colorIndex } pointer className={ `group-badge-color-swatch ${ (badgeParts[index].color === (colorIndex + 1)) ? 'active' : '' }` } style={{ backgroundColor: '#' + item.color }} onClick={ event => setPartProperty(index, 'color', (colorIndex + 1)) }></Base>
|
||||||
|
}) }
|
||||||
|
</Grid>
|
||||||
|
</Flex>
|
||||||
|
);
|
||||||
|
}) }
|
||||||
{ (selectedIndex >= 0) &&
|
{ (selectedIndex >= 0) &&
|
||||||
<Grid gap={ 1 } columnCount={ 5 }>
|
<Grid gap={ 1 } columnCount={ 5 }>
|
||||||
{ (badgeParts[selectedIndex].type === GroupBadgePart.SYMBOL) &&
|
{ (badgeParts[selectedIndex].type === GroupBadgePart.SYMBOL) &&
|
||||||
@ -70,13 +70,13 @@ export const GroupBadgeCreatorView: FC<GroupBadgeCreatorViewProps> = props =>
|
|||||||
</Flex>
|
</Flex>
|
||||||
</Column> }
|
</Column> }
|
||||||
{ ((badgeParts[selectedIndex].type === GroupBadgePart.BASE) ? groupCustomize.badgeBases : groupCustomize.badgeSymbols).map((item, index) =>
|
{ ((badgeParts[selectedIndex].type === GroupBadgePart.BASE) ? groupCustomize.badgeBases : groupCustomize.badgeSymbols).map((item, index) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<Column key={ index } pointer center className="bg-muted rounded p-1" onClick={ event => setPartProperty(selectedIndex, 'key', item.id) }>
|
<Column key={ index } pointer center className="bg-muted rounded p-1" onClick={ event => setPartProperty(selectedIndex, 'key', item.id) }>
|
||||||
<LayoutBadgeImageView badgeCode={ GroupBadgePart.getCode(badgeParts[selectedIndex].type, item.id, badgeParts[selectedIndex].color, 4) } isGroup={ true } />
|
<LayoutBadgeImageView badgeCode={ GroupBadgePart.getCode(badgeParts[selectedIndex].type, item.id, badgeParts[selectedIndex].color, 4) } isGroup={ true } />
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
}) }
|
}) }
|
||||||
</Grid> }
|
</Grid> }
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -132,13 +132,13 @@ export const GroupCreatorView: FC<GroupCreatorViewProps> = props =>
|
|||||||
<NitroCardContentView>
|
<NitroCardContentView>
|
||||||
<Flex center className="creator-tabs">
|
<Flex center className="creator-tabs">
|
||||||
{ TABS.map((tab, index) =>
|
{ TABS.map((tab, index) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<Flex center key={ index } className={ `tab tab-${ ((tab === 1) ? 'blue-flat' : (tab === 4) ? 'yellow' : 'blue-arrow') } ${ (currentTab === tab) ? 'active' : '' }` }>
|
<Flex center key={ index } className={ `tab tab-${ ((tab === 1) ? 'blue-flat' : (tab === 4) ? 'yellow' : 'blue-arrow') } ${ (currentTab === tab) ? 'active' : '' }` }>
|
||||||
<Text variant="white">{ LocalizeText(`group.create.steplabel.${ tab }`) }</Text>
|
<Text variant="white">{ LocalizeText(`group.create.steplabel.${ tab }`) }</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
}) }
|
}) }
|
||||||
</Flex>
|
</Flex>
|
||||||
<Column overflow="hidden">
|
<Column overflow="hidden">
|
||||||
<Flex alignItems="center" gap={ 2 }>
|
<Flex alignItems="center" gap={ 2 }>
|
||||||
|
@ -26,11 +26,11 @@ export const GroupInformationView: FC<GroupInformationViewProps> = props =>
|
|||||||
const leaveGroup = () =>
|
const leaveGroup = () =>
|
||||||
{
|
{
|
||||||
NotificationUtilities.confirm(LocalizeText('group.leaveconfirm.desc'), () =>
|
NotificationUtilities.confirm(LocalizeText('group.leaveconfirm.desc'), () =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new GroupRemoveMemberComposer(groupInformation.id, GetSessionDataManager().userId));
|
SendMessageComposer(new GroupRemoveMemberComposer(groupInformation.id, GetSessionDataManager().userId));
|
||||||
|
|
||||||
if(onClose) onClose();
|
if(onClose) onClose();
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
const getRoleIcon = () =>
|
const getRoleIcon = () =>
|
||||||
@ -126,7 +126,7 @@ export const GroupInformationView: FC<GroupInformationViewProps> = props =>
|
|||||||
<i className="icon icon-group-decorate" title={ LocalizeText('group.memberscandecorate') } /> }
|
<i className="icon icon-group-decorate" title={ LocalizeText('group.memberscandecorate') } /> }
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Text small>{ LocalizeText('group.created', ['date', 'owner'], [groupInformation.createdAt, groupInformation.ownerName]) }</Text>
|
<Text small>{ LocalizeText('group.created', [ 'date', 'owner' ], [ groupInformation.createdAt, groupInformation.ownerName ]) }</Text>
|
||||||
</Column>
|
</Column>
|
||||||
<Text small overflow="auto" className="group-description">{ groupInformation.description }</Text>
|
<Text small overflow="auto" className="group-description">{ groupInformation.description }</Text>
|
||||||
</Column>
|
</Column>
|
||||||
|
@ -20,11 +20,11 @@ export const GroupManagerView: FC<{}> = props =>
|
|||||||
const close = () =>
|
const close = () =>
|
||||||
{
|
{
|
||||||
setCloseAction(prevValue =>
|
setCloseAction(prevValue =>
|
||||||
{
|
{
|
||||||
if(prevValue && prevValue.action) prevValue.action();
|
if(prevValue && prevValue.action) prevValue.action();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
setGroupData(null);
|
setGroupData(null);
|
||||||
}
|
}
|
||||||
@ -43,16 +43,16 @@ export const GroupManagerView: FC<{}> = props =>
|
|||||||
if(!groupData || (groupData.groupId !== parser.id)) return;
|
if(!groupData || (groupData.groupId !== parser.id)) return;
|
||||||
|
|
||||||
setGroupData(prevValue =>
|
setGroupData(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.groupName = parser.title;
|
newValue.groupName = parser.title;
|
||||||
newValue.groupDescription = parser.description;
|
newValue.groupDescription = parser.description;
|
||||||
newValue.groupState = parser.type;
|
newValue.groupState = parser.type;
|
||||||
newValue.groupCanMembersDecorate = parser.canMembersDecorate;
|
newValue.groupCanMembersDecorate = parser.canMembersDecorate;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
}, [ groupData ]);
|
}, [ groupData ]);
|
||||||
|
|
||||||
UseMessageEventHook(GroupInformationEvent, onGroupInformationEvent);
|
UseMessageEventHook(GroupInformationEvent, onGroupInformationEvent);
|
||||||
@ -94,11 +94,11 @@ export const GroupManagerView: FC<{}> = props =>
|
|||||||
<NitroCardHeaderView headerText={ LocalizeText('group.window.title') } onCloseClick={ close } />
|
<NitroCardHeaderView headerText={ LocalizeText('group.window.title') } onCloseClick={ close } />
|
||||||
<NitroCardTabsView>
|
<NitroCardTabsView>
|
||||||
{ TABS.map(tab =>
|
{ TABS.map(tab =>
|
||||||
{
|
{
|
||||||
return (<NitroCardTabsItemView key={ tab } isActive={ currentTab === tab } onClick={ () => changeTab(tab) }>
|
return (<NitroCardTabsItemView key={ tab } isActive={ currentTab === tab } onClick={ () => changeTab(tab) }>
|
||||||
{ LocalizeText(`group.edit.tab.${tab}`) }
|
{ LocalizeText(`group.edit.tab.${tab}`) }
|
||||||
</NitroCardTabsItemView>);
|
</NitroCardTabsItemView>);
|
||||||
}) }
|
}) }
|
||||||
</NitroCardTabsView>
|
</NitroCardTabsView>
|
||||||
<NitroCardContentView>
|
<NitroCardContentView>
|
||||||
<Flex alignItems="center" gap={ 2 }>
|
<Flex alignItems="center" gap={ 2 }>
|
||||||
|
@ -91,11 +91,11 @@ export const GroupMembersView: FC<{}> = props =>
|
|||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
NotificationUtilities.confirm(LocalizeText(((parser.furnitureCount > 0) ? 'group.kickconfirm.desc' : 'group.kickconfirm_nofurni.desc'), [ 'user', 'amount' ], [ removingMemberName, parser.furnitureCount.toString() ]), () =>
|
NotificationUtilities.confirm(LocalizeText(((parser.furnitureCount > 0) ? 'group.kickconfirm.desc' : 'group.kickconfirm_nofurni.desc'), [ 'user', 'amount' ], [ removingMemberName, parser.furnitureCount.toString() ]), () =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new GroupRemoveMemberComposer(membersData.groupId, parser.userId));
|
SendMessageComposer(new GroupRemoveMemberComposer(membersData.groupId, parser.userId));
|
||||||
|
|
||||||
refreshMembers();
|
refreshMembers();
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
setRemovingMemberName(null);
|
setRemovingMemberName(null);
|
||||||
}, [ membersData, removingMemberName, refreshMembers ]);
|
}, [ membersData, removingMemberName, refreshMembers ]);
|
||||||
@ -160,7 +160,7 @@ export const GroupMembersView: FC<{}> = props =>
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<NitroCardView className="nitro-group-members" theme="primary-slim">
|
<NitroCardView className="nitro-group-members" theme="primary-slim">
|
||||||
<NitroCardHeaderView headerText={ LocalizeText('group.members.title', ['groupName'], [ membersData ? membersData.groupTitle : '' ]) } onCloseClick={ event => setGroupId(-1) } />
|
<NitroCardHeaderView headerText={ LocalizeText('group.members.title', [ 'groupName' ], [ membersData ? membersData.groupTitle : '' ]) } onCloseClick={ event => setGroupId(-1) } />
|
||||||
<NitroCardContentView overflow="hidden">
|
<NitroCardContentView overflow="hidden">
|
||||||
<Flex gap={ 2 }>
|
<Flex gap={ 2 }>
|
||||||
<Flex center className="group-badge">
|
<Flex center className="group-badge">
|
||||||
@ -177,41 +177,41 @@ export const GroupMembersView: FC<{}> = props =>
|
|||||||
</Flex>
|
</Flex>
|
||||||
<Grid columnCount={ 2 } overflow="auto" className="nitro-group-members-list-grid">
|
<Grid columnCount={ 2 } overflow="auto" className="nitro-group-members-list-grid">
|
||||||
{ membersData.result.map((member, index) =>
|
{ membersData.result.map((member, index) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<Flex key={ index } gap={ 2 } alignItems="center" overflow="hidden" className="member-list-item bg-white rounded p-2">
|
<Flex key={ index } gap={ 2 } alignItems="center" overflow="hidden" className="member-list-item bg-white rounded p-2">
|
||||||
<div className="avatar-head cursor-pointer" onClick={ () => GetUserProfile(member.id) }>
|
<div className="avatar-head cursor-pointer" onClick={ () => GetUserProfile(member.id) }>
|
||||||
<LayoutAvatarImageView figure={ member.figure } headOnly={ true } direction={ 2 } />
|
<LayoutAvatarImageView figure={ member.figure } headOnly={ true } direction={ 2 } />
|
||||||
</div>
|
</div>
|
||||||
<Column grow gap={ 1 }>
|
<Column grow gap={ 1 }>
|
||||||
<Text bold small pointer onClick={ event => GetUserProfile(member.id) }>{ member.name }</Text>
|
<Text bold small pointer onClick={ event => GetUserProfile(member.id) }>{ member.name }</Text>
|
||||||
{ (member.rank !== GroupRank.REQUESTED) &&
|
{ (member.rank !== GroupRank.REQUESTED) &&
|
||||||
<Text small italics variant="muted">{ LocalizeText('group.members.since', [ 'date' ], [ member.joinedAt ]) }</Text> }
|
<Text small italics variant="muted">{ LocalizeText('group.members.since', [ 'date' ], [ member.joinedAt ]) }</Text> }
|
||||||
</Column>
|
</Column>
|
||||||
<Column gap={ 1 }>
|
<Column gap={ 1 }>
|
||||||
{ (member.rank !== GroupRank.REQUESTED) &&
|
{ (member.rank !== GroupRank.REQUESTED) &&
|
||||||
<Flex center>
|
<Flex center>
|
||||||
<Base pointer={ membersData.admin } className={ `icon icon-group-small-${ ((member.rank === GroupRank.OWNER) ? 'owner' : (member.rank === GroupRank.ADMIN) ? 'admin' : (membersData.admin && (member.rank === GroupRank.MEMBER)) ? 'not-admin' : '') }` } title={ LocalizeText(getRankDescription(member)) } onClick={ event => toggleAdmin(member) } />
|
<Base pointer={ membersData.admin } className={ `icon icon-group-small-${ ((member.rank === GroupRank.OWNER) ? 'owner' : (member.rank === GroupRank.ADMIN) ? 'admin' : (membersData.admin && (member.rank === GroupRank.MEMBER)) ? 'not-admin' : '') }` } title={ LocalizeText(getRankDescription(member)) } onClick={ event => toggleAdmin(member) } />
|
||||||
</Flex> }
|
</Flex> }
|
||||||
{ membersData.admin && (member.rank === GroupRank.REQUESTED) &&
|
{ membersData.admin && (member.rank === GroupRank.REQUESTED) &&
|
||||||
<Flex alignItems="center">
|
<Flex alignItems="center">
|
||||||
<Base pointer className="nitro-friends-spritesheet icon-accept" title={ LocalizeText('group.members.accept') } onClick={ event => acceptMembership(member) }></Base>
|
<Base pointer className="nitro-friends-spritesheet icon-accept" title={ LocalizeText('group.members.accept') } onClick={ event => acceptMembership(member) }></Base>
|
||||||
</Flex> }
|
</Flex> }
|
||||||
{ membersData.admin && (member.rank !== GroupRank.OWNER) && (member.id !== GetSessionDataManager().userId) &&
|
{ membersData.admin && (member.rank !== GroupRank.OWNER) && (member.id !== GetSessionDataManager().userId) &&
|
||||||
<Flex alignItems="center">
|
<Flex alignItems="center">
|
||||||
<Base pointer className="nitro-friends-spritesheet icon-deny" title={ LocalizeText(member.rank === GroupRank.REQUESTED ? 'group.members.reject' : 'group.members.kick') } onClick={ event => removeMemberOrDeclineMembership(member) }></Base>
|
<Base pointer className="nitro-friends-spritesheet icon-deny" title={ LocalizeText(member.rank === GroupRank.REQUESTED ? 'group.members.reject' : 'group.members.kick') } onClick={ event => removeMemberOrDeclineMembership(member) }></Base>
|
||||||
</Flex> }
|
</Flex> }
|
||||||
</Column>
|
</Column>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
}) }
|
}) }
|
||||||
</Grid>
|
</Grid>
|
||||||
<Flex gap={ 1 } justifyContent="between" alignItems="center">
|
<Flex gap={ 1 } justifyContent="between" alignItems="center">
|
||||||
<Button disabled={ (membersData.pageIndex === 0) } onClick={ event => setPageId(prevValue => (prevValue - 1)) }>
|
<Button disabled={ (membersData.pageIndex === 0) } onClick={ event => setPageId(prevValue => (prevValue - 1)) }>
|
||||||
<FontAwesomeIcon icon="chevron-left" />
|
<FontAwesomeIcon icon="chevron-left" />
|
||||||
</Button>
|
</Button>
|
||||||
<Text small>
|
<Text small>
|
||||||
{ LocalizeText('group.members.pageinfo', ['amount', 'page', 'totalPages'], [membersData.totalMembersCount.toString(), (membersData.pageIndex + 1).toString(), totalPages.toString()]) }
|
{ LocalizeText('group.members.pageinfo', [ 'amount', 'page', 'totalPages' ], [ membersData.totalMembersCount.toString(), (membersData.pageIndex + 1).toString(), totalPages.toString() ]) }
|
||||||
</Text>
|
</Text>
|
||||||
<Button disabled={ (membersData.pageIndex === (totalPages - 1)) } onClick={ event => setPageId(prevValue => (prevValue + 1)) }>
|
<Button disabled={ (membersData.pageIndex === (totalPages - 1)) } onClick={ event => setPageId(prevValue => (prevValue + 1)) }>
|
||||||
<FontAwesomeIcon icon="chevron-right" />
|
<FontAwesomeIcon icon="chevron-right" />
|
||||||
|
@ -75,9 +75,9 @@ export const GroupRoomInformationView: FC<{}> = props =>
|
|||||||
const leaveGroup = () =>
|
const leaveGroup = () =>
|
||||||
{
|
{
|
||||||
NotificationUtilities.confirm(LocalizeText('group.leaveconfirm.desc'), () =>
|
NotificationUtilities.confirm(LocalizeText('group.leaveconfirm.desc'), () =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new GroupRemoveMemberComposer(groupInformation.id, GetSessionDataManager().userId));
|
SendMessageComposer(new GroupRemoveMemberComposer(groupInformation.id, GetSessionDataManager().userId));
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
const isRealOwner = (groupInformation && (groupInformation.ownerName === GetSessionDataManager().userName));
|
const isRealOwner = (groupInformation && (groupInformation.ownerName === GetSessionDataManager().userName));
|
||||||
@ -134,7 +134,7 @@ export const GroupRoomInformationView: FC<{}> = props =>
|
|||||||
<Button fullWidth variant="success" disabled={ (groupInformation.membershipType === GroupMembershipType.REQUEST_PENDING) } onClick={ handleButtonClick }>
|
<Button fullWidth variant="success" disabled={ (groupInformation.membershipType === GroupMembershipType.REQUEST_PENDING) } onClick={ handleButtonClick }>
|
||||||
{ LocalizeText(getButtonText()) }
|
{ LocalizeText(getButtonText()) }
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
</> }
|
</> }
|
||||||
</Column>
|
</Column>
|
||||||
</Base>
|
</Base>
|
||||||
|
@ -41,13 +41,13 @@ export const GroupTabBadgeView: FC<GroupTabBadgeViewProps> = props =>
|
|||||||
if(groupData.groupId <= 0)
|
if(groupData.groupId <= 0)
|
||||||
{
|
{
|
||||||
setGroupData(prevValue =>
|
setGroupData(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.groupBadgeParts = badgeParts;
|
newValue.groupBadgeParts = badgeParts;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -81,11 +81,11 @@ export const GroupTabBadgeView: FC<GroupTabBadgeViewProps> = props =>
|
|||||||
];
|
];
|
||||||
|
|
||||||
setGroupData(prevValue =>
|
setGroupData(prevValue =>
|
||||||
{
|
{
|
||||||
const groupBadgeParts = badgeParts;
|
const groupBadgeParts = badgeParts;
|
||||||
|
|
||||||
return { ...prevValue, groupBadgeParts };
|
return { ...prevValue, groupBadgeParts };
|
||||||
});
|
});
|
||||||
}, [ groupData.groupBadgeParts, groupCustomize, setGroupData ]);
|
}, [ groupData.groupBadgeParts, groupCustomize, setGroupData ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
|
@ -29,13 +29,13 @@ export const GroupTabColorsView: FC<GroupTabColorsViewProps> = props =>
|
|||||||
const selectColor = (colorIndex: number, colorId: number) =>
|
const selectColor = (colorIndex: number, colorId: number) =>
|
||||||
{
|
{
|
||||||
setColors(prevValue =>
|
setColors(prevValue =>
|
||||||
{
|
{
|
||||||
const newColors = [ ...prevValue ];
|
const newColors = [ ...prevValue ];
|
||||||
|
|
||||||
newColors[colorIndex] = colorId;
|
newColors[colorIndex] = colorId;
|
||||||
|
|
||||||
return newColors;
|
return newColors;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveColors = useCallback(() =>
|
const saveColors = useCallback(() =>
|
||||||
@ -47,13 +47,13 @@ export const GroupTabColorsView: FC<GroupTabColorsViewProps> = props =>
|
|||||||
if(groupData.groupId <= 0)
|
if(groupData.groupId <= 0)
|
||||||
{
|
{
|
||||||
setGroupData(prevValue =>
|
setGroupData(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.groupColors = [ ...colors ];
|
newValue.groupColors = [ ...colors ];
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -70,9 +70,9 @@ export const GroupTabColorsView: FC<GroupTabColorsViewProps> = props =>
|
|||||||
const groupColors = [ groupCustomize.groupColorsA[0].id, groupCustomize.groupColorsB[0].id ];
|
const groupColors = [ groupCustomize.groupColorsA[0].id, groupCustomize.groupColorsB[0].id ];
|
||||||
|
|
||||||
setGroupData(prevValue =>
|
setGroupData(prevValue =>
|
||||||
{
|
{
|
||||||
return { ...prevValue, groupColors };
|
return { ...prevValue, groupColors };
|
||||||
});
|
});
|
||||||
}, [ groupCustomize, groupData.groupColors, setGroupData ]);
|
}, [ groupCustomize, groupData.groupColors, setGroupData ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
@ -110,18 +110,18 @@ export const GroupTabColorsView: FC<GroupTabColorsViewProps> = props =>
|
|||||||
<Text bold>{ LocalizeText('group.edit.color.primary.color') }</Text>
|
<Text bold>{ LocalizeText('group.edit.color.primary.color') }</Text>
|
||||||
<AutoGrid gap={ 1 } columnCount={ 7 } columnMinWidth={ 16 } columnMinHeight={ 16 }>
|
<AutoGrid gap={ 1 } columnCount={ 7 } columnMinWidth={ 16 } columnMinHeight={ 16 }>
|
||||||
{ groupData.groupColors && groupCustomize.groupColorsA && groupCustomize.groupColorsA.map((item, index) =>
|
{ groupData.groupColors && groupCustomize.groupColorsA && groupCustomize.groupColorsA.map((item, index) =>
|
||||||
{
|
{
|
||||||
return <div key={ index } className={ 'group-badge-color-swatch cursor-pointer' + classNames({ ' active': (groupData.groupColors[0] === item.id) }) } style={{ backgroundColor: '#' + item.color }} onClick={ () => selectColor(0, item.id) }></div>
|
return <div key={ index } className={ 'group-badge-color-swatch cursor-pointer' + classNames({ ' active': (groupData.groupColors[0] === item.id) }) } style={{ backgroundColor: '#' + item.color }} onClick={ () => selectColor(0, item.id) }></div>
|
||||||
}) }
|
}) }
|
||||||
</AutoGrid>
|
</AutoGrid>
|
||||||
</Column>
|
</Column>
|
||||||
<Column size={ 5 } gap={ 1 } overflow="hidden">
|
<Column size={ 5 } gap={ 1 } overflow="hidden">
|
||||||
<Text bold>{ LocalizeText('group.edit.color.secondary.color') }</Text>
|
<Text bold>{ LocalizeText('group.edit.color.secondary.color') }</Text>
|
||||||
<AutoGrid gap={ 1 } columnCount={ 7 } columnMinWidth={ 16 } columnMinHeight={ 16 }>
|
<AutoGrid gap={ 1 } columnCount={ 7 } columnMinWidth={ 16 } columnMinHeight={ 16 }>
|
||||||
{ groupData.groupColors && groupCustomize.groupColorsB && groupCustomize.groupColorsB.map((item, index) =>
|
{ groupData.groupColors && groupCustomize.groupColorsB && groupCustomize.groupColorsB.map((item, index) =>
|
||||||
{
|
{
|
||||||
return <div key={ index } className={ 'group-badge-color-swatch cursor-pointer' + classNames({ ' active': (groupData.groupColors[1] === item.id) }) } style={{ backgroundColor: '#' + item.color }} onClick={ () => selectColor(1, item.id) }></div>
|
return <div key={ index } className={ 'group-badge-color-swatch cursor-pointer' + classNames({ ' active': (groupData.groupColors[1] === item.id) }) } style={{ backgroundColor: '#' + item.color }} onClick={ () => selectColor(1, item.id) }></div>
|
||||||
}) }
|
}) }
|
||||||
</AutoGrid>
|
</AutoGrid>
|
||||||
</Column>
|
</Column>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -27,11 +27,11 @@ export const GroupTabIdentityView: FC<GroupTabIdentityViewProps> = props =>
|
|||||||
if(!groupData || (groupData.groupId <= 0)) return;
|
if(!groupData || (groupData.groupId <= 0)) return;
|
||||||
|
|
||||||
NotificationUtilities.confirm(LocalizeText('group.deleteconfirm.desc'), () =>
|
NotificationUtilities.confirm(LocalizeText('group.deleteconfirm.desc'), () =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new GroupDeleteComposer(groupData.groupId));
|
SendMessageComposer(new GroupDeleteComposer(groupData.groupId));
|
||||||
|
|
||||||
if(close) close();
|
if(close) close();
|
||||||
}, null, null, null, LocalizeText('group.deleteconfirm.title'));
|
}, null, null, null, LocalizeText('group.deleteconfirm.title'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveIdentity = useCallback(() =>
|
const saveIdentity = useCallback(() =>
|
||||||
@ -45,15 +45,15 @@ export const GroupTabIdentityView: FC<GroupTabIdentityViewProps> = props =>
|
|||||||
if(groupHomeroomId <= 0) return false;
|
if(groupHomeroomId <= 0) return false;
|
||||||
|
|
||||||
setGroupData(prevValue =>
|
setGroupData(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.groupName = groupName;
|
newValue.groupName = groupName;
|
||||||
newValue.groupDescription = groupDescription;
|
newValue.groupDescription = groupDescription;
|
||||||
newValue.groupHomeroomId = groupHomeroomId;
|
newValue.groupHomeroomId = groupHomeroomId;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,14 +30,14 @@ export const GroupTabSettingsView: FC<GroupTabSettingsViewProps> = props =>
|
|||||||
if(groupData.groupId <= 0)
|
if(groupData.groupId <= 0)
|
||||||
{
|
{
|
||||||
setGroupData(prevValue =>
|
setGroupData(prevValue =>
|
||||||
{
|
{
|
||||||
const newValue = { ...prevValue };
|
const newValue = { ...prevValue };
|
||||||
|
|
||||||
newValue.groupState = groupState;
|
newValue.groupState = groupState;
|
||||||
newValue.groupCanMembersDecorate = groupDecorate;
|
newValue.groupCanMembersDecorate = groupDecorate;
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -67,20 +67,20 @@ export const GroupTabSettingsView: FC<GroupTabSettingsViewProps> = props =>
|
|||||||
<Column overflow="auto">
|
<Column overflow="auto">
|
||||||
<Column>
|
<Column>
|
||||||
{ STATES.map((state, index) =>
|
{ STATES.map((state, index) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<Flex key={ index } alignItems="center" gap={ 1 }>
|
<Flex key={ index } alignItems="center" gap={ 1 }>
|
||||||
<input className="form-check-input" type="radio" name="groupState" checked={ (groupState === index) } onChange={ event => setGroupState(index) } />
|
<input className="form-check-input" type="radio" name="groupState" checked={ (groupState === index) } onChange={ event => setGroupState(index) } />
|
||||||
<Column gap={ 0 }>
|
<Column gap={ 0 }>
|
||||||
<Flex gap={ 1 }>
|
<Flex gap={ 1 }>
|
||||||
<i className={ `icon icon-group-type-${ index }` } />
|
<i className={ `icon icon-group-type-${ index }` } />
|
||||||
<Text bold>{ LocalizeText(`group.edit.settings.type.${ state }.label`) }</Text>
|
<Text bold>{ LocalizeText(`group.edit.settings.type.${ state }.label`) }</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Text>{ LocalizeText(`group.edit.settings.type.${ state }.help`) }</Text>
|
<Text>{ LocalizeText(`group.edit.settings.type.${ state }.help`) }</Text>
|
||||||
</Column>
|
</Column>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
}) }
|
}) }
|
||||||
</Column>
|
</Column>
|
||||||
<HorizontalRule />
|
<HorizontalRule />
|
||||||
<Flex alignItems="center" gap={ 1 }>
|
<Flex alignItems="center" gap={ 1 }>
|
||||||
|
@ -55,7 +55,7 @@ export const GuideToolView: FC<{}> = props =>
|
|||||||
setNoCloseButton(true);
|
setNoCloseButton(true);
|
||||||
break;
|
break;
|
||||||
case GuideSessionState.GUIDE_ONGOING:
|
case GuideSessionState.GUIDE_ONGOING:
|
||||||
setHeaderText(LocalizeText('guide.help.request.guide.ongoing.title', ['name'], [replacement]));
|
setHeaderText(LocalizeText('guide.help.request.guide.ongoing.title', [ 'name' ], [ replacement ]));
|
||||||
setNoCloseButton(true);
|
setNoCloseButton(true);
|
||||||
break;
|
break;
|
||||||
case GuideSessionState.USER_CREATE:
|
case GuideSessionState.USER_CREATE:
|
||||||
@ -67,7 +67,7 @@ export const GuideToolView: FC<{}> = props =>
|
|||||||
setNoCloseButton(true);
|
setNoCloseButton(true);
|
||||||
break;
|
break;
|
||||||
case GuideSessionState.USER_ONGOING:
|
case GuideSessionState.USER_ONGOING:
|
||||||
setHeaderText(LocalizeText('guide.help.request.user.ongoing.title', ['name'], [replacement]));
|
setHeaderText(LocalizeText('guide.help.request.user.ongoing.title', [ 'name' ], [ replacement ]));
|
||||||
setNoCloseButton(true);
|
setNoCloseButton(true);
|
||||||
break;
|
break;
|
||||||
case GuideSessionState.USER_FEEDBACK:
|
case GuideSessionState.USER_FEEDBACK:
|
||||||
@ -183,7 +183,7 @@ export const GuideToolView: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
const messageGroups = [...ongoingMessageGroups];
|
const messageGroups = [ ...ongoingMessageGroups ];
|
||||||
|
|
||||||
let lastGroup = messageGroups[messageGroups.length - 1];
|
let lastGroup = messageGroups[messageGroups.length - 1];
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ export const GuideToolView: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
const messageGroups = [...ongoingMessageGroups];
|
const messageGroups = [ ...ongoingMessageGroups ];
|
||||||
|
|
||||||
let lastGroup = messageGroups[messageGroups.length - 1];
|
let lastGroup = messageGroups[messageGroups.length - 1];
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ export const GuideToolView: FC<{}> = props =>
|
|||||||
|
|
||||||
lastGroup.addChat(new GuideToolMessage(parser.roomName, parser.roomId));
|
lastGroup.addChat(new GuideToolMessage(parser.roomName, parser.roomId));
|
||||||
setOngoingMessageGroups(messageGroups);
|
setOngoingMessageGroups(messageGroups);
|
||||||
}, [isOnDuty, ongoingMessageGroups, ongoingUserId]);
|
}, [ isOnDuty, ongoingMessageGroups, ongoingUserId ]);
|
||||||
|
|
||||||
UseMessageEventHook(GuideSessionInvitedToGuideRoomMessageEvent, onGuideSessionInvitedToGuideRoomMessageEvent);
|
UseMessageEventHook(GuideSessionInvitedToGuideRoomMessageEvent, onGuideSessionInvitedToGuideRoomMessageEvent);
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ export const GuideToolView: FC<{}> = props =>
|
|||||||
switch(parts[1])
|
switch(parts[1])
|
||||||
{
|
{
|
||||||
case 'tour':
|
case 'tour':
|
||||||
//Create Tour Request
|
//Create Tour Request
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
@ -299,15 +299,15 @@ export const GuideToolView: FC<{}> = props =>
|
|||||||
case 'toggle_duty':
|
case 'toggle_duty':
|
||||||
if(!isHandlingBullyReports && !isHandlingGuideRequests && !isHandlingHelpRequests)
|
if(!isHandlingBullyReports && !isHandlingGuideRequests && !isHandlingHelpRequests)
|
||||||
{
|
{
|
||||||
DispatchUiEvent(new NotificationAlertEvent([LocalizeText('guide.help.guide.tool.noqueueselected.message')], null, null, null, LocalizeText('guide.help.guide.tool.noqueueselected.caption'), null));
|
DispatchUiEvent(new NotificationAlertEvent([ LocalizeText('guide.help.guide.tool.noqueueselected.message') ], null, null, null, LocalizeText('guide.help.guide.tool.noqueueselected.caption'), null));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsOnDuty(v =>
|
setIsOnDuty(v =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new GuideSessionOnDutyUpdateMessageComposer(!v, v ? false : isHandlingGuideRequests, v ? false : isHandlingHelpRequests, v ? false : isHandlingBullyReports));
|
SendMessageComposer(new GuideSessionOnDutyUpdateMessageComposer(!v, v ? false : isHandlingGuideRequests, v ? false : isHandlingHelpRequests, v ? false : isHandlingBullyReports));
|
||||||
return !v;
|
return !v;
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case 'forum_link':
|
case 'forum_link':
|
||||||
@ -315,7 +315,7 @@ export const GuideToolView: FC<{}> = props =>
|
|||||||
window.open(url);
|
window.open(url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, [isHandlingBullyReports, isHandlingGuideRequests, isHandlingHelpRequests]);
|
}, [ isHandlingBullyReports, isHandlingGuideRequests, isHandlingHelpRequests ]);
|
||||||
|
|
||||||
if(!isVisible) return null;
|
if(!isVisible) return null;
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ export const GuideToolAcceptView: FC<GuideToolAcceptViewProps> = props =>
|
|||||||
</Column>
|
</Column>
|
||||||
<Column gap={ 1 }>
|
<Column gap={ 1 }>
|
||||||
<Button variant="success" onClick={ event => answerRequest(true) }>
|
<Button variant="success" onClick={ event => answerRequest(true) }>
|
||||||
{ LocalizeText('guide.help.request.guide.accept.accept.button') }
|
{ LocalizeText('guide.help.request.guide.accept.accept.button') }
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="danger" onClick={ event => answerRequest(false) }>
|
<Button variant="danger" onClick={ event => answerRequest(false) }>
|
||||||
{ LocalizeText('guide.help.request.guide.accept.skip.link') }
|
{ LocalizeText('guide.help.request.guide.accept.skip.link') }
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -83,27 +83,27 @@ export const GuideToolOngoingView: FC<GuideToolOngoingViewProps> = props =>
|
|||||||
<Column overflow="hidden" gap={ 1 } className="bg-muted rounded chat-messages p-2">
|
<Column overflow="hidden" gap={ 1 } className="bg-muted rounded chat-messages p-2">
|
||||||
<Column overflow="auto">
|
<Column overflow="auto">
|
||||||
{ messageGroups.map((group, index) =>
|
{ messageGroups.map((group, index) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<Flex fullWidth justifyContent={ isOwnChat(group.userId) ? 'end' : 'start' } gap={ 2 }>
|
<Flex key={ index } fullWidth justifyContent={ isOwnChat(group.userId) ? 'end' : 'start' } gap={ 2 }>
|
||||||
<Base shrink className="message-avatar">
|
<Base shrink className="message-avatar">
|
||||||
{ (!isOwnChat(group.userId)) &&
|
{ (!isOwnChat(group.userId)) &&
|
||||||
<LayoutAvatarImageView figure={ userFigure } direction={ 2 } /> }
|
<LayoutAvatarImageView figure={ userFigure } direction={ 2 } /> }
|
||||||
</Base>
|
</Base>
|
||||||
<Base className={ 'bg-light text-black border-radius mb-2 rounded py-1 px-2 messages-group-' + (isOwnChat(group.userId) ? 'right' : 'left') }>
|
<Base className={ 'bg-light text-black border-radius mb-2 rounded py-1 px-2 messages-group-' + (isOwnChat(group.userId) ? 'right' : 'left') }>
|
||||||
<Text bold>
|
<Text bold>
|
||||||
{ (isOwnChat(group.userId)) && GetSessionDataManager().userName }
|
{ (isOwnChat(group.userId)) && GetSessionDataManager().userName }
|
||||||
{ (!isOwnChat(group.userId)) && userName }
|
{ (!isOwnChat(group.userId)) && userName }
|
||||||
</Text>
|
</Text>
|
||||||
{ group.messages.map((chat, index) => <Base key={ index } className="text-break">{ chat.message }</Base>) }
|
{ group.messages.map((chat, index) => <Base key={ index } className="text-break">{ chat.message }</Base>) }
|
||||||
</Base>
|
</Base>
|
||||||
{ (isOwnChat(group.userId)) &&
|
{ (isOwnChat(group.userId)) &&
|
||||||
<Base className="message-avatar flex-shrink-0">
|
<Base className="message-avatar flex-shrink-0">
|
||||||
<LayoutAvatarImageView figure={ GetSessionDataManager().figure } direction={ 4 } />
|
<LayoutAvatarImageView figure={ GetSessionDataManager().figure } direction={ 4 } />
|
||||||
</Base> }
|
</Base> }
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
}) }
|
}) }
|
||||||
</Column>
|
</Column>
|
||||||
</Column>
|
</Column>
|
||||||
<Column gap={ 1 }>
|
<Column gap={ 1 }>
|
||||||
|
@ -90,7 +90,7 @@ export const HcCenterView: FC<{}> = props =>
|
|||||||
setIsVisible(!isVisible);
|
setIsVisible(!isVisible);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}, [isVisible]);
|
}, [ isVisible ]);
|
||||||
|
|
||||||
UseUiEvent(HcCenterEvent.TOGGLE_HC_CENTER, onHcCenterEvent);
|
UseUiEvent(HcCenterEvent.TOGGLE_HC_CENTER, onHcCenterEvent);
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ export const HcCenterView: FC<{}> = props =>
|
|||||||
AddEventLinkTracker(linkTracker);
|
AddEventLinkTracker(linkTracker);
|
||||||
|
|
||||||
return () => RemoveLinkEventTracker(linkTracker);
|
return () => RemoveLinkEventTracker(linkTracker);
|
||||||
}, [ linkReceived]);
|
}, [ linkReceived ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
@ -201,14 +201,17 @@ export const HcCenterView: FC<{}> = props =>
|
|||||||
<Popover id="popover-basic">
|
<Popover id="popover-basic">
|
||||||
<Popover.Body className="text-black py-2 px-3">
|
<Popover.Body className="text-black py-2 px-3">
|
||||||
<h5>{LocalizeText('hccenter.breakdown.title')}</h5>
|
<h5>{LocalizeText('hccenter.breakdown.title')}</h5>
|
||||||
<div>{LocalizeText('hccenter.breakdown.creditsspent', ['credits'], [kickbackData.totalCreditsSpent.toString()])}</div>
|
<div>{LocalizeText('hccenter.breakdown.creditsspent', [ 'credits' ], [ kickbackData.totalCreditsSpent.toString() ])}</div>
|
||||||
<div>{LocalizeText('hccenter.breakdown.paydayfactor.percent', ['percent'], [(kickbackData.kickbackPercentage * 100).toString()])}</div>
|
<div>{LocalizeText('hccenter.breakdown.paydayfactor.percent', [ 'percent' ], [ (kickbackData.kickbackPercentage * 100).toString() ])}</div>
|
||||||
<div>{LocalizeText('hccenter.breakdown.streakbonus', ['credits'], [kickbackData.creditRewardForStreakBonus.toString()])}</div>
|
<div>{LocalizeText('hccenter.breakdown.streakbonus', [ 'credits' ], [ kickbackData.creditRewardForStreakBonus.toString() ])}</div>
|
||||||
<hr className="w-100 text-black my-1" />
|
<hr className="w-100 text-black my-1" />
|
||||||
<div>{LocalizeText('hccenter.breakdown.total', ['credits', 'actual'], [getHcPaydayAmount(),
|
<div>{LocalizeText('hccenter.breakdown.total', [ 'credits', 'actual' ], [ getHcPaydayAmount(),
|
||||||
((((kickbackData.kickbackPercentage * kickbackData.totalCreditsSpent) + kickbackData.creditRewardForStreakBonus) * 100) / 100).toString()])}</div>
|
((((kickbackData.kickbackPercentage * kickbackData.totalCreditsSpent) + kickbackData.creditRewardForStreakBonus) * 100) / 100).toString() ])}</div>
|
||||||
<div className="btn btn-link text-primary p-0" onClick={() => { CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage']) }}>{
|
<div className="btn btn-link text-primary p-0" onClick={() =>
|
||||||
LocalizeText('hccenter.special.infolink')}
|
{
|
||||||
|
CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage'])
|
||||||
|
}}>{
|
||||||
|
LocalizeText('hccenter.special.infolink')}
|
||||||
</div>
|
</div>
|
||||||
</Popover.Body>
|
</Popover.Body>
|
||||||
</Popover>
|
</Popover>
|
||||||
@ -221,7 +224,10 @@ export const HcCenterView: FC<{}> = props =>
|
|||||||
<Column gap={ 1 }>
|
<Column gap={ 1 }>
|
||||||
<div className="hc-logo" />
|
<div className="hc-logo" />
|
||||||
<Flex>
|
<Flex>
|
||||||
<Button variant="success" onClick={ event => { CreateLinkEvent('catalog/open/' + GetConfiguration('catalog.links')['hc.buy_hc']) } }>
|
<Button variant="success" onClick={ event =>
|
||||||
|
{
|
||||||
|
CreateLinkEvent('catalog/open/' + GetConfiguration('catalog.links')['hc.buy_hc'])
|
||||||
|
} }>
|
||||||
{ LocalizeText((clubStatus === ClubStatus.ACTIVE) ? 'hccenter.btn.extend' : 'hccenter.btn.buy') }
|
{ LocalizeText((clubStatus === ClubStatus.ACTIVE) ? 'hccenter.btn.extend' : 'hccenter.btn.buy') }
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
@ -243,7 +249,10 @@ export const HcCenterView: FC<{}> = props =>
|
|||||||
<Column className="rounded-start bg-primary p-2 payday-special mb-1">
|
<Column className="rounded-start bg-primary p-2 payday-special mb-1">
|
||||||
<h4 className="mb-1">{LocalizeText('hccenter.special.title')}</h4>
|
<h4 className="mb-1">{LocalizeText('hccenter.special.title')}</h4>
|
||||||
<div>{LocalizeText('hccenter.special.info')}</div>
|
<div>{LocalizeText('hccenter.special.info')}</div>
|
||||||
<div className="btn btn-link text-white p-0 mt-auto align-self-baseline" onClick={() => { CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage']) }}>{LocalizeText('hccenter.special.infolink')}</div>
|
<div className="btn btn-link text-white p-0 mt-auto align-self-baseline" onClick={() =>
|
||||||
|
{
|
||||||
|
CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage'])
|
||||||
|
}}>{LocalizeText('hccenter.special.infolink')}</div>
|
||||||
</Column>
|
</Column>
|
||||||
<div className="payday flex-shrink-0 p-2">
|
<div className="payday flex-shrink-0 p-2">
|
||||||
<h5 className="mb-2 ms-2">{LocalizeText('hccenter.special.time.title')}</h5>
|
<h5 className="mb-2 ms-2">{LocalizeText('hccenter.special.time.title')}</h5>
|
||||||
@ -271,16 +280,22 @@ export const HcCenterView: FC<{}> = props =>
|
|||||||
<div className="rounded bg-success p-2 d-flex flex-row mb-0">
|
<div className="rounded bg-success p-2 d-flex flex-row mb-0">
|
||||||
<div>
|
<div>
|
||||||
<h4 className="mb-1">{LocalizeText('hccenter.gift.title')}</h4>
|
<h4 className="mb-1">{LocalizeText('hccenter.gift.title')}</h4>
|
||||||
<div dangerouslySetInnerHTML={{ __html: unclaimedGifts > 0 ? LocalizeText('hccenter.unclaimedgifts', ['unclaimedgifts'], [unclaimedGifts.toString()]) : LocalizeText('hccenter.gift.info') }}></div>
|
<div dangerouslySetInnerHTML={{ __html: unclaimedGifts > 0 ? LocalizeText('hccenter.unclaimedgifts', [ 'unclaimedgifts' ], [ unclaimedGifts.toString() ]) : LocalizeText('hccenter.gift.info') }}></div>
|
||||||
</div>
|
</div>
|
||||||
<button className="btn btn-primary btn-lg align-self-center ms-auto" onClick={() => { CreateLinkEvent('catalog/open/' + GetConfiguration('catalog.links')['hc.hc_gifts']) }}>{LocalizeText(clubStatus === ClubStatus.ACTIVE ? 'hccenter.btn.gifts.redeem' : 'hccenter.btn.gifts.view')}</button>
|
<button className="btn btn-primary btn-lg align-self-center ms-auto" onClick={() =>
|
||||||
|
{
|
||||||
|
CreateLinkEvent('catalog/open/' + GetConfiguration('catalog.links')['hc.hc_gifts'])
|
||||||
|
}}>{LocalizeText(clubStatus === ClubStatus.ACTIVE ? 'hccenter.btn.gifts.redeem' : 'hccenter.btn.gifts.view')}</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{GetConfiguration('hc.center')['benefits.info'] &&
|
{GetConfiguration('hc.center')['benefits.info'] &&
|
||||||
<div className="benefits text-black py-2">
|
<div className="benefits text-black py-2">
|
||||||
<h5 className="mb-1 text-primary">{LocalizeText('hccenter.general.title')}</h5>
|
<h5 className="mb-1 text-primary">{LocalizeText('hccenter.general.title')}</h5>
|
||||||
<div className="mb-2" dangerouslySetInnerHTML={{ __html: LocalizeText('hccenter.general.info') }} />
|
<div className="mb-2" dangerouslySetInnerHTML={{ __html: LocalizeText('hccenter.general.info') }} />
|
||||||
<button className="btn btn-link p-0 text-primary" onClick={() => { CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['benefits.habbopage']) }}>{LocalizeText('hccenter.general.infolink')}</button>
|
<button className="btn btn-link p-0 text-primary" onClick={() =>
|
||||||
|
{
|
||||||
|
CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['benefits.habbopage'])
|
||||||
|
}}>{LocalizeText('hccenter.general.infolink')}</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</NitroCardContentView>
|
</NitroCardContentView>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
export class BadgeResolver
|
export class BadgeResolver
|
||||||
{
|
{
|
||||||
public static default_badge: string = 'HC1';
|
public static default_badge: string = 'HC1';
|
||||||
public static badges: string[] = ['ACH_VipHC1', 'ACH_VipHC2', 'ACH_VipHC3', 'ACH_VipHC4', 'ACH_VipHC5', 'HC1', 'HC2', 'HC3', 'HC4', 'HC5'];
|
public static badges: string[] = [ 'ACH_VipHC1', 'ACH_VipHC2', 'ACH_VipHC3', 'ACH_VipHC4', 'ACH_VipHC5', 'HC1', 'HC2', 'HC3', 'HC4', 'HC5' ];
|
||||||
|
|
||||||
|
|
||||||
public static getClubBadge(k: string[]): string
|
public static getClubBadge(k: string[]): string
|
||||||
|
@ -104,7 +104,7 @@ export const HelpView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}, [helpReportState.currentStep]);
|
}, [ helpReportState.currentStep ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HelpContextProvider value={ { helpReportState, setHelpReportState } }>
|
<HelpContextProvider value={ { helpReportState, setHelpReportState } }>
|
||||||
|
@ -15,7 +15,7 @@ export const HelpIndexView: FC<{}> = props =>
|
|||||||
const reportState = Object.assign({}, helpReportState );
|
const reportState = Object.assign({}, helpReportState );
|
||||||
reportState.currentStep = 1;
|
reportState.currentStep = 1;
|
||||||
setHelpReportState(reportState);
|
setHelpReportState(reportState);
|
||||||
},[helpReportState, setHelpReportState]);
|
},[ helpReportState, setHelpReportState ]);
|
||||||
|
|
||||||
const onRequestMySanctionStatusClick = useCallback(() =>
|
const onRequestMySanctionStatusClick = useCallback(() =>
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user