Skip to content

Commit

Permalink
fix(*): various bugs from tutorial walkthrough
Browse files Browse the repository at this point in the history
Merge pull request #182 from qri-io/173_esc_list
  • Loading branch information
ramfox authored Sep 5, 2019
2 parents f64e82c + 0ab00e0 commit b9e9180
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 16 deletions.
10 changes: 4 additions & 6 deletions app/components/ComponentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ const ComponentList: React.FunctionComponent<ComponentListProps> = (props: Compo
components.map(({ name, displayName, tooltip, icon }) => {
if (status[name] && isLinked) {
const { filepath, status: fileStatus } = status[name]
let filename
if (filepath === 'repo') {
filename = ''
} else {
let filename = ''
if (filepath !== 'repo') {
filename = filepath.substring((filepath.lastIndexOf('/') + 1))
}

Expand All @@ -159,11 +157,11 @@ const ComponentList: React.FunctionComponent<ComponentListProps> = (props: Compo
const menuItems: MenuItemConstructorOptions[] = [
{
label: 'Open in Finder',
click: () => { shell.showItemInFolder(`${linkpath}/${filepath}`) }
click: () => { shell.showItemInFolder(`${linkpath}/${filename}`) }
},
{
label: 'Copy File Path',
click: () => { clipboard.writeText(`${linkpath}/${filepath}`) }
click: () => { clipboard.writeText(`${linkpath}/${filename}`) }
}
]

Expand Down
2 changes: 1 addition & 1 deletion app/components/Dataset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class Dataset extends React.Component<DatasetProps> {
this.props.setActiveTab('history')
})

ipcRenderer.on('show-datasets', () => {
ipcRenderer.on('toggle-dataset-list', () => {
this.props.toggleDatasetList()
})

Expand Down
18 changes: 18 additions & 0 deletions app/components/DatasetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,31 @@ import { Modal, ModalType } from '../models/modals'
interface DatasetListProps {
myDatasets: MyDatasets
workingDataset: WorkingDataset
toggleDatasetList: () => Action
setFilter: (filter: string) => Action
setWorkingDataset: (peername: string, name: string, isLinked: boolean, published: boolean) => Action
fetchMyDatasets: (page: number, pageSize: number) => Promise<AnyAction>
setModal: (modal: Modal) => void
}

export default class DatasetList extends React.Component<DatasetListProps> {
constructor (props: DatasetListProps) {
super(props)
this.handleEsc = this.handleEsc.bind(this)
}

handleEsc (e: KeyboardEvent) {
if (e.key === 'Escape') this.props.toggleDatasetList()
}

componentDidMount () {
document.addEventListener('keydown', this.handleEsc)
}

componentWillUnmount () {
document.removeEventListener('keydown', this.handleEsc)
}

handleFilterChange (e: any) {
const { setFilter } = this.props
const filter = e.target.value
Expand Down
12 changes: 8 additions & 4 deletions app/components/DatasetSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,17 @@ const DatasetSidebar: React.FunctionComponent<DatasetSidebarProps> = ({
>
Status
</div>
{!(history.pageInfo.error && history.pageInfo.error.includes('no history')) && <div
className={classNames('tab', { 'active': activeTab === 'history' })}
onClick={() => { onTabClick('history') }}
<div
className={classNames('tab', { 'active': activeTab === 'history', 'disabled': history.pageInfo.error && history.pageInfo.error.includes('no history') })}
onClick={() => {
if (!(history.pageInfo.error && history.pageInfo.error.includes('no history'))) {
onTabClick('history')
}
}}
data-tip={path ? 'Explore older versions of this dataset' : 'This dataset has no previous versions'}
>
History
</div>}
</div>
</div>
<div id='content'>
<CSSTransition
Expand Down
2 changes: 1 addition & 1 deletion app/components/ParseError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const ParseError: React.FunctionComponent<ParseErrorProps> = ({ component, filen
<div className={'message-container'}>
<div>
<h4>There are parsing errors in your {component}</h4>
<p>Fix the errors in your <strong>{filename}</strong> file to be able to view the file in Qri Desktop or to save a version of your dataset.</p>
<p>Fix the errors in your <strong>{filename}</strong> file to be able to view it in Qri Desktop.</p>
<Button text="Show in Finder" color="primary" onClick={() => { shell.openItem(linkpath) }} />
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions app/containers/DatasetListContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { connect } from 'react-redux'
import { setFilter } from '../actions/myDatasets'
import { fetchMyDatasets } from '../actions/api'
import { toggleDatasetList } from '../actions/ui'
import { setWorkingDataset } from '../actions/selections'
import DatasetList from '../components/DatasetList'

Expand All @@ -21,6 +22,7 @@ const mapStateToProps = (state: any, ownProps: DatasetListContainerProps) => {
}

const actions = {
toggleDatasetList,
setFilter,
setWorkingDataset,
fetchMyDatasets
Expand Down
14 changes: 10 additions & 4 deletions app/main.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ app.on('ready', () =>
}
},
{
id: 'show-dataset-list',
label: 'Show Dataset List',
id: 'toggle-dataset-list',
label: 'Toggle Dataset List',
accelerator: 'Command+T',
click () {
mainWindow.webContents.send('show-datasets')
mainWindow.webContents.send('toggle-dataset-list')
}
},
{
Expand Down Expand Up @@ -371,6 +371,12 @@ app.on('ready', () =>
click: () => {
shell.openExternal('https://qri.io/contact/')
}
},
{
label: 'Chat with the community...',
click: () => {
shell.openExternal('https://discord.gg/etap8Gb')
}
}
]
}
Expand Down Expand Up @@ -484,7 +490,7 @@ app.on('ready', () =>
'add-dataset',
'show-status',
'show-history',
'show-dataset-list',
'toggle-dataset-list',
'publish-unpublish-dataset',
'view-on-qri-cloud',
'open-working-directory'
Expand Down

0 comments on commit b9e9180

Please sign in to comment.