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 8 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
9 changes: 8 additions & 1 deletion packages/client-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@
"tick-tock": "^1.0.0",
"typescript": "5.0.2",
"util": "^0.12.5",
"uuid": "9.0.0"
"uuid": "9.0.0",
"pino": "^8.11.0",
HexaField marked this conversation as resolved.
Show resolved Hide resolved
"pino-pretty": "^10.0.0",
"postcss": "^8.4.21",
"qrcode.react": "^3.1.0",
"react-icons": "^4.9.0",
"react-json-view": "^1.21.3",
"tailwindcss": "^3.2.7"
},
"devDependencies": {
"@emotion/react": "11.10.6",
Expand Down
14 changes: 12 additions & 2 deletions packages/client/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const Engine = lazy(() => import('./engine'))

const AppPage = lazy(() => import('./pages/_app'))
const AdminPage = lazy(() => import('./pages/admin'))
const TailwindPage = lazy(() => import('./pages/_app_tw'))
const CapturePage = lazy(() => import('./pages/_app_tw'))
const ChatPage = lazy(() => import('./pages/_app_chat'))

const options = {
immediate: true,
Expand Down Expand Up @@ -93,7 +94,16 @@ const App = () => {
path={'/capture/*'}
element={
<Suspense fallback={<LoadingCircle message={t('common:loader.starting')} />}>
<TailwindPage />
<CapturePage />
</Suspense>
}
/>
<Route
key={'chat'}
path={'/chat/*'}
element={
<Suspense fallback={<LoadingCircle message={t('common:loader.starting')} />}>
<ChatPage />
</Suspense>
}
/>
Expand Down
149 changes: 149 additions & 0 deletions packages/client/src/pages/_app_chat.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
CPAL-1.0 License

The contents of this file are subject to the Common Public Attribution License
Version 1.0. (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://github.com/EtherealEngine/etherealengine/blob/dev/LICENSE.
The License is based on the Mozilla Public License Version 1.1, but Sections 14
and 15 have been added to cover use of software over a computer network and
provide for limited attribution for the Original Developer. In addition,
Exhibit A has been modified to be consistent with Exhibit B.

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
specific language governing rights and limitations under the License.

The Original Code is Ethereal Engine.

The Original Developer is the Initial Developer. The Initial Developer of the
Original Code is the Ethereal Engine team.

All portions of the code written by the Ethereal Engine team are Copyright © 2021-2023
Ethereal Engine. All Rights Reserved.
*/

// import * as chapiWalletPolyfill from 'credential-handler-polyfill'
import { SnackbarProvider } from 'notistack'
import React, { useCallback, useEffect, useRef, useState } from 'react'

import {
AdminClientSettingsState,
ClientSettingService
} from '@etherealengine/client-core/src/admin/services/Setting/ClientSettingService'
import { AdminCoilSettingService } from '@etherealengine/client-core/src/admin/services/Setting/CoilSettingService'
import { API } from '@etherealengine/client-core/src/API'
import { initGA, logPageView } from '@etherealengine/client-core/src/common/analytics'
import MetaTags from '@etherealengine/client-core/src/common/components/MetaTags'
// import { defaultAction } from '@etherealengine/client-core/src/common/components/NotificationActions'
import {
NotificationAction,
NotificationActions
} from '@etherealengine/client-core/src/common/services/NotificationService'
import { ProjectService, ProjectState } from '@etherealengine/client-core/src/common/services/ProjectService'
import Debug from '@etherealengine/client-core/src/components/Debug'
import { AuthState } from '@etherealengine/client-core/src/user/services/AuthService'
import { AudioEffectPlayer } from '@etherealengine/engine/src/audio/systems/MediaSystem'
import { matches } from '@etherealengine/engine/src/common/functions/MatchesUtils'
import { Engine } from '@etherealengine/engine/src/ecs/classes/Engine'
import { addActionReceptor, getMutableState, removeActionReceptor, useHookstate } from '@etherealengine/hyperflux'
import { loadWebappInjection } from '@etherealengine/projects/loadWebappInjection'

import EngineTW from '../engine_tw'
import ChatComp from '../route/chat'
import { ThemeContextProvider } from '../themes/themeContext'

const AppPage = () => {
const notistackRef = useRef<SnackbarProvider>()
const authState = useHookstate(getMutableState(AuthState))
const selfUser = authState.user
const clientSettingState = useHookstate(getMutableState(AdminClientSettingsState))
const [projectComponents, setProjectComponents] = useState<Array<any>>([])
const [fetchedProjectComponents, setFetchedProjectComponents] = useState(false)
const projectState = useHookstate(getMutableState(ProjectState))

const initApp = useCallback(() => {
initGA()
logPageView()
}, [])

useEffect(() => {
const receptor = (action): any => {
// @ts-ignore
matches(action).when(NotificationAction.notify.matches, (action) => {
AudioEffectPlayer.instance.play(AudioEffectPlayer.SOUNDS.alert, 0.5)
notistackRef.current?.enqueueSnackbar(action.message, {
variant: action.options.variant,
action: NotificationActions[action.options.actionType ?? 'default']
})
})
}
addActionReceptor(receptor)

return () => {
removeActionReceptor(receptor)
}
}, [])

useEffect(initApp, [])

// useEffect(() => {
// chapiWalletPolyfill
// .loadOnce()
// .then(() => console.log('CHAPI wallet polyfill loaded.'))
// .catch((e) => console.error('Error loading polyfill:', e))
// }, [])

useEffect(() => {
if (selfUser?.id.value && projectState.updateNeeded.value) {
ProjectService.fetchProjects()
if (!fetchedProjectComponents) {
setFetchedProjectComponents(true)
API.instance.client
.service('projects')
.find()
.then((projects) => {
loadWebappInjection(projects).then((result) => {
setProjectComponents(result)
})
})
}
}
}, [selfUser, projectState.updateNeeded.value])

useEffect(() => {
Engine.instance.userId = selfUser.id.value
}, [selfUser.id])

useEffect(() => {
authState.isLoggedIn.value && AdminCoilSettingService.fetchCoil()
}, [authState.isLoggedIn])

useEffect(() => {
if (clientSettingState?.updateNeeded?.value) ClientSettingService.fetchClientSettings()
}, [clientSettingState?.updateNeeded?.value])

return (
<>
<div className="w-full h-full container mx-auto overflow-y-scroll pointer-events-auto">
<ChatComp />
</div>
{projectComponents.map((Component, i) => (
<Component key={i} />
))}
</>
)
}

const TailwindPage = () => {
return (
<EngineTW>
<ThemeContextProvider>
<AppPage />
<Debug />
</ThemeContextProvider>
</EngineTW>
)
}

export default TailwindPage
51 changes: 51 additions & 0 deletions packages/client/src/pages/chat/chat.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
CPAL-1.0 License

The contents of this file are subject to the Common Public Attribution License
Version 1.0. (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://github.com/EtherealEngine/etherealengine/blob/dev/LICENSE.
The License is based on the Mozilla Public License Version 1.1, but Sections 14
and 15 have been added to cover use of software over a computer network and
provide for limited attribution for the Original Developer. In addition,
Exhibit A has been modified to be consistent with Exhibit B.

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
specific language governing rights and limitations under the License.

The Original Code is Ethereal Engine.

The Original Developer is the Initial Developer. The Initial Developer of the
Original Code is the Ethereal Engine team.

All portions of the code written by the Ethereal Engine team are Copyright © 2021-2023
Ethereal Engine. All Rights Reserved.
*/

import React from 'react'

import { ChatSection } from '@etherealengine/ui/src/components/Chat/ChatSection'
import { Media } from '@etherealengine/ui/src/components/Chat/Media'
import { Message } from '@etherealengine/ui/src/components/Chat/Message'
import { Sidebar } from '@etherealengine/ui/src/components/Chat/Sidebar'

import './index.css'

import EngineTW from '@etherealengine/client/src/engine_tw'
import { ThemeContextProvider } from '@etherealengine/client/src/themes/themeContext'

export default function Chat() {
return (
<EngineTW>
<ThemeContextProvider>
<div className="w-full h-[100%] flex bg-slate-600 pointer">
<Sidebar />
<ChatSection />
<Message />
<Media />
</div>
</ThemeContextProvider>
</EngineTW>
)
}
11 changes: 11 additions & 0 deletions packages/client/src/pages/chat/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

.hide-scroll::-webkit-scrollbar {
display: none;
}

.pointer {
pointer-events: auto
}
Loading