favorite star persists

This commit is contained in:
Nate Kelley 2025-04-14 12:43:19 -06:00
parent 0c2cc33cc5
commit 636b4c89dd
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 30 additions and 8 deletions

View File

@ -29,4 +29,5 @@ export interface BusterChatListItem {
last_edited: string;
latest_file_id: string | null;
latest_file_type: 'metric' | 'dashboard';
latest_version_number?: number;
}

View File

@ -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>

View File

@ -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>
)}