share menu updates

This commit is contained in:
Nate Kelley 2025-03-17 16:38:25 -06:00
parent c5fb34228f
commit 0e2b655653
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
4 changed files with 20 additions and 15 deletions

View File

@ -1,5 +1,5 @@
import { type BusterShare, ShareAssetType, ShareRole } from '@/api/asset_interfaces'; import { type BusterShare, ShareAssetType, ShareRole } from '@/api/asset_interfaces';
import React, { useMemo, useState } from 'react'; import React, { useState } from 'react';
import { ShareMenuTopBar, ShareMenuTopBarOptions } from './ShareMenuTopBar'; import { ShareMenuTopBar, ShareMenuTopBarOptions } from './ShareMenuTopBar';
import { ShareMenuContentBody } from './ShareMenuContentBody'; import { ShareMenuContentBody } from './ShareMenuContentBody';
import { useMemoizedFn } from '@/hooks'; import { useMemoizedFn } from '@/hooks';

View File

@ -203,14 +203,14 @@ const ShareMenuContentShare: React.FC<{
</div> </div>
)} )}
{hasUserTeams && ( {/* {hasUserTeams && (
<> <>
<div className="bg-border my-2 h-[0.5px]" /> {hasIndividualPermissions && <div className="bg-border my-2 h-[0.5px]" />}
<ShareWithGroupAndTeamOption <ShareWithGroupAndTeamOption
onOpenShareWithGroupAndTeam={onOpenShareWithGroupAndTeam} onOpenShareWithGroupAndTeam={onOpenShareWithGroupAndTeam}
/> />
</> </>
)} )} */}
</div> </div>
); );
} }
@ -223,7 +223,7 @@ const ShareWithGroupAndTeamOption: React.FC<{
return ( return (
<div <div
onClick={onOpenShareWithGroupAndTeam} onClick={onOpenShareWithGroupAndTeam}
className={cn('hover:bg-item-hover flex cursor-pointer items-center space-x-1.5 px-3 py-2')}> className={cn('hover:bg-item-hover flex cursor-pointer items-center space-x-1.5')}>
<Button prefix={<UserGroup />} /> <Button prefix={<UserGroup />} />
<div className={cn('flex w-full items-center justify-between space-x-1.5')}> <div className={cn('flex w-full items-center justify-between space-x-1.5')}>
<Text>Share with groups & teams</Text> <Text>Share with groups & teams</Text>

View File

@ -30,6 +30,7 @@ export const MetricContainerHeaderButtons: React.FC<FileContainerButtonsProps> =
<SaveToDashboardButton metricId={metricId} /> <SaveToDashboardButton metricId={metricId} />
<ShareMetricButton metricId={metricId} /> <ShareMetricButton metricId={metricId} />
<ThreeDotMenuButton metricId={metricId} /> <ThreeDotMenuButton metricId={metricId} />
<HideButtonContainer show={renderViewLayoutKey === 'file'}> <HideButtonContainer show={renderViewLayoutKey === 'file'}>
<CreateChatButton /> <CreateChatButton />
</HideButtonContainer> </HideButtonContainer>
@ -78,7 +79,7 @@ const EditSQLButton = React.memo(() => {
return ( return (
<SelectableButton <SelectableButton
tooltipText="Edit SQL" tooltipText="SQL editor"
icon={<SquareCode />} icon={<SquareCode />}
onClick={onClickButton} onClick={onClickButton}
selected={isSelectedView} selected={isSelectedView}

View File

@ -36,7 +36,7 @@ import { ASSET_ICONS } from '@/components/features/config/assetIcons';
import { useSaveToDashboardDropdownContent } from '@/components/features/dropdowns/SaveToDashboardDropdown'; import { useSaveToDashboardDropdownContent } from '@/components/features/dropdowns/SaveToDashboardDropdown';
import { useMemoizedFn } from '@/hooks'; import { useMemoizedFn } from '@/hooks';
import { useSaveToCollectionsDropdownContent } from '@/components/features/dropdowns/SaveToCollectionsDropdown'; import { useSaveToCollectionsDropdownContent } from '@/components/features/dropdowns/SaveToCollectionsDropdown';
import { ShareAssetType, VerificationStatus } from '@/api/asset_interfaces/share'; import { ShareAssetType, ShareRole, VerificationStatus } from '@/api/asset_interfaces/share';
import { useStatusDropdownContent } from '@/components/features/metrics/StatusBadgeIndicator/StatusDropdownContent'; import { useStatusDropdownContent } from '@/components/features/metrics/StatusBadgeIndicator/StatusDropdownContent';
import { StatusBadgeIndicator } from '@/components/features/metrics/StatusBadgeIndicator'; import { StatusBadgeIndicator } from '@/components/features/metrics/StatusBadgeIndicator';
import { useFavoriteStar } from '@/components/features/list/FavoriteStar'; import { useFavoriteStar } from '@/components/features/list/FavoriteStar';
@ -432,13 +432,16 @@ const useRenameMetricSelectMenu = ({ metricId }: { metricId: string }) => {
export const useShareMenuSelectMenu = ({ metricId }: { metricId: string }) => { export const useShareMenuSelectMenu = ({ metricId }: { metricId: string }) => {
const { data: metric } = useGetMetric(metricId); const { data: metric } = useGetMetric(metricId);
const isOwner = metric?.permission === ShareRole.OWNER;
return useMemo( return useMemo(
() => ({ () => ({
label: 'Share metric', label: 'Share metric',
value: 'share-metric', value: 'share-metric',
icon: <ShareRight />, icon: <ShareRight />,
items: [ disabled: !isOwner,
items: isOwner
? [
<ShareMenuContent <ShareMenuContent
key={metricId} key={metricId}
shareAssetConfig={metric!} shareAssetConfig={metric!}
@ -446,6 +449,7 @@ export const useShareMenuSelectMenu = ({ metricId }: { metricId: string }) => {
assetType={ShareAssetType.METRIC} assetType={ShareAssetType.METRIC}
/> />
] ]
: undefined
}), }),
[metricId] [metricId]
); );