Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create /chat page with existing social features #8195

Merged
merged 71 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
d74ce59
added route for chat
xr-dev-saurabh May 27, 2023
0678141
created home page for chat
xr-dev-saurabh Jun 9, 2023
eb33ebb
Completed chat UI
xr-dev-saurabh Jun 16, 2023
294dbf1
Resolved onclick event and added scroll for chat user
xr-dev-saurabh Jun 18, 2023
a649fbf
Added chat page in ui/src/components/
xr-dev-saurabh Jun 27, 2023
0a8973f
Merge branch 'dev' into chat-route
jerknose Jun 27, 2023
bd79381
New routing for chat page.
jerknose Jun 27, 2023
41b3598
Add back missing things?
jerknose Jun 27, 2023
96b0fec
Merge branch 'dev' of https://github.com/EtherealEngine/etherealengin…
HexaField Jun 28, 2023
1c5d29e
fix deps
HexaField Jun 28, 2023
f422ab4
fix deps
HexaField Jun 28, 2023
0e37ff6
Merge branch 'dev' of https://github.com/EtherealEngine/etherealengin…
HexaField Jun 30, 2023
981cc66
cleanup after merge
HexaField Jun 30, 2023
45cf1bd
cleanup after merge
HexaField Jun 30, 2023
ae0888b
Merge branch 'dev' into chat-route
jerknose Jul 15, 2023
23188de
populate party and friend lists with real data
HexaField Jul 16, 2023
71335b4
refactor lists
HexaField Jul 16, 2023
c0ee1c6
add friends list
HexaField Jul 16, 2023
5266087
chat almost works, start refactoring chat and channels
HexaField Jul 16, 2023
634cb00
migrate most channel usage
HexaField Jul 17, 2023
14c495d
location world and media instances work
HexaField Jul 17, 2023
3f365fe
more message stuff
HexaField Jul 17, 2023
ca0da36
stuff
HexaField Jul 18, 2023
e65ccaa
Merge branch 'dev' into chat-route
HexaField Jul 19, 2023
44452b6
Merge branch 'chat-route' into chat-route-channel-refactor
HexaField Jul 19, 2023
e9a449a
Merge branch 'dev' into chat-route
HexaField Jul 19, 2023
359fec0
channels are handled properly, messages populate in real time
HexaField Jul 19, 2023
e07da77
fix db association
HexaField Jul 19, 2023
6e26f36
Merge branch 'dev' into chat-route
HexaField Jul 20, 2023
3e33b3e
Merge branch 'dev' into chat-route
HexaField Jul 21, 2023
4a3571e
Custom figbird (#8332)
HexaField Jul 21, 2023
768ef79
figbird mutation types, channel state refactoring
HexaField Jul 21, 2023
7da2591
feathers hooks tests pass
HexaField Jul 21, 2023
a277994
Merge branch 'dev' into chat-route
HexaField Jul 21, 2023
4de38b3
refactoring channels, tests for channels and channel users
HexaField Jul 21, 2023
a8973bc
Merge branch 'dev' into chat-route
HexaField Jul 22, 2023
a95beb9
Merge branch 'dev' into chat-route
HexaField Jul 22, 2023
67f1085
fix auth issue
HexaField Jul 22, 2023
f4bd81c
detangle channel list from client-core channels service entirely
HexaField Jul 22, 2023
5af7d55
license
HexaField Jul 22, 2023
57c4b99
parties menu uses figbird and works correctly with channels
HexaField Jul 22, 2023
af9a4ae
Merge branch 'dev' into chat-route
HexaField Jul 22, 2023
73ae2bc
fix tests
HexaField Jul 22, 2023
6215e42
replace parties menu with messages menu, populate it and add media calls
HexaField Jul 23, 2023
3948f68
add startMediaCall to chat route
HexaField Jul 23, 2023
d752342
polish message UIs on location
HexaField Jul 24, 2023
b766954
refactor channels in admin, reactivity issues in feathers hooks
HexaField Jul 24, 2023
a6c5fa4
rewrite feathers hooks
HexaField Jul 25, 2023
6f4c129
Merge branch 'dev' into chat-route
HexaField Jul 25, 2023
bbb6181
add logging
HexaField Jul 25, 2023
7c5993e
update invites
HexaField Jul 25, 2023
e0c8d1a
Merge branch 'dev' into chat-route
HexaField Jul 25, 2023
d69c758
fixed Ui and added Video UI section
xr-dev-saurabh Jul 25, 2023
ce91755
fixed chat UI and added Video Call UI section
xr-dev-saurabh Jul 25, 2023
ff03976
fix recursive rerender issue with feathers hooks
HexaField Jul 25, 2023
d8e371c
hook up media to new UI
HexaField Jul 26, 2023
e747c77
bug and css tweak
HexaField Jul 26, 2023
d260c19
fix bugs finding and creating channels
HexaField Jul 26, 2023
2a8baa7
fix bug with channel create and friend reactivity
HexaField Jul 26, 2023
a8af285
stop creating message for new friend automatically
HexaField Jul 26, 2023
5cfaaff
cleanup channels after world instance server closes
HexaField Jul 26, 2023
8ba0acd
bug fixes, channel name fix, cleanup fixes
HexaField Jul 26, 2023
844dfbc
remove world list
HexaField Jul 26, 2023
6c0e508
fix check-errors failing
HexaField Jul 26, 2023
47c402d
update xru ifor chat
HexaField Jul 26, 2023
8295ab3
rework global typings
HexaField Jul 26, 2023
792a39d
fix tests
HexaField Jul 26, 2023
f2eafdd
Fixed Ui and added some extra features
xr-dev-saurabh Jul 26, 2023
58122c2
fix up mic button for other peers
HexaField Jul 26, 2023
50cf0ef
Merge branch 'dev' into chat-route
HexaField Jul 26, 2023
db030bb
cleanup logs
HexaField Jul 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 11 additions & 34 deletions __global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,17 @@ Ethereal Engine. All Rights Reserved.


/* eslint-disable no-unused-vars */
declare module '*.jpg' {
const value: any
export default value
}

declare module '*.png' {
const value: any
export default value
}

declare module '*.json' {
const value: any
export default value
}

declare module '*.wav' {
const value: any
export default value
}

declare module '*.glb' {
const value: any
export default value
}

declare module '*.frag' {
const value: any
export default value
}

declare module '*.vert' {
const value: any
export default value
}
declare module '*.jpg'
declare module '*.png'
declare module '*.svg'
declare module '*.scss'
declare module '*.scss?inline'
declare module '*.css'
declare module '*.json'
declare module '*.wav'
declare module '*.glb'
declare module '*.frag'
declare module '*.vert'

declare interface Element {
setAttribute(qualifiedName: string, value: Object): void
Expand Down
8 changes: 3 additions & 5 deletions packages/client-core/i18n/en/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,13 @@
"spawnPoint": "Spawn Point",
"deleteSelected": "Delete selected invites"
},
"party": {
"maxMembersRequired": "Atleast 2 members requires",
"channel": {
"instanceRequired": "Instance is required",
"instanceCantEmpty": "Instance can't be empty",
"instance": "Instance",
"maxMembers": "Max Members",
"createOne": "Create One",
"createParty": "Create Party",
"confirmPartyDelete": "Do you want to delete party?"
"createChannel": "Create Channel",
"confirmChannelDelete": "Do you want to delete channel?"
},
"project": {
"addProject": "Add Project",
Expand Down
2 changes: 2 additions & 0 deletions packages/client-core/i18n/en/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,11 @@
"friends": {
"find": "Find",
"friends": "Friends",
"messages": "Messages",
"blocked": "Blocked",
"message": "Message",
"profile": "Profile",
"call": "Call",
"accept": "Accept",
"decline": "Decline",
"unblock": "Unblock",
Expand Down
3 changes: 1 addition & 2 deletions packages/client-core/src/admin/adminRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ const AdminRoutes = () => {
user: false,
bot: false,
scene: false,
party: false,
groups: false,
channel: false,
instance: false,
invite: false,
globalAvatars: false,
Expand Down
6 changes: 2 additions & 4 deletions packages/client-core/src/admin/allowedRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ import { LoadingCircle } from '../components/LoadingCircle'
const Avatars = lazy(() => import('./components/Avatars'))
const Benchmarking = lazy(() => import('./components/Benchmarking'))
const BotSetting = lazy(() => import('./components/Bots'))
const Groups = lazy(() => import('./components/Group'))
const Instance = lazy(() => import('./components/Instance'))
const Invites = lazy(() => import('./components/Invite'))
const Locations = lazy(() => import('./components/Location'))
const Party = lazy(() => import('./components/Party'))
const Channels = lazy(() => import('./components/Channels'))
const Projects = lazy(() => import('./components/Project'))
const Recordings = lazy(() => import('./components/Recordings'))
const Resources = lazy(() => import('./components/Resources'))
Expand All @@ -48,12 +47,11 @@ const Users = lazy(() => import('./components/Users'))
const availableRoutes = [
{ route: '/avatars', key: 'globalAvatars', component: Avatars, props: {} },
{ route: '/benchmarking', key: 'benchmarking', component: Benchmarking, props: {} },
{ route: '/groups', key: 'groups', component: Groups, props: {} },
{ route: '/instance', key: 'instance', component: Instance, props: {} },
{ route: '/invites', key: 'invite', component: Invites, props: {} },
{ route: '/locations', key: 'location', component: Locations, props: {} },
{ route: '/routes', key: 'routes', component: RoutesComp, props: {} },
{ route: '/parties', key: 'party', component: Party, props: {} },
{ route: '/channel', key: 'channel', component: Channels, props: {} },
{ route: '/bots', key: 'bot', component: BotSetting, props: {} },
{ route: '/projects', key: 'projects', component: Projects, props: {} },
{ route: '/server', key: 'server', component: Server, props: {} },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ All portions of the code written by the Ethereal Engine team are Copyright © 20
Ethereal Engine. All Rights Reserved.
*/

export interface PartyPropsTable {
export interface ChannelPropsTable {
className?: string
search: string
}

export interface PartyColumn {
id: 'id' | 'maxMembers' | 'action'
export interface ChannelColumn {
id: 'id' | 'action' | 'name'
label: string
minWidth?: number
align?: 'right'
}

export const partyColumns: PartyColumn[] = [
export const channelColumns: ChannelColumn[] = [
{ id: 'id', label: 'ID', minWidth: 65 },
{ id: 'maxMembers', label: 'Max Members', minWidth: 65 },
{ id: 'name', label: 'Name', minWidth: 65 },
{
id: 'action',
label: 'Action',
Expand All @@ -46,10 +46,10 @@ export const partyColumns: PartyColumn[] = [
}
]

export interface PartyData {
export interface ChannelData {
el: any
id: string
instance?: string
maxMembers: number
name: string
action: any
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import React, { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'

import InputText from '@etherealengine/client-core/src/common/components/InputText'
import { Party } from '@etherealengine/common/src/interfaces/Party'
import { Channel } from '@etherealengine/common/src/interfaces/Channel'
import { getMutableState } from '@etherealengine/hyperflux'
import Button from '@etherealengine/ui/src/primitives/mui/Button'
import Container from '@etherealengine/ui/src/primitives/mui/Container'
Expand All @@ -39,54 +39,54 @@ import { NotificationService } from '../../../common/services/NotificationServic
import { AuthState } from '../../../user/services/AuthService'
import DrawerView from '../../common/DrawerView'
import { validateForm } from '../../common/validation/formValidation'
import { AdminPartyService } from '../../services/PartyService'
import { AdminChannelService } from '../../services/ChannelService'
import styles from '../../styles/admin.module.scss'

export enum PartyDrawerMode {
export enum ChannelDrawerMode {
Create,
ViewEdit
}

interface Props {
open: boolean
mode: PartyDrawerMode
selectedParty?: Party
mode: ChannelDrawerMode
selectedChannel?: Channel
onClose: () => void
}

const defaultState = {
maxMembers: 10,
name: '',
formErrors: {
maxMembers: ''
name: ''
}
}

const PartyDrawer = ({ open, mode, selectedParty, onClose }: Props) => {
const ChannelDrawer = ({ open, mode, selectedChannel, onClose }: Props) => {
const { t } = useTranslation()
const [editMode, setEditMode] = useState(false)
const [state, setState] = useState({ ...defaultState })

const user = useHookstate(getMutableState(AuthState)).user.value

const hasWriteAccess = user.scopes && user.scopes.find((item) => item.type === 'party:write')
const viewMode = mode === PartyDrawerMode.ViewEdit && !editMode
const hasWriteAccess = user.scopes && user.scopes.find((item) => item.type === 'channel:write')
const viewMode = mode === ChannelDrawerMode.ViewEdit && !editMode

useEffect(() => {
loadSelectedParty()
}, [selectedParty])
loadSelectedChannel()
}, [selectedChannel])

const loadSelectedParty = () => {
if (selectedParty) {
const loadSelectedChannel = () => {
if (selectedChannel) {
setState({
...defaultState,
maxMembers: selectedParty.maxMembers ?? 0
name: selectedChannel.name ?? 0
})
}
}

const handleCancel = () => {
if (editMode) {
loadSelectedParty()
loadSelectedChannel()
setEditMode(false)
} else handleClose()
}
Expand All @@ -102,8 +102,8 @@ const PartyDrawer = ({ open, mode, selectedParty, onClose }: Props) => {
let tempErrors = { ...state.formErrors }

switch (name) {
case 'maxMembers':
tempErrors.maxMembers = value < 2 ? t('admin:components.party.maxMembersRequired') : ''
case 'name':
tempErrors.name = value < 2 ? t('admin:components.channel.nameRequired') : ''
break
default:
break
Expand All @@ -114,21 +114,21 @@ const PartyDrawer = ({ open, mode, selectedParty, onClose }: Props) => {

const handleSubmit = async () => {
const data = {
maxMembers: state.maxMembers
name: state.name
}

let tempErrors = {
...state.formErrors,
maxMembers: state.maxMembers ? '' : t('admin:components.party.maxMembersRequired')
name: state.name ? '' : t('admin:components.channel.nameRequired')
}

setState({ ...state, formErrors: tempErrors })

if (validateForm(state, tempErrors)) {
if (mode === PartyDrawerMode.Create) {
await AdminPartyService.createAdminParty(data)
} else if (selectedParty) {
await AdminPartyService.patchParty(selectedParty.id!, data)
if (mode === ChannelDrawerMode.Create) {
await AdminChannelService.createAdminChannel(data)
} else if (selectedChannel) {
await AdminChannelService.patchChannel(selectedChannel.id!, data)
setEditMode(false)
}

Expand All @@ -142,18 +142,18 @@ const PartyDrawer = ({ open, mode, selectedParty, onClose }: Props) => {
<DrawerView open={open} onClose={onClose}>
<Container maxWidth="sm" className={styles.mt20}>
<DialogTitle className={styles.textAlign}>
{mode === PartyDrawerMode.Create && t('admin:components.party.createParty')}
{mode === PartyDrawerMode.ViewEdit &&
{mode === ChannelDrawerMode.Create && t('admin:components.channel.createChannel')}
{mode === ChannelDrawerMode.ViewEdit &&
editMode &&
`${t('admin:components.common.update')} ${selectedParty?.id}`}
{mode === PartyDrawerMode.ViewEdit && !editMode && `${selectedParty?.id}`}
`${t('admin:components.common.update')} ${selectedChannel?.id}`}
{mode === ChannelDrawerMode.ViewEdit && !editMode && `${selectedChannel?.id}`}
</DialogTitle>

<InputText
name="maxMembers"
label={t('admin:components.party.maxMembers')}
value={state.maxMembers}
error={state.formErrors.maxMembers}
name="name"
label={t('admin:components.channel.name')}
value={state.name}
error={state.formErrors.name}
disabled={viewMode}
onChange={handleChange}
/>
Expand All @@ -162,12 +162,12 @@ const PartyDrawer = ({ open, mode, selectedParty, onClose }: Props) => {
<Button className={styles.outlinedButton} onClick={handleCancel}>
{t('admin:components.common.cancel')}
</Button>
{(mode === PartyDrawerMode.Create || editMode) && (
{(mode === ChannelDrawerMode.Create || editMode) && (
<Button className={styles.gradientButton} onClick={handleSubmit}>
{t('admin:components.common.submit')}
</Button>
)}
{mode === PartyDrawerMode.ViewEdit && !editMode && (
{mode === ChannelDrawerMode.ViewEdit && !editMode && (
<Button className={styles.gradientButton} disabled={!hasWriteAccess} onClick={() => setEditMode(true)}>
{t('admin:components.common.edit')}
</Button>
Expand All @@ -178,4 +178,4 @@ const PartyDrawer = ({ open, mode, selectedParty, onClose }: Props) => {
)
}

export default PartyDrawer
export default ChannelDrawer
Loading