diff --git a/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/collections/[collectionId]/loading.tsx b/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/collections/[collectionId]/loading.tsx new file mode 100644 index 000000000..02fb527af --- /dev/null +++ b/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/collections/[collectionId]/loading.tsx @@ -0,0 +1,5 @@ +import { FileIndeterminateLoader } from '@/components/features/FileIndeterminateLoader'; + +export default function Loading() { + return ; +} diff --git a/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/collections/[collectionId]/page.tsx b/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/collections/[collectionId]/page.tsx index 7d1e0b717..37badbf61 100644 --- a/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/collections/[collectionId]/page.tsx +++ b/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/collections/[collectionId]/page.tsx @@ -1,3 +1,3 @@ export default function Page() { - return <>; + return <>TODO: Collection Page; } diff --git a/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/dashboards/[dashboardId]/loading.tsx b/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/dashboards/[dashboardId]/loading.tsx new file mode 100644 index 000000000..02fb527af --- /dev/null +++ b/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/dashboards/[dashboardId]/loading.tsx @@ -0,0 +1,5 @@ +import { FileIndeterminateLoader } from '@/components/features/FileIndeterminateLoader'; + +export default function Loading() { + return ; +} diff --git a/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/datasets/[datasetId]/loading.tsx b/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/datasets/[datasetId]/loading.tsx new file mode 100644 index 000000000..02fb527af --- /dev/null +++ b/web/src/app/app/(primary_layout)/(chat_experience)/chats/[chatId]/datasets/[datasetId]/loading.tsx @@ -0,0 +1,5 @@ +import { FileIndeterminateLoader } from '@/components/features/FileIndeterminateLoader'; + +export default function Loading() { + return ; +} diff --git a/web/src/app/app/(primary_layout)/(chat_experience)/dashboards/[dashboardId]/loading.tsx b/web/src/app/app/(primary_layout)/(chat_experience)/dashboards/[dashboardId]/loading.tsx new file mode 100644 index 000000000..02fb527af --- /dev/null +++ b/web/src/app/app/(primary_layout)/(chat_experience)/dashboards/[dashboardId]/loading.tsx @@ -0,0 +1,5 @@ +import { FileIndeterminateLoader } from '@/components/features/FileIndeterminateLoader'; + +export default function Loading() { + return ; +} diff --git a/web/src/app/app/(primary_layout)/(chat_experience)/metrics/[metricId]/loading.tsx b/web/src/app/app/(primary_layout)/(chat_experience)/metrics/[metricId]/loading.tsx new file mode 100644 index 000000000..02fb527af --- /dev/null +++ b/web/src/app/app/(primary_layout)/(chat_experience)/metrics/[metricId]/loading.tsx @@ -0,0 +1,5 @@ +import { FileIndeterminateLoader } from '@/components/features/FileIndeterminateLoader'; + +export default function Loading() { + return ; +} diff --git a/web/src/components/features/buttons/ShareDashboardButton.tsx b/web/src/components/features/buttons/ShareDashboardButton.tsx index 513ac6299..c05545f17 100644 --- a/web/src/components/features/buttons/ShareDashboardButton.tsx +++ b/web/src/components/features/buttons/ShareDashboardButton.tsx @@ -4,15 +4,9 @@ import { ShareMenu } from '../ShareMenu'; import { ShareAssetType } from '@/api/asset_interfaces'; import { useGetDashboard } from '@/api/buster_rest/dashboards'; import { getShareAssetConfig } from '../ShareMenu/helpers'; -import { getIsEffectiveOwner } from '@/lib/share'; export const ShareDashboardButton = React.memo(({ dashboardId }: { dashboardId: string }) => { const { data: dashboardResponse } = useGetDashboard({ id: dashboardId }, getShareAssetConfig); - const isEffectiveOwner = getIsEffectiveOwner(dashboardResponse?.permission); - - if (!isEffectiveOwner) { - return null; - } return ( = React.memo(({}) => {
= React.memo( () => { const selectedFileView = useChatLayoutContextSelector((x) => x.selectedFileView); const selectedFileId = useChatIndividualContextSelector((x) => x.selectedFileId)!; + const dashboardId = selectedFileId; + + const { data: permission, error: dashboardError } = useGetDashboard( + { id: dashboardId }, + (x) => x.permission + ); + + if (dashboardError) return null; + + const isEditor = canEdit(permission); + const isEffectiveOwner = getIsEffectiveOwner(permission); return ( - - + {isEffectiveOwner && } + {isEditor && } @@ -42,15 +53,9 @@ const SaveToCollectionButton = React.memo(() => { }); SaveToCollectionButton.displayName = 'SaveToCollectionButton'; -const AddContentToDashboardButton = React.memo(({ dashboardId }: { dashboardId: string }) => { - const { data: permission } = useGetDashboard({ id: dashboardId }, (x) => x.permission); - const isEditor = canEdit(permission); +const AddContentToDashboardButton = React.memo(() => { const onOpenAddContentModal = useDashboardContentStore((x) => x.onOpenAddContentModal); - if (!isEditor) { - return null; - } - return (