Skip to content

Commit

Permalink
Record page styling update (#1300)
Browse files Browse the repository at this point in the history
- More consistent font sizes and weights
- More distinguished collapsible UI elements
- Group all collapsible sections to bottom of category
- Larger navigation panel
- Updated "active section" highlighting in navigation panel
- Updated click behavior for navigation panel links
- Remove checkboxes from navigation panel
- Remove enumeration from categories
- Fixes to "scroll anchor" behavior (preventing page jumps as sections load)
- Fix to linking between transcription summary and expression graphs sections
  • Loading branch information
dmfalke authored Jan 21, 2025
1 parent eab6fe7 commit 96e923f
Show file tree
Hide file tree
Showing 37 changed files with 689 additions and 681 deletions.
1 change: 1 addition & 0 deletions packages/libs/coreui/src/components/Mesa/Ui/DataRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class DataRow extends React.PureComponent {
return (
<>
<tr
id={getRowId ? 'row_id_' + getRowId(row) : undefined}
className={className
.concat(showChildRow ? ' _childIsExpanded' : '')
.concat(hasExpansionColumn ? ' _isExpandable' : '')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ type Props = {
heading: boolean;
};

const EMPTY_ARRAY: Props['expandedRows'] = [];

export default function ExpansionCell({
rows,
row,
onExpandedRowsChange,
expandedRows,
expandedRows = EMPTY_ARRAY,
getRowId,
inert,
heading,
Expand Down
5 changes: 0 additions & 5 deletions packages/libs/eda/src/lib/workspace/EDAWorkspace.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
font-size: 0.9em;
}

.wdk-RecordSidebarToggle,
.wdk-RecordSidebar {
background-color: #eaeaea;
}

.wdk-RecordActions,
.wdk-RecordHeading {
display: none;
Expand Down
2 changes: 1 addition & 1 deletion packages/libs/wdk-client/src/Actions/RecordActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export type SectionVisibilityAction = {
type: typeof SECTION_VISIBILITY;
payload: {
name: string;
isVisible: boolean;
isVisible?: boolean;
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { makeSearchHelpText } from '../../Utils/SearchUtils';
import CheckboxTree, {
LinksPosition,
CheckboxTreeStyleSpec,
CheckboxTreeProps,
} from '@veupathdb/coreui/lib/components/inputs/checkboxes/CheckboxTree/CheckboxTree';
import {
getFilteredNodeChildren,
Expand All @@ -20,7 +21,7 @@ import {

const sharedCheckboxTreeContainerStyleSpec: React.CSSProperties = {
position: 'relative',
maxHeight: '75vh',
maxHeight: 'calc(100vh - 2.5em - var(--page-offset-top, 0px))',
overflow: 'hidden',
display: 'flex',
flexDirection: 'column',
Expand Down Expand Up @@ -67,6 +68,7 @@ type Props = {
* If omitted, the container uses the sharedCheckboxTreeContainerStyleSpec default styles
*/
type?: 'headerMenu' | 'searchPane';
additionalFilters?: CheckboxTreeProps<unknown>['additionalFilters'];
};

let CategoriesCheckboxTree: FunctionComponent<Props> = (props) => {
Expand Down Expand Up @@ -98,6 +100,7 @@ let CategoriesCheckboxTree: FunctionComponent<Props> = (props) => {
containerClassName = '',
styleOverrides = {},
type,
additionalFilters,
} = props;

if (tree.children.length == 0) {
Expand All @@ -119,6 +122,7 @@ let CategoriesCheckboxTree: FunctionComponent<Props> = (props) => {
? {
...sharedCheckboxTreeContainerStyleSpec,
minWidth: '18.75em',
maxHeight: 'none',
}
: {
...sharedCheckboxTreeContainerStyleSpec,
Expand Down Expand Up @@ -164,6 +168,7 @@ let CategoriesCheckboxTree: FunctionComponent<Props> = (props) => {
onExpansionChange={onUiChange}
onSearchTermChange={onSearchTermChange}
styleOverrides={styleOverrides}
additionalFilters={additionalFilters}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cursor: pointer;
position: relative;
display: flex;
align-items: flex-start;
align-items: center;
}

.wdk-CollapsibleSectionHeader:before {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ function CollapsibleSection(props: Props) {

const handleCollapsedChange = useCallback(
(event: React.MouseEvent<HTMLElement>) => {
event.currentTarget.blur();
event.stopPropagation();
onCollapsedChange(!isCollapsed);
},
[isCollapsed, onCollapsedChange]
Expand Down
1 change: 1 addition & 0 deletions packages/libs/wdk-client/src/Core/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const routes: RouteEntry[] = [

{
path: '/record/:recordClass/:primaryKey+',
rootClassNameModifier: 'record',
component: (
props: RouteComponentProps<{ recordClass: string; primaryKey: string }>
) => <RecordController {...props.match.params} />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ export function reduce(state: State = {} as State, action: Action): State {
case SECTION_VISIBILITY: {
let collapsedSections = updateList(
action.payload.name,
!action.payload.isVisible,
!(
action.payload.isVisible ??
state.collapsedSections.includes(action.payload.name)
),
state.collapsedSections
);
return { ...state, collapsedSections };
Expand Down
9 changes: 9 additions & 0 deletions packages/libs/wdk-client/src/Utils/CategoryUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ function makeComparator(
questions: Dict<Question>
) {
return composeComparators(
compareByTargetType,
compareByChildren,
compareBySortNumber,
makeCompareBySortName(recordClasses, questions)
Expand All @@ -427,6 +428,14 @@ function composeComparators(...comparators: NodeComparator[]): NodeComparator {
};
}

function compareByTargetType(nodeA: CategoryTreeNode, nodeB: CategoryTreeNode) {
const nodeATargetType = getTargetType(nodeA);
const nodeBTargetType = getTargetType(nodeB);
if (nodeATargetType === 'attribute' && nodeBTargetType === 'table') return -1;
if (nodeATargetType === 'table' && nodeBTargetType === 'attribute') return 1;
return 0;
}

/**
* Set subsections before leaves (tables,attributes or searches)
* This makes the current record page section numbering system work
Expand Down
Loading

0 comments on commit 96e923f

Please sign in to comment.