Skip to content

Commit 6765d63

Browse files
committed
feat: remove TooltipIcon component and add helper functions for timestamp parsing
Signed-off-by: Amit Amrutiya <[email protected]>
1 parent bbb0588 commit 6765d63

File tree

6 files changed

+80
-76
lines changed

6 files changed

+80
-76
lines changed

src/custom/UserSearchField/UserSearchFieldInput.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,6 @@ const UserSearchField: React.FC<UserSearchFieldProps> = ({
6262
usersSearch,
6363
setUsersSearch
6464
}) => {
65-
console.log('amit usersearchfield', {
66-
usersData,
67-
setUsersData,
68-
label,
69-
setDisableSave,
70-
handleNotifyPref,
71-
notifyUpdate,
72-
isCreate,
73-
searchType,
74-
disabled,
75-
currentUserData,
76-
searchedUsers,
77-
isUserSearchLoading,
78-
fetchSearchedUsers,
79-
usersSearch,
80-
setUsersSearch
81-
});
8265
const [error, setError] = useState('');
8366
const [open, setOpen] = useState(false);
8467
const [showAllUsers, setShowAllUsers] = useState(false);

src/custom/Workspaces/TooltipIcon.tsx

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/custom/Workspaces/helper.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { formatDate } from '../CatalogDetail/helper';
2+
3+
/**
4+
* Helper function to parse and format the value of a field representing a deletion timestamp in the provided data object.
5+
* @param {Object} data - The data object containing the field representing the deletion timestamp.
6+
* @returns {string} - The formatted date string if the deletion timestamp is valid; otherwise, "N/A".
7+
*/
8+
9+
export const DEFAULT_DATE = 'N/A'; // a constant to represent the default date value
10+
export const parseDeletionTimestamp = (data: {
11+
deleted_at: { Valid: boolean; Time: string | number | Date };
12+
}) => {
13+
if (data && data.deleted_at && data.deleted_at.Valid === true) {
14+
const date = new Date(data.deleted_at.Time);
15+
return formatDate(date);
16+
} else {
17+
return DEFAULT_DATE;
18+
}
19+
};

src/custom/Workspaces/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
import AssignmentModal from './AssignmentModal';
22
import DesignTable from './DesignTable';
33
import EnvironmentTable from './EnvironmentTable';
4-
export { AssignmentModal, DesignTable, EnvironmentTable };
4+
import WorkspaceTeamsTable from './WorkspaceTeamsTable';
5+
import useDesignAssignment from './hooks/useDesignAssignment';
6+
import useEnvironmentAssignment from './hooks/useEnvironmentAssignment';
7+
import useTeamAssignment from './hooks/useTeamAssignment';
8+
9+
export {
10+
AssignmentModal,
11+
DesignTable,
12+
EnvironmentTable,
13+
WorkspaceTeamsTable,
14+
useDesignAssignment,
15+
useEnvironmentAssignment,
16+
useTeamAssignment
17+
};

src/custom/Workspaces/styles.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,50 @@ export const CustomBodyRenderStyle = styled('div')({
6363
display: 'block',
6464
width: '100%'
6565
});
66+
67+
export const TableTopIcon = styled('span')(() => ({
68+
'& svg': {
69+
cursor: 'pointer',
70+
width: '2rem',
71+
height: '2rem'
72+
}
73+
}));
74+
75+
export const DisabledTableTopIcon = styled('span')(() => ({
76+
'& svg': {
77+
width: '2rem',
78+
height: '2rem'
79+
}
80+
}));
81+
82+
export const MesheryDeleteIcon = styled('span')(({ theme }) => ({
83+
'& svg': {
84+
color: '#3C494F',
85+
'&:hover': {
86+
color: theme.palette.error.error
87+
}
88+
}
89+
}));
90+
91+
export const TableIconsDisabledContainer = styled('span')(() => ({
92+
color: '#455a64',
93+
opacity: '0.5',
94+
'& svg': {
95+
cursor: 'not-allowed'
96+
}
97+
}));
98+
99+
export const TableTopIconsWrapper = styled('div')(() => ({
100+
display: 'flex',
101+
justifyContent: 'space-between',
102+
paddingRight: '26px'
103+
}));
104+
105+
export const TableIconsContainer = styled('div')(() => ({
106+
color: '#455a64',
107+
display: 'flex',
108+
cursor: 'not-allowed',
109+
'& svg': {
110+
cursor: 'pointer'
111+
}
112+
}));

src/custom/Workspaces/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ export interface Environment {
3232
updated_at: string;
3333
}
3434

35-
export interface ColumnVisibility {
36-
[key: string]: boolean;
37-
}
38-
3935
export interface Team {
4036
id: string;
4137
name: string;

0 commit comments

Comments
 (0)