Files
discord-decomp/modules/guild_rooms/GuildRoomUtils.tsx
T
2026-11-01 12:12:55 +02:00

44 lines
1.3 KiB
TypeScript

// Metro module 12814 (f12815).
import { GuildRoomObjectTypes } from "./GuildRoomTypes";
const serverGuildRoomObjectToClient = function serverGuildRoomObjectToClient(a0) {
return a0.object_type === GuildRoomObjectTypes.PLANT ? {
objectType: GuildRoomObjectTypes.PLANT,
...{
objectId: a0.object_id,
createdBy: a0.created_by,
updatedAt: a0.updated_at != null ? new Date(a0.updated_at) : void 0,
updatedBy: a0.updated_by
}
} : {
objectType: GuildRoomObjectTypes.NOTE,
...{
objectId: a0.object_id,
createdBy: a0.created_by,
updatedAt: a0.updated_at != null ? new Date(a0.updated_at) : void 0,
updatedBy: a0.updated_by
},
content: a0.content,
position: a0.position
};
};
export function serverGuildRoomToClient(a0) {
return {
roomId: a0.room_id,
users: a0.users.reduce((acc, user) => {
acc.set(user.user_id, {
userId: user.user_id,
position: user.position,
statusId: user.status_id,
statusText: user.status_text
});
return acc;
}, new Map()),
background: a0.background,
objects: Object.entries(a0.objects).reduce((acc, item) => {
const [r24, r8] = item;
acc.set(+r24, r8.map(serverGuildRoomObjectToClient));
return acc;
}, new Map())
};
}