mirror of https://github.com/buster-so/buster.git
Merge pull request #288 from buster-so/big-nate/bus-1172-need-to-be-able-to-add-a-chat-to-favorites-from-within-a
Add favorite link to chat dropdown
This commit is contained in:
commit
b07ef2e0a0
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "buster_server"
|
||||
version = "0.1.1"
|
||||
version = "0.1.3"
|
||||
edition = "2021"
|
||||
default-run = "buster_server"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "buster-cli"
|
||||
version = "0.1.1"
|
||||
version = "0.1.3"
|
||||
edition = "2021"
|
||||
build = "build.rs"
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
"api_tag": "api/v0.1.1",
|
||||
"api_version": "0.1.1",
|
||||
"web_tag": "web/v0.1.1",
|
||||
"web_version": "0.1.1",
|
||||
"cli_tag": "cli/v0.1.1",
|
||||
"cli_version": "0.1.1"
|
||||
"api_tag": "api/v0.1.3", "api_version": "0.1.3"
|
||||
,
|
||||
"web_tag": "web/v0.1.3", "web_version": "0.1.3"
|
||||
,
|
||||
"cli_tag": "cli/v0.1.3", "cli_version": "0.1.3"
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "web",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "web",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.3",
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "web",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.3",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --turbo",
|
||||
|
|
|
@ -99,7 +99,10 @@ test('Bar chart span clicking works', async ({ page }) => {
|
|||
await page.waitForTimeout(55);
|
||||
await expect(page.getByText('Copy SQLSaveRun')).toBeVisible();
|
||||
await page.getByTestId('segmented-trigger-file').click();
|
||||
await page.waitForTimeout(55);
|
||||
await page.waitForTimeout(2500);
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForLoadState('domcontentloaded');
|
||||
await page.waitForLoadState('load');
|
||||
|
||||
await expect(
|
||||
page.getByText('Yearly Sales Revenue - Signature Cycles Products (Last 3 Years + YTD)', {
|
||||
|
|
|
@ -101,12 +101,10 @@ export const BusterChartJSComponent = React.memo(
|
|||
barShowTotalAtTop,
|
||||
datasetOptions,
|
||||
xAxisKeys: selectedAxis.x,
|
||||
tooltipKeys,
|
||||
sizeKey: (selectedAxis as ScatterAxis).size,
|
||||
columnMetadata,
|
||||
scatterDotSize,
|
||||
lineGroupType,
|
||||
categoryKeys: (selectedAxis as ScatterAxis).category,
|
||||
trendlineSeries,
|
||||
barGroupType
|
||||
});
|
||||
|
|
|
@ -23,8 +23,6 @@ export interface UseSeriesOptionsProps {
|
|||
y2AxisKeys: string[];
|
||||
yAxisKeys: string[];
|
||||
xAxisKeys: string[];
|
||||
categoryKeys: ScatterAxis['category'];
|
||||
tooltipKeys: string[];
|
||||
sizeKey: ScatterAxis['size'];
|
||||
columnSettings: NonNullable<BusterChartConfigProps['columnSettings']>;
|
||||
columnLabelFormats: NonNullable<BusterChartConfigProps['columnLabelFormats']>;
|
||||
|
@ -42,7 +40,6 @@ export const useSeriesOptions = ({
|
|||
trendlineSeries,
|
||||
columnMetadata,
|
||||
selectedChartType,
|
||||
tooltipKeys,
|
||||
colors,
|
||||
yAxisKeys,
|
||||
y2AxisKeys,
|
||||
|
@ -53,7 +50,6 @@ export const useSeriesOptions = ({
|
|||
sizeKey,
|
||||
scatterDotSize,
|
||||
lineGroupType,
|
||||
categoryKeys,
|
||||
barShowTotalAtTop,
|
||||
barGroupType
|
||||
}: UseSeriesOptionsProps): ChartProps<ChartJSChartType>['data'] => {
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
import { Dropdown, DropdownItems } from '@/components/ui/dropdown';
|
||||
import React, { useMemo } from 'react';
|
||||
import { useChatIndividualContextSelector } from '../../../ChatContext';
|
||||
import { Copy, Trash, Pencil, DuplicatePlus } from '@/components/ui/icons';
|
||||
import { useDeleteChat, useDuplicateChat } from '@/api/buster_rest/chats';
|
||||
import { Copy, Trash, Pencil, DuplicatePlus, Star } from '@/components/ui/icons';
|
||||
import { Star as StarFilled } from '@/components/ui/icons/NucleoIconFilled';
|
||||
import { useDeleteChat, useDuplicateChat, useGetChat } from '@/api/buster_rest/chats';
|
||||
import { CHAT_HEADER_TITLE_ID } from '../ChatHeaderTitle';
|
||||
import { timeout } from '@/lib';
|
||||
import { BusterRoutes } from '@/routes';
|
||||
import { useAppLayoutContextSelector } from '@/context/BusterAppLayout';
|
||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||
import { assetParamsToRoute } from '@/lib/assets';
|
||||
import { useFavoriteStar } from '@/components/features/list';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces/share';
|
||||
|
||||
export const ChatContainerHeaderDropdown: React.FC<{
|
||||
children: React.ReactNode;
|
||||
|
@ -21,6 +24,13 @@ export const ChatContainerHeaderDropdown: React.FC<{
|
|||
const currentMessageId = useChatIndividualContextSelector((state) => state.currentMessageId);
|
||||
const selectedFileId = useChatIndividualContextSelector((state) => state.selectedFileId);
|
||||
const selectedFileType = useChatIndividualContextSelector((state) => state.selectedFileType);
|
||||
const { data: chatTitle } = useGetChat({ id: chatId || '' }, { select: (x) => x.title, enabled: !!chatId });
|
||||
|
||||
const { isFavorited, onFavoriteClick } = useFavoriteStar({
|
||||
id: chatId || '',
|
||||
type: ShareAssetType.CHAT,
|
||||
name: chatTitle || ''
|
||||
});
|
||||
|
||||
const menuItem: DropdownItems = useMemo(() => {
|
||||
return [
|
||||
|
@ -78,9 +88,25 @@ export const ChatContainerHeaderDropdown: React.FC<{
|
|||
input.select();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: isFavorited ? 'Remove from favorites' : 'Add to favorites',
|
||||
value: 'add-to-favorites',
|
||||
icon: isFavorited ? <StarFilled /> : <Star />,
|
||||
onClick: onFavoriteClick
|
||||
}
|
||||
];
|
||||
}, [chatId, isDeleting, currentMessageId, deleteChat, duplicateChat]);
|
||||
}, [
|
||||
chatId,
|
||||
isDeleting,
|
||||
isDuplicating,
|
||||
currentMessageId,
|
||||
deleteChat,
|
||||
duplicateChat,
|
||||
isFavorited,
|
||||
onFavoriteClick,
|
||||
openSuccessMessage
|
||||
]);
|
||||
|
||||
return (
|
||||
<Dropdown align="end" items={menuItem}>
|
||||
|
|
Loading…
Reference in New Issue