Skip to content

Commit

Permalink
fix sidebar display issue, desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Mar 13, 2024
1 parent 74c720b commit c27e8af
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 26 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ This is a major updates based on massive technical enhancements.
* Ensured strict type and null safety checking
* Fixed a major problems in editor and local files sync related to Android 11 and newer

### Version 2.15.1

Fixed sidebar display issue on desktop

### Prior versions:
[Desktop](readme/about/changelog/desktop.md)

Expand Down
6 changes: 1 addition & 5 deletions packages/app-desktop/gui/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,11 @@ class RootComponent extends React.Component<Props, any> {
};

return (
// disableVendorPrefixes not exist
// <StyleSheetManager disableVendorPrefixes>
<StyleSheetManager>
<StyleSheetManager disableVendorPrefixes>
<ThemeProvider theme={theme}>
<StyleSheetContainer themeId={this.props.themeId}></StyleSheetContainer>
<MenuBar />
<GlobalStyle />
{/* style doesn't exist?? */}
{/* <Navigator style={navigatorStyle} screens={screens} className={`profile-${this.props.profileConfigCurrentProfileId}`} /> */}
<Navigator style={navigatorStyle} screens={screens} className={`profile-${this.props.profileConfigCurrentProfileId}`} />
{this.renderModalMessage(this.modalDialogProps())}
{this.renderDialogs()}
Expand Down
28 changes: 10 additions & 18 deletions packages/app-desktop/gui/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ interface Props {
noteCount?: number;

dispatch?: Dispatch;
onClick?: () => void;
// onClick?: () => void;
onClick?: (event: any) => void;
onFolderDragStart_?: React.DragEventHandler<HTMLDivElement>;
onFolderDragOver_?: React.DragEventHandler<HTMLDivElement>;
onFolderDrop_?: React.DragEventHandler<HTMLDivElement>;
Expand Down Expand Up @@ -135,19 +136,14 @@ function FolderItem(props: Props): React.JSX.Element {
const shareIcon = shareId && !parentId ? <StyledShareIcon className="fas fa-share-alt"></StyledShareIcon> : null;

return (
// depth, selected not exist
// <StyledListItem depth={depth} selected={selected} className={`list-item-container list-item-depth-${depth} ${selected ? 'selected' : ''}`} onDragStart={onFolderDragStart_} onDragOver={onFolderDragOver_} onDrop={onFolderDrop_} draggable={true} data-folder-id={folderId}>
<StyledListItem className={`list-item-container list-item-depth-${depth} ${selected ? 'selected' : ''}`} onDragStart={onFolderDragStart_} onDragOver={onFolderDragOver_} onDrop={onFolderDrop_} draggable={true} data-folder-id={folderId}>
{/* onFolderToggleClick_ needs event argument */}
{/* <ExpandLink themeId={props.themeId} hasChildren={hasChildren} folderId={folderId} onClick={onFolderToggleClick_} isExpanded={isExpanded} /> */}
<ExpandLink themeId={props.themeId} hasChildren={hasChildren} folderId={folderId} isExpanded={isExpanded} />
<StyledListItem depth={depth} selected={selected} className={`list-item-container list-item-depth-${depth} ${selected ? 'selected' : ''}`} onDragStart={onFolderDragStart_} onDragOver={onFolderDragOver_} onDrop={onFolderDrop_} draggable={true} data-folder-id={folderId}>
<ExpandLink themeId={props.themeId} hasChildren={hasChildren} folderId={folderId} onClick={props.onFolderToggleClick_} isExpanded={isExpanded} />
<StyledListItemAnchor
ref={anchorRef}
className="list-item"
// the following not exist
// isConflictFolder={folderId === Folder.conflictFolderId()}
// selected={selected}
// shareId={shareId}
isConflictFolder={folderId === Folder.conflictFolderId()}
selected={selected}
shareId={shareId}
href="#"
data-id={folderId}
data-type={BaseModel.TYPE_FOLDER}
Expand All @@ -156,8 +152,7 @@ function FolderItem(props: Props): React.JSX.Element {
onClick={() => {
if (folderId && folderItem_click) folderItem_click(folderId);
}}
// onFolderToggleClick_ needs event argument
// onDoubleClick={onFolderToggleClick_}
onDoubleClick={props.onFolderToggleClick_}
>
{showFolderIcon && folderIcon ? renderFolderIcon(folderIcon) : null}<StyledSpanFix className="title" style={{ lineHeight: 0 }}>{folderTitle}</StyledSpanFix>
{shareIcon} {noteCountComp}
Expand Down Expand Up @@ -651,9 +646,7 @@ const SidebarComponent = (props: Props): React.JSX.Element => {
// }

return (
// depth selected not exist
// <StyledListItem depth={0} selected={selected}
<StyledListItem
<StyledListItem depth={0} selected={selected}
className={`list-item-container ${selected ? 'selected' : ''}`}
key={tag.id}
onDrop={onTagDrop_}
Expand All @@ -664,8 +657,7 @@ const SidebarComponent = (props: Props): React.JSX.Element => {
ref={anchorRef}
className="list-item"
href="#"
// selected not exist
// selected={selected}
selected={selected}
data-id={tag.id}
data-type={BaseModel.TYPE_TAG}
onContextMenu={itemContextMenu}
Expand Down
21 changes: 19 additions & 2 deletions packages/app-desktop/gui/Sidebar/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,18 @@ export const StyledHeaderLabel = styled.span`
font-weight: bold;
`;

export const StyledListItem = styled.div`
type StyledListItemProps = {
depth?: number;
selected?: boolean;
className?: string;
onDragStart?: React.DragEventHandler<HTMLDivElement>;
onDragOver?: React.DragEventHandler<HTMLDivElement>;
onDrop?: React.DragEventHandler<HTMLDivElement>;
draggable?: boolean;
'data-folder-id'?: string;
};

export const StyledListItem = styled.div<StyledListItemProps>`
box-sizing: border-box;
height: 30px;
display: flex;
Expand All @@ -67,7 +78,13 @@ function listItemTextColor(props: any) {
return props.theme.color2;
}

export const StyledListItemAnchor = styled.a`
type StyledListItemAnchorProps = {
selected?: boolean;
shareId?: string;
isConflictFolder?: boolean;
};

export const StyledListItemAnchor = styled.a<StyledListItemAnchorProps>`
font-size: ${(props: any) => Math.round(props.theme.fontSize * 1.0833333)}px;
text-decoration: none;
color: ${(props: any) => listItemTextColor(props)};
Expand Down
2 changes: 1 addition & 1 deletion packages/app-desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xilinota/app-desktop",
"version": "2.15.0",
"version": "2.15.1",
"description": "Xilinota for Desktop",
"main": "main.js",
"private": true,
Expand Down

0 comments on commit c27e8af

Please sign in to comment.