Skip to content

Commit

Permalink
Merge pull request #536 from performant-software/dev
Browse files Browse the repository at this point in the history
v1.1.9-dev.5
  • Loading branch information
NickLaiacona authored Aug 31, 2023
2 parents 6780e84 + 5e9a124 commit 9c5ef1b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "faircopy",
"version": "1.1.9-dev.2",
"version": "1.1.9-dev.5",
"description": "A word processor for the humanities scholar.",
"main": "public/electron.js",
"private": true,
Expand All @@ -27,10 +27,10 @@
"author": "Performant Software Solutions LLC",
"homepage": ".",
"devDependencies": {
"@electron/notarize": "^2.1.0",
"dotenv": "^8.2.0",
"electron": "^25.5.0",
"electron-builder": "^24.6.3",
"@electron/notarize": "^2.1.0"
"electron-builder": "^24.6.3"
},
"dependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
Expand Down
1 change: 1 addition & 0 deletions public/css/ProjectNavigator.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#ProjectNavigator .tree-item-name {
margin-left: 10px;
padding-right: 10px;
display: inline-block;
width: 100%;
}
Expand Down
2 changes: 2 additions & 0 deletions public/main-process/worker-window-preload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

const preloadServices = require('./preload-worker-services')
const JSZip = require('jszip');
preloadServices.services.JSZip = JSZip

window.fairCopy = {
rootComponent: "WorkerWindow",
Expand Down
7 changes: 5 additions & 2 deletions src/components/main-window/ProjectNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import TreeItem from '@material-ui/lab/TreeItem';
import { Button, Icon, Typography, Chip, Tooltip } from '@material-ui/core';
import { getResourceIcon } from '../../model/resource-icon';
import { ellipsis } from '../../model/ellipsis'


export default class ProjectNavigator extends Component {
Expand Down Expand Up @@ -48,7 +49,9 @@ export default class ProjectNavigator extends Component {
}

renderTreeItemLabel(resourceName, resourceID, errorCount) {
const { onCloseResource } = this.props
const { onCloseResource, panelWidth } = this.props
const maxLength = (panelWidth-170)/10
const resourceNameElided = ellipsis( resourceName, maxLength )

const onClick = (event) => {
onCloseResource(resourceID)
Expand All @@ -57,7 +60,7 @@ export default class ProjectNavigator extends Component {

return (
<div className='tree-item'>
<Typography dataresourceid={resourceID} onClick={this.onClickNode} className="tree-item-name">{resourceName}</Typography>
<Typography dataresourceid={resourceID} onClick={this.onClickNode} className="tree-item-name">{resourceNameElided}</Typography>
{ this.renderStatusChip(errorCount) }
<Tooltip title="Close resource">
<Button
Expand Down
15 changes: 5 additions & 10 deletions src/components/main-window/TitleBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react'
import { Typography } from '@material-ui/core'
import { IconButton, Tooltip } from '@material-ui/core'
import { inlineRingSpinner } from '../common/ring-spinner'
import { ellipsis } from '../../model/ellipsis'

const maxTitleLength = 50

Expand Down Expand Up @@ -52,9 +53,9 @@ export default class TitleBar extends Component {
const resourceNameLength = resourceName ? resourceName.length > (maxTitleLength - surfaceNameLength) ? (maxTitleLength - surfaceNameLength) : resourceName.length : 0
const teiDocNameLength = parentResource ? parentResource.name.length > (maxTitleLength - surfaceNameLength - resourceNameLength) ? (maxTitleLength - surfaceNameLength - resourceNameLength) : parentResource.name.length : 0

const teiDocNameShort = parentResource ? shorten( parentResource.name, teiDocNameLength ) : ''
const resourceNameShort = resourceName ? shorten( resourceName, resourceNameLength ) : ''
const surfaceNameShort = surfaceName ? shorten( surfaceName, surfaceNameLength ) : ''
const teiDocNameShort = parentResource ? ellipsis( parentResource.name, teiDocNameLength ) : ''
const resourceNameShort = resourceName ? ellipsis( resourceName, resourceNameLength ) : ''
const surfaceNameShort = surfaceName ? ellipsis( surfaceName, surfaceNameLength ) : ''

const chevClass = "fa fa-chevron-right"
const resourceNameSeperator = isImageWindow ? <i aria-label="images" className="far fa-images image-icon-padding"></i> : <i aria-label="/" className={chevClass}></i>
Expand Down Expand Up @@ -82,10 +83,4 @@ export default class TitleBar extends Component {
</header>
)
}
}

function shorten( originalString, length ) {
if( originalString.length <= length ) return originalString
let shortString = originalString.substr(0,length)
return `${shortString}...`
}
}
6 changes: 6 additions & 0 deletions src/model/ellipsis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export function ellipsis( originalString, length ) {
if( originalString.length <= length ) return originalString
let shortString = originalString.substr(0,length)
return `${shortString}...`
}
2 changes: 1 addition & 1 deletion src/workers/project-archive-worker.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import JSZip from 'jszip'
import { getAuthToken } from '../model/cloud-api/auth'
import { checkInResources, checkOutResources } from '../model/cloud-api/resource-management'
import { getResourceAsync, getResourcesAsync } from "../model/cloud-api/resources"

const fairCopy = window.fairCopy
const JSZip = fairCopy.services.JSZip

// Worker state
let projectArchiveState = { open: false, jobQueue: [] }
Expand Down

0 comments on commit 9c5ef1b

Please sign in to comment.