mirror of https://github.com/buster-so/buster.git
favorite star persists
This commit is contained in:
parent
0c2cc33cc5
commit
636b4c89dd
|
@ -29,4 +29,5 @@ export interface BusterChatListItem {
|
|||
last_edited: string;
|
||||
latest_file_id: string | null;
|
||||
latest_file_type: 'metric' | 'dashboard';
|
||||
latest_version_number?: number;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import {
|
||||
ShareAssetType,
|
||||
VerificationStatus,
|
||||
type BusterChatListItem
|
||||
} from '@/api/asset_interfaces';
|
||||
import { ShareAssetType, type BusterChatListItem } from '@/api/asset_interfaces';
|
||||
import { makeHumanReadble, formatDate } from '@/lib';
|
||||
import React, { memo, useMemo, useRef, useState } from 'react';
|
||||
import { FavoriteStar } from '@/components/features/list';
|
||||
|
@ -38,18 +34,42 @@ export const ChatItemsContainer: React.FC<{
|
|||
const getLink = useMemoizedFn((chat: BusterChatListItem) => {
|
||||
if (chat.latest_file_id) {
|
||||
switch (chat.latest_file_type) {
|
||||
case 'metric':
|
||||
case 'metric': {
|
||||
const latestVersionNumber = chat.latest_version_number;
|
||||
|
||||
if (latestVersionNumber) {
|
||||
return createBusterRoute({
|
||||
route: BusterRoutes.APP_CHAT_ID_METRIC_ID_VERSION_NUMBER,
|
||||
chatId: chat.id,
|
||||
metricId: chat.latest_file_id,
|
||||
versionNumber: latestVersionNumber
|
||||
});
|
||||
}
|
||||
|
||||
return createBusterRoute({
|
||||
route: BusterRoutes.APP_CHAT_ID_METRIC_ID_CHART,
|
||||
chatId: chat.id,
|
||||
metricId: chat.latest_file_id
|
||||
});
|
||||
case 'dashboard':
|
||||
}
|
||||
case 'dashboard': {
|
||||
const latestVersionNumber = chat.latest_version_number;
|
||||
|
||||
if (latestVersionNumber) {
|
||||
return createBusterRoute({
|
||||
route: BusterRoutes.APP_CHAT_ID_DASHBOARD_ID_VERSION_NUMBER,
|
||||
chatId: chat.id,
|
||||
dashboardId: chat.latest_file_id,
|
||||
versionNumber: latestVersionNumber
|
||||
});
|
||||
}
|
||||
|
||||
return createBusterRoute({
|
||||
route: BusterRoutes.APP_CHAT_ID_DASHBOARD_ID,
|
||||
chatId: chat.id,
|
||||
dashboardId: chat.latest_file_id
|
||||
});
|
||||
}
|
||||
default:
|
||||
const _exhaustiveCheck: never = chat.latest_file_type;
|
||||
}
|
||||
|
@ -194,7 +214,7 @@ const TitleCell = React.memo<{ name: string; chatId: string }>(({ name, chatId }
|
|||
type={ShareAssetType.CHAT}
|
||||
iconStyle="tertiary"
|
||||
title={name}
|
||||
className="hidden! group-hover:flex!"
|
||||
className="opacity-0 group-hover:opacity-100"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -46,6 +46,7 @@ export const CollectionsIndividualHeader: React.FC<{
|
|||
id={collection.id}
|
||||
type={ShareAssetType.COLLECTION}
|
||||
title={collectionTitle}
|
||||
className="opacity-0 group-hover:opacity-100"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
|
Loading…
Reference in New Issue