Skip to content

Commit

Permalink
AppAvatar
Browse files Browse the repository at this point in the history
  • Loading branch information
chatbookai committed Jun 2, 2024
1 parent 2538953 commit 96dc2c7
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/functions/ChatBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,6 @@ export function downloadJson(JsonData: any, FileName: string) {
}

export function AppAvatar(backEndApiChatBook: string, avatar: string) {
console.log("backEndApiChatBook", avatar)
if(avatar.startsWith('http')) {

return avatar
Expand Down
3 changes: 2 additions & 1 deletion src/views/app/chat/ChatContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import authConfig from 'src/configs/auth'
import ChatLog from './ChatLog'
import { useTranslation } from 'react-i18next'
import SendMsgForm from 'src/views/app/chat/SendMsgForm'
import { AppAvatar } from 'src/functions/ChatBook'

const ChatContent = (props: any) => {
// ** Props
Expand Down Expand Up @@ -93,7 +94,7 @@ const ChatContent = (props: any) => {
}
>
<MuiAvatar
src={authConfig.backEndApiChatBook + '/api/avatarforapp/' + app.avatar}
src={AppAvatar(authConfig.backEndApiChatBook, app.avatar)}
alt={chatName}
sx={{ width: '2rem', height: '2rem' }}
/>
Expand Down
3 changes: 2 additions & 1 deletion src/views/app/chat/ChatLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import PerfectScrollbarComponent, { ScrollBarProps } from 'react-perfect-scrollb

// ** Custom Components Imports
import CustomAvatar from 'src/@core/components/mui/avatar'
import { AppAvatar } from 'src/functions/ChatBook'

// ** Types Imports
import {
Expand Down Expand Up @@ -337,7 +338,7 @@ const ChatLog = (props: any) => {
fontSize: '0.875rem',
}}
{...{
src: app.avatar? authConfig.backEndApiChatBook + '/api/avatarforapp/' + app.avatar : '/images/avatars/1.png',
src: app.avatar? AppAvatar(authConfig.backEndApiChatBook, app.avatar) : '/images/avatars/1.png',
alt: chatName
}}
>
Expand Down
3 changes: 2 additions & 1 deletion src/views/app/edit/SimpleEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import authConfig from 'src/configs/auth'

// ** Axios Imports
import { useRouter } from 'next/router'
import { AppAvatar } from 'src/functions/ChatBook'

// ** Icon Imports
import Icon from 'src/@core/components/icon'
Expand Down Expand Up @@ -126,7 +127,7 @@ const SimpleEdit = (props: any) => {
</Box>
) : (
<Box sx={{alignItems: 'center'}}>
<Img alt={`${t(`Upload Avatar image`)}`} src={authConfig.backEndApiChatBook + '/api/avatarforapp/' + app.avatar} sx={{width: '100%', borderRadius: '25px'}}/>
<Img alt={`${t(`Upload Avatar image`)}`} src={AppAvatar(authConfig.backEndApiChatBook, app.avatar)} sx={{width: '100%', borderRadius: '25px'}}/>
</Box>
)}
</Box>
Expand Down
3 changes: 2 additions & 1 deletion src/views/app/my/MyAppModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { useRouter } from 'next/router'
import Icon from 'src/@core/components/icon'

import { useTranslation } from 'react-i18next'
import { AppAvatar } from 'src/functions/ChatBook'


const AppModel = (props: any) => {
Expand Down Expand Up @@ -144,7 +145,7 @@ const AppModel = (props: any) => {
sx={{cursor: 'pointer'}}
>
<Box display="flex" alignItems="center">
<Avatar src={authConfig.backEndApiChatBook + '/api/avatarforapp/' + item.avatar} sx={{ mr: 3, width: 35, height: 35 }} />
<Avatar src={AppAvatar(authConfig.backEndApiChatBook, item.avatar)} sx={{ mr: 3, width: 35, height: 35 }} />
<Typography
sx={{
fontWeight: 500,
Expand Down
3 changes: 2 additions & 1 deletion src/views/system/applications/Applications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { yupResolver } from '@hookform/resolvers/yup'
// ** Next Import
import { useRouter } from 'next/router'
import { useAuth } from 'src/hooks/useAuth'
import { AppAvatar } from 'src/functions/ChatBook'

// ** Icon Imports
import Icon from 'src/@core/components/icon'
Expand Down Expand Up @@ -166,7 +167,7 @@ const Applications = () => {
filterable: false,
renderCell: ({ row }: any) => {
return (
<Avatar src={authConfig.backEndApiChatBook + '/api/avatarforapp/' + row.avatar} variant="rounded" sx={{ width: '38px', height: '38px', borderRadius: '25px'}} />
<Avatar src={AppAvatar(authConfig.backEndApiChatBook, row.avatar)} variant="rounded" sx={{ width: '38px', height: '38px', borderRadius: '25px'}} />
)
}
},
Expand Down

0 comments on commit 96dc2c7

Please sign in to comment.