diff --git a/.changeset/soft-tomatoes-know.md b/.changeset/soft-tomatoes-know.md new file mode 100644 index 0000000000..1b48f759da --- /dev/null +++ b/.changeset/soft-tomatoes-know.md @@ -0,0 +1,8 @@ +--- +'@kadena/explorer': patch +--- + +Reordering columns to present the first column as the one to link to + +Remove toggling close of truncated content. Will always open so users can no +select and copy diff --git a/packages/apps/explorer/src/components/DataRenderComponent/ExpandTruncatedField/ExpandTruncatedField.tsx b/packages/apps/explorer/src/components/DataRenderComponent/ExpandTruncatedField/ExpandTruncatedField.tsx index 20180fd117..020671e64f 100644 --- a/packages/apps/explorer/src/components/DataRenderComponent/ExpandTruncatedField/ExpandTruncatedField.tsx +++ b/packages/apps/explorer/src/components/DataRenderComponent/ExpandTruncatedField/ExpandTruncatedField.tsx @@ -2,7 +2,7 @@ import { CopyButton } from '@/components/CopyButton/CopyButton'; import { Stack, Text } from '@kadena/kode-ui'; import classNames from 'classnames'; import type { FC } from 'react'; -import React, { useCallback, useEffect, useState } from 'react'; +import React, { useState } from 'react'; import { descriptionDetailsClass, descriptionDetailsExpandedClass, @@ -14,54 +14,13 @@ interface IProps { field: IDataRenderComponentField; } -const storageKey = 'expandedfields'; - export const ExpandTruncatedField: FC = ({ field }) => { const [isExpanded, setIsExpanded] = useState(false); const toggleExpand = (): void => { - let storage: string[] = JSON.parse( - localStorage.getItem(storageKey) ?? '[]', - ); - - const key = field.key ? field.key : field.id ?? ''; - - if (isExpanded) { - storage = storage.filter((v) => v !== key); - } else { - storage.push(key); - } - - localStorage.setItem(storageKey, JSON.stringify(storage)); - - window.dispatchEvent(new Event(storageKey)); - setIsExpanded((v) => !isExpanded); + setIsExpanded((v) => true); }; - const checkStorage = () => { - const storage: string[] = JSON.parse( - localStorage.getItem(storageKey) ?? '[]', - ); - - setIsExpanded(storage.includes(field.key)); - }; - const storageListener = useCallback((event: StorageEvent | Event) => { - if (event.type !== storageKey && 'key' in event && event.key !== storageKey) - return; - - checkStorage(); - }, []); - - useEffect(() => { - checkStorage(); - window.addEventListener(storageKey, storageListener); - window.addEventListener('storage', storageListener); - return () => { - window.removeEventListener(storageKey, storageListener); - window.removeEventListener('storage', storageListener); - }; - }, [storageListener]); - return (