Skip to content

Commit 1390de5

Browse files
author
Bogdan Tsechoev
committed
Merge branch 'private_chats_in_chats_list' into 'master'
Bot UI: Display private chats within the organization See merge request postgres-ai/database-lab!900
2 parents 3002c3f + b12a07f commit 1390de5

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

ui/packages/platform/src/api/bot/getChats.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const getChats = async (req: Req): Promise<{ response: BotMessage[] | nul
1111
const apiServer = process.env.REACT_APP_API_URL_PREFIX || '';
1212

1313
try {
14-
const response = await request(`${apiServer}/chats${query ? query : ''}`, {
14+
const response = await request(`${apiServer}/chats_auth${query ? query : ''}`, {
1515
method: 'GET',
1616
});
1717

ui/packages/platform/src/pages/Bot/ChatsList/ChatsList.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import React from "react";
99
import { Link } from "react-router-dom";
1010
import { useParams } from "react-router";
1111
import cn from "classnames";
12-
import { makeStyles, Theme, useMediaQuery } from "@material-ui/core";
12+
import { ListItem, ListItemIcon, makeStyles, Theme, useMediaQuery } from "@material-ui/core";
1313
import Drawer from '@material-ui/core/Drawer';
1414
import List from "@material-ui/core/List";
1515
import Divider from "@material-ui/core/Divider";
1616
import ListSubheader from '@material-ui/core/ListSubheader';
1717
import Box from "@mui/material/Box";
1818
import { Spinner } from "@postgres.ai/shared/components/Spinner";
1919
import { HeaderButtons, HeaderButtonsProps } from "../HeaderButtons/HeaderButtons";
20-
import { BotMessage } from "../../../types/api/entities/bot";
2120
import { theme } from "@postgres.ai/shared/styles/theme";
2221
import { useAiBot } from "../hooks";
22+
import VisibilityOffIcon from '@material-ui/icons/VisibilityOff';
2323

2424

2525
const useStyles = makeStyles<Theme, ChatsListProps>((theme) => ({
@@ -73,13 +73,23 @@ const useStyles = makeStyles<Theme, ChatsListProps>((theme) => ({
7373
whiteSpace: 'nowrap',
7474
textDecoration: "none",
7575
flex: '0 0 2.5rem',
76+
display: 'block',
7677
'&:hover': {
7778
background: 'rgba(0, 0, 0, 0.04)'
79+
},
80+
'&:focus': {
81+
outline: 'none',
82+
background: 'rgba(0, 0, 0, 0.04)'
7883
}
7984
},
8085
listItemLinkActive: {
8186
background: 'rgba(0, 0, 0, 0.04)'
8287
},
88+
listItemIcon: {
89+
transform: 'translateY(2px)',
90+
marginRight: 2,
91+
minWidth: 'auto',
92+
},
8393
loader: {
8494
width: '100%',
8595
height: '100%',
@@ -165,15 +175,22 @@ export const ChatsList = (props: ChatsListProps) => {
165175
const isActive = item.id === params.threadId
166176
const link = linkBuilder(item.id)
167177
return (
168-
<Link
178+
<ListItem
179+
component={Link}
169180
to={link}
170181
key={item.id}
171182
className={cn(classes.listItemLink, {[classes.listItemLinkActive]: isActive})}
172183
id={item.id}
173184
onClick={() => handleClick(item.id)}
185+
autoFocus={isActive}
174186
>
187+
<ListItemIcon
188+
className={classes.listItemIcon}
189+
title={item.is_public ? 'This thread is public' : 'This thread is private'}>
190+
{!item.is_public && <VisibilityOffIcon />}
191+
</ListItemIcon>
175192
{item.content}
176-
</Link>
193+
</ListItem>
177194
)
178195
})
179196
}

0 commit comments

Comments
 (0)