Skip to content

Commit

Permalink
feat: add some tooltip and launch icon
Browse files Browse the repository at this point in the history
Signed-off-by: amitamrutiya <[email protected]>
  • Loading branch information
amitamrutiya committed Jan 31, 2025
1 parent a17541e commit 096afb6
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 14 deletions.
11 changes: 7 additions & 4 deletions src/custom/CatalogDesignTable/DesignTableColumnConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MUIDataTableColumn, MUIDataTableMeta } from 'mui-datatables';
import { PLAYGROUND_MODES } from '../../constants/constants';
import { ChainIcon, CopyIcon, KanvasIcon, PublishIcon } from '../../icons';
import Download from '../../icons/Download/Download';
import { slugify } from '../CatalogDetail/helper';
import { downloadPattern, slugify } from '../CatalogDetail/helper';
import { RESOURCE_TYPES } from '../CatalogDetail/types';
import { Pattern } from '../CustomCatalog/CustomCard';
import { ConditionalTooltip } from '../Helpers/CondtionalTooltip';
Expand All @@ -25,7 +25,8 @@ interface ColumnConfigProps {
handleCopyUrl: (type: string, name: string, id: string) => void;
handleClone: (name: string, id: string) => void;
handleShowDetails: (designId: string, designName: string) => void;
handleDownload: (design: Pattern) => void;
handleDownload?: (design: Pattern) => void;
getDownloadUrl?: (id: string) => string;
isDownloadAllowed: boolean;
isCopyLinkAllowed: boolean;
isDeleteAllowed: boolean;
Expand Down Expand Up @@ -55,6 +56,7 @@ export const createDesignsColumnsConfig = ({
handleCopyUrl,
handleClone,
handleShowDetails,
getDownloadUrl,
handleDownload,
isUnpublishAllowed,
isCopyLinkAllowed,
Expand Down Expand Up @@ -182,8 +184,9 @@ export const createDesignsColumnsConfig = ({
const actionsList = [
{
title: 'Download',
// onClick: () => downloadPattern(rowData.id, rowData.name, getDownloadUrl),
onClick: () => handleDownload(rowData),
onClick: getDownloadUrl
? () => downloadPattern(rowData.id, rowData.name, getDownloadUrl)
: () => handleDownload && handleDownload(rowData),
disabled: !isDownloadAllowed,
icon: <Download width={24} height={24} fill={theme?.palette.icon.secondary} />
},
Expand Down
2 changes: 1 addition & 1 deletion src/custom/CatalogDesignTable/style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface DeleteIconProps {
}

export const L5DeleteIcon = styled(DeleteIcon)<DeleteIconProps>(({ disabled, bulk, theme }) => ({
color: disabled ? theme.palette.icon.disabled : theme.palette.text.secondary,
color: disabled ? theme.palette.icon.disabled : theme.palette.text.default,
cursor: disabled ? 'not-allowed' : 'pointer',
width: bulk ? '32' : '28.8',
height: bulk ? '32' : '28.8',
Expand Down
11 changes: 9 additions & 2 deletions src/custom/Workspaces/DesignTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ export interface DesignTableProps {
handlePublish: (publishModal: PublishModalState, data: any) => void;
publishModalHandler: any;
handleUnpublishModal: (design: Pattern, modalRef: React.RefObject<any>) => void;
handleDownload: (design: Pattern) => void;
handleDownload?: (design: Pattern) => void;
handleBulkUnpublishModal: (
selected: any,
designs: Pattern[],
modalRef: React.RefObject<any>
) => void;
handleShowDetails: (designId: string, designName: string) => void;
getDownloadUrl?: (id: string) => string;
GenericRJSFModal: any;
isDownloadAllowed: boolean;
isCopyLinkAllowed: boolean;
Expand Down Expand Up @@ -80,6 +81,7 @@ const DesignTable: React.FC<DesignTableProps> = ({
handleCopyUrl,
handlePublish,
handleDownload,
getDownloadUrl,
handleShowDetails,
handleUnpublishModal,
handleWorkspaceDesignDeleteModal,
Expand Down Expand Up @@ -123,6 +125,7 @@ const DesignTable: React.FC<DesignTableProps> = ({
handleClone,
handleShowDetails,
handleDownload,
getDownloadUrl,
isCopyLinkAllowed,
isDeleteAllowed,
isDownloadAllowed,
Expand Down Expand Up @@ -206,7 +209,11 @@ const DesignTable: React.FC<DesignTableProps> = ({
}}
id={'catalog-table'}
/>
<L5EditIcon onClick={designAssignment.handleAssignModal} disabled={!isAssignAllowed} />
<L5EditIcon
onClick={designAssignment.handleAssignModal}
disabled={!isAssignAllowed}
title="Assign Designs"
/>
</TableRightActionHeader>
</TableHeader>
);
Expand Down
1 change: 1 addition & 0 deletions src/custom/Workspaces/EnvironmentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ const EnvironmentTable: React.FC<EnvironmentTableProps> = ({
<L5EditIcon
onClick={environmentAssignment.handleAssignModal}
disabled={!isAssignAllowed}
title="Assign Environments"
/>
</TableRightActionHeader>
</TableHeader>
Expand Down
31 changes: 27 additions & 4 deletions src/custom/Workspaces/WorkspaceTeamsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Launch } from '@mui/icons-material';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { useState } from 'react';
import { Accordion, AccordionDetails, AccordionSummary, Typography } from '../../base';
import { Accordion, AccordionDetails, AccordionSummary, IconButton, Typography } from '../../base';
import { CLOUD_URL } from '../../constants/constants';
import { TeamsIcon } from '../../icons';
import { useTheme } from '../../theme';
import { CustomColumnVisibilityControl } from '../CustomColumnVisibilityControl';
import { CustomTooltip } from '../CustomTooltip';
import SearchBar from '../SearchBar';
import { TeamTableConfiguration } from '../TeamTable';
import TeamTable from '../TeamTable/TeamTable';
Expand Down Expand Up @@ -102,7 +106,7 @@ const TeamsTable: React.FC<TeamsTableProps> = ({
isDeleteTeamAllowed: isDeleteTeamAllowed,
setSearch
});

const theme = useTheme();
return (
<>
<Accordion expanded={expanded} onChange={handleAccordionChange} style={{ margin: 0 }}>
Expand Down Expand Up @@ -137,7 +141,19 @@ const TeamsTable: React.FC<TeamsTableProps> = ({
<L5EditIcon
onClick={teamAssignment.handleAssignModal}
disabled={!isAssignTeamAllowed}
title="Assign Teams"
/>
<CustomTooltip title={'Manage Teams'}>
<div>
<IconButton
onClick={() => {
window.open(`${CLOUD_URL}/identity/teams`, '_blank');
}}
>
<Launch />
</IconButton>
</div>
</CustomTooltip>
</TableRightActionHeader>
</TableHeader>
</AccordionSummary>
Expand All @@ -163,7 +179,14 @@ const TeamsTable: React.FC<TeamsTableProps> = ({
open={teamAssignment.assignModal}
onClose={teamAssignment.handleAssignModalClose}
title={`Assign Teams to ${workspaceName}`}
headerIcon={<TeamsIcon height="40" width="40" primaryFill={'white'} fill={'gray'} />}
headerIcon={
<TeamsIcon
height="40"
width="40"
primaryFill={theme.palette.common.white}
fill={theme.palette.icon.disabled}
/>
}
name="Teams"
assignableData={teamAssignment.data}
handleAssignedData={teamAssignment.handleAssignData}
Expand All @@ -173,7 +196,7 @@ const TeamsTable: React.FC<TeamsTableProps> = ({
height="5rem"
width="5rem"
primaryFill={'#808080'}
secondaryFill={'gray'}
secondaryFill={theme.palette.icon.disabled}
fill={'#808080'}
/>
}
Expand Down
6 changes: 5 additions & 1 deletion src/custom/Workspaces/WorkspaceViewsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,11 @@ const WorkspaceViewsTable: React.FC<ViewsTableProps> = ({
}}
id={'views-table'}
/>
<L5EditIcon onClick={viewAssignment.handleAssignModal} disabled={!isAssignAllowed} />
<L5EditIcon
onClick={viewAssignment.handleAssignModal}
disabled={!isAssignAllowed}
title="Assign Views"
/>
</TableRightActionHeader>
</TableHeader>
</AccordionSummary>
Expand Down
11 changes: 9 additions & 2 deletions src/custom/Workspaces/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface ExtendedEditIconProps {
disabled?: boolean;
bulk?: boolean;
style?: React.CSSProperties;
title?: string;
}

export const TableHeader = styled('div')({
Expand Down Expand Up @@ -292,10 +293,16 @@ export const L5DeleteIcon = ({
);
};

export const L5EditIcon = ({ onClick, disabled, bulk, style }: ExtendedEditIconProps) => {
export const L5EditIcon = ({
onClick,
disabled,
bulk,
style,
title = 'Edit'
}: ExtendedEditIconProps) => {
const theme = useTheme();
return (
<CustomTooltip title="Edit" arrow>
<CustomTooltip title={title} arrow>
<div>
<IconButton
onClick={onClick}
Expand Down

0 comments on commit 096afb6

Please sign in to comment.