Skip to content

Commit

Permalink
feat: web ui update (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
QinZhen001 authored Aug 13, 2024
1 parent b1b77e0 commit 51b73ed
Show file tree
Hide file tree
Showing 118 changed files with 2,756 additions and 2,111 deletions.
7 changes: 5 additions & 2 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
"@reduxjs/toolkit": "^2.2.3",
"antd": "^5.15.3",
"@ant-design/icons": "^5.3.7",
"agora-rtc-sdk-ng": "^4.21.0"
"agora-rtc-sdk-ng": "^4.21.0",
"react-colorful": "^5.6.1"
},
"devDependencies": {
"@minko-fe/postcss-pxtoviewport": "^1.3.2",
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
Expand All @@ -34,5 +36,6 @@
"sass": "^1.77.5",
"@svgr/webpack": "^8.1.0",
"protobufjs-cli": "^1.1.2"
}
},
"packageManager": "[email protected]+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
}
5 changes: 5 additions & 0 deletions playground/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module.exports = {
plugins: {
autoprefixer: {},
"@minko-fe/postcss-pxtoviewport": {
viewportWidth: 375,
exclude: /node_modules/,
include: /\/src\/platform\/mobile\//,
}
},
}
18 changes: 15 additions & 3 deletions playground/src/css/globals.css → playground/src/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ html,
body {
background-color: #0F0F11;
font-family: "PingFang SC";
width: 100vw;
height: 100vh;
overflow: auto;
}

a {
Expand Down Expand Up @@ -51,3 +48,18 @@ a {
color: var(--Grey-300, #EAECF0) !important;
}


.ant-popover-inner {
/* width: 260px !important; */
background: #1E2025 !important;
}


.ant-select-selection-placeholder {
color: var(--Grey-600, #667085) !important;
}


.ant-empty-description {
color: var(--Grey-600, #667085) !important;
}
70 changes: 0 additions & 70 deletions playground/src/app/home/index.module.scss

This file was deleted.

79 changes: 9 additions & 70 deletions playground/src/app/home/page.tsx
Original file line number Diff line number Diff line change
@@ -1,84 +1,23 @@
"use client"

import { useMemo, useState, useRef, useEffect } from "react"
import dynamic from "next/dynamic";
import Chat from "@/components/chat"
import Setting from "@/components/setting"
import AuthInitializer from "@/components/authInitializer"
import Menu from "@/components/menu"
const Rtc = dynamic(() => import("@/components/rtc"), {
import { isMobile } from "@/common"
import dynamic from 'next/dynamic'

const PCEntry = dynamic(() => import('@/platform/pc/entry'), {
ssr: false,
});
const Header = dynamic(() => import("@/components/header"), {
})

const MobileEntry = dynamic(() => import('@/platform/mobile/entry'), {
ssr: false,
});
import { useSmallScreen, useAppSelector } from "@/common"
import styles from "./index.module.scss"
})

export default function Home() {
const chatItems = useAppSelector(state => state.global.chatItems)
const wrapperRef = useRef<HTMLDivElement | null>(null)
const [activeMenu, setActiveMenu] = useState("Settings")
const { isSmallScreen } = useSmallScreen()

useEffect(() => {
if (!wrapperRef.current) {
return
}
if (!isSmallScreen) {
return
}
wrapperRef.current.scrollTop = wrapperRef.current.scrollHeight
}, [isSmallScreen, chatItems])

const onMenuChange = (item: string) => {
setActiveMenu(item)
}

return (
<AuthInitializer>
<main className={styles.home} style={{
minHeight: isSmallScreen ? "auto" : "830px"
}}>
<Header></Header>
{isSmallScreen ?
<div className={styles.smallScreen}>
<div className={styles.menuWrapper}>
<Menu onChange={onMenuChange}></Menu>
</div>
<div className={styles.bodyWrapper}>
<div className={styles.item} style={{
visibility: activeMenu == "Agent" ? "visible" : "hidden",
zIndex: activeMenu == "Agent" ? 1 : -1
}}>
<Rtc></Rtc>
</div>
<div className={styles.item}
ref={wrapperRef}
style={{
visibility: activeMenu == "Chat" ? "visible" : "hidden",
zIndex: activeMenu == "Chat" ? 1 : -1
}}>
<Chat></Chat>
</div>
<div className={styles.item} style={{
visibility: activeMenu == "Settings" ? "visible" : "hidden",
zIndex: activeMenu == "Settings" ? 1 : -1
}}>
<Setting></Setting>
</div>
</div>
</div>
:
<div className={styles.content} suppressHydrationWarning={true}>
<Rtc></Rtc>
<Chat></Chat>
<Setting></Setting>
</div>
}
</main>
{isMobile() ? <MobileEntry></MobileEntry> : <PCEntry></PCEntry>}
</AuthInitializer >

);
}

Expand Down
4 changes: 3 additions & 1 deletion playground/src/app/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ $shadows-big: multiple-box-shadow(100);


.login {
position: relative;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: hidden;
Expand Down
3 changes: 2 additions & 1 deletion playground/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ConfigProvider } from "antd"
import { StoreProvider } from "@/store";
import "@/css/globals.css";
import type { Metadata, Viewport } from "next";

import './global.css'


export const metadata: Metadata = {
title: "Ai Agent",
Expand Down
17 changes: 17 additions & 0 deletions playground/src/assets/color_picker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions playground/src/assets/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 44 additions & 24 deletions playground/src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions playground/src/assets/logo_small.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions playground/src/assets/pdf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions playground/src/assets/voice.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 51b73ed

Please sign in to comment.